From bbcb40736b04f6269a39e130cb7084ffc031fd9e Mon Sep 17 00:00:00 2001
From: Unprincess17 <202030211121@whu.edu.cn>
Date: Mon, 27 Jun 2022 17:18:20 +0800
Subject: [PATCH] tmp
---
.../Properties/AndroidManifest.xml | 1 +
.../Properties/AssemblyInfo.cs | 1 +
.../Resources/Resource.designer.cs | 2 +-
azure_m/azure_m/azure_m/App.xaml.cs | 14 +++--
azure_m/azure_m/azure_m/AppShell.xaml | 6 +-
azure_m/azure_m/azure_m/AppShell.xaml.cs | 3 +
azure_m/azure_m/azure_m/Views/AddPage.xaml | 12 ++++
azure_m/azure_m/azure_m/Views/AddPage.xaml.cs | 20 ++++++
azure_m/azure_m/azure_m/Views/MainPage.xaml | 8 ++-
.../azure_m/azure_m/Views/MainPage.xaml.cs | 63 ++++++++++++++-----
.../azure_m/Views/ResourceGroupPage.xaml | 12 ++++
.../azure_m/Views/ResourceGroupPage.xaml.cs | 20 ++++++
.../azure_m/azure_m/Views/SubscribePage.xaml | 12 ++++
.../azure_m/Views/SubscribePage.xaml.cs | 20 ++++++
.../azure_m/Views/VirtualMachinePage.xaml | 12 ++++
.../azure_m/Views/VirtualMachinePage.xaml.cs | 20 ++++++
azure_m/azure_m/azure_m/azure_m.csproj | 18 ++++++
17 files changed, 219 insertions(+), 25 deletions(-)
create mode 100644 azure_m/azure_m/azure_m/Views/AddPage.xaml
create mode 100644 azure_m/azure_m/azure_m/Views/AddPage.xaml.cs
create mode 100644 azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml
create mode 100644 azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml.cs
create mode 100644 azure_m/azure_m/azure_m/Views/SubscribePage.xaml
create mode 100644 azure_m/azure_m/azure_m/Views/SubscribePage.xaml.cs
create mode 100644 azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml
create mode 100644 azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml.cs
diff --git a/azure_m/azure_m/azure_m.Android/Properties/AndroidManifest.xml b/azure_m/azure_m/azure_m.Android/Properties/AndroidManifest.xml
index 74d76205..8580b485 100644
--- a/azure_m/azure_m/azure_m.Android/Properties/AndroidManifest.xml
+++ b/azure_m/azure_m/azure_m.Android/Properties/AndroidManifest.xml
@@ -3,4 +3,5 @@
+
diff --git a/azure_m/azure_m/azure_m.Android/Properties/AssemblyInfo.cs b/azure_m/azure_m/azure_m.Android/Properties/AssemblyInfo.cs
index a8f3e97e..496313a5 100644
--- a/azure_m/azure_m/azure_m.Android/Properties/AssemblyInfo.cs
+++ b/azure_m/azure_m/azure_m.Android/Properties/AssemblyInfo.cs
@@ -28,3 +28,4 @@ using Android.App;
// Add some common permissions, these can be removed if not needed
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
+[assembly: UsesPermission(Android.Manifest.Permission.Vibrate)]
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m.Android/Resources/Resource.designer.cs b/azure_m/azure_m/azure_m.Android/Resources/Resource.designer.cs
index 0b8d56b6..f881d6d6 100644
--- a/azure_m/azure_m/azure_m.Android/Resources/Resource.designer.cs
+++ b/azure_m/azure_m/azure_m.Android/Resources/Resource.designer.cs
@@ -14,7 +14,7 @@ namespace azure_m.Droid
{
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.2.4.160")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "12.3.0.26")]
public partial class Resource
{
diff --git a/azure_m/azure_m/azure_m/App.xaml.cs b/azure_m/azure_m/azure_m/App.xaml.cs
index d6ad8b9d..ebcd6c97 100644
--- a/azure_m/azure_m/azure_m/App.xaml.cs
+++ b/azure_m/azure_m/azure_m/App.xaml.cs
@@ -1,6 +1,9 @@
-using azure_m.Services;
+#define DEBUG
+
+using azure_m.Services;
using azure_m.Views;
using System;
+using System.Threading;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using Microsoft.Identity.Client;
@@ -16,18 +19,19 @@ namespace azure_m
DependencyService.Register();
DependencyService.Register();
+
QueryInfo.initEnv();
+#if DEBUG
+ MainPage = new AppShell();
+#else
MainPage = new LoginPage();
((LoginPage)MainPage).LoginCompleted += h;
+#endif
startBack();
- //LoginPage loginPage = new LoginPage();
- ////VirtualNetworkPage = new AppShell
- //loginPage.LoginCompleted += h;
}
public void h(object sender, string e)
{
- Console.WriteLine(e);
MainPage=new AppShell();
}
diff --git a/azure_m/azure_m/azure_m/AppShell.xaml b/azure_m/azure_m/azure_m/AppShell.xaml
index 342767d9..7a8c2dd0 100644
--- a/azure_m/azure_m/azure_m/AppShell.xaml
+++ b/azure_m/azure_m/azure_m/AppShell.xaml
@@ -4,7 +4,7 @@
xmlns:local="clr-namespace:azure_m.Views" xmlns:azure_m="clr-namespace:azure_m" x:DataType="azure_m:AppShell"
Title="Azure"
Shell.NavBarHasShadow="True"
-
+ Shell.TabBarIsVisible="False"
x:Class="azure_m.AppShell"
>
@@ -183,8 +183,8 @@
-
-
+
+
diff --git a/azure_m/azure_m/azure_m/AppShell.xaml.cs b/azure_m/azure_m/azure_m/AppShell.xaml.cs
index 313e6e29..87c62265 100644
--- a/azure_m/azure_m/azure_m/AppShell.xaml.cs
+++ b/azure_m/azure_m/azure_m/AppShell.xaml.cs
@@ -18,6 +18,9 @@ namespace azure_m
Routing.RegisterRoute(nameof(MonitorPage), typeof(MonitorPage));
Routing.RegisterRoute(nameof(AllResourcesPage), typeof(AllResourcesPage));
Routing.RegisterRoute(nameof(AllServicePage), typeof(AllServicePage));
+ Routing.RegisterRoute(nameof(AddPage), typeof(AddPage));
+ Routing.RegisterRoute(nameof(VirtualMachinePage), typeof(VirtualMachinePage));
+ Routing.RegisterRoute(nameof(ResourceGroupPage), typeof(ResourceGroupPage));
this.CurrentItem = Home;
}
diff --git a/azure_m/azure_m/azure_m/Views/AddPage.xaml b/azure_m/azure_m/azure_m/Views/AddPage.xaml
new file mode 100644
index 00000000..e65deb0a
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/AddPage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/AddPage.xaml.cs b/azure_m/azure_m/azure_m/Views/AddPage.xaml.cs
new file mode 100644
index 00000000..7abd070b
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/AddPage.xaml.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace azure_m.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class AddPage : ContentPage
+ {
+ public AddPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/MainPage.xaml b/azure_m/azure_m/azure_m/Views/MainPage.xaml
index d6944bfd..7112b1e0 100644
--- a/azure_m/azure_m/azure_m/Views/MainPage.xaml
+++ b/azure_m/azure_m/azure_m/Views/MainPage.xaml
@@ -50,7 +50,13 @@
-
+
+
+
diff --git a/azure_m/azure_m/azure_m/Views/MainPage.xaml.cs b/azure_m/azure_m/azure_m/Views/MainPage.xaml.cs
index 63c7bf29..c43ee1f5 100644
--- a/azure_m/azure_m/azure_m/Views/MainPage.xaml.cs
+++ b/azure_m/azure_m/azure_m/Views/MainPage.xaml.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
+using Xamarin.Essentials;
using azure_m.Models;
namespace azure_m.Views
@@ -27,7 +28,7 @@ namespace azure_m.Views
List resources = new List();
//查询指定资源,放置在ResourcesLayout中
//resources = await GetResourcesByApi(type)...
- //resources.sort by type nad name
+ //resources.sort by type nad name (or linq
///DEBUG
if(type == 0)
@@ -36,26 +37,55 @@ namespace azure_m.Views
resources.Add(new Resource( "jp", "vm", "1", "虚拟机"));
}
- resources.ForEach(o => {
+ //no resources
+ if (resources.Count == 0)
+ {
Grid grid = new Grid
{
Margin = new Thickness(20, 0, 20, 0),
HorizontalOptions = LayoutOptions.FillAndExpand,
BackgroundColor = Color.MintCream,
RowSpacing = 10,
- ColumnDefinitions =
+ RowDefinitions =
{
//new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
- new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
- new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
- new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }
+ new RowDefinition { Height = new GridLength (2, GridUnitType.Star) },
+ new RowDefinition { Height = new GridLength (1, GridUnitType.Star) }
}
};
- grid.Children.Add(new Image { Source = getSourceByType(o.type), HeightRequest = 15, VerticalOptions = LayoutOptions.Start }, 0, 0);
- grid.Children.Add(new Label { Text = o.name, HeightRequest = grid.Height, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start }, 0, 0);
- grid.Children.Add(new Label { Text = o.type, HeightRequest = grid.Height, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }, 1, 0);
+ var formattedString = new FormattedString();
+ formattedString.Spans.Add(new Span { Text = "No resources have been favorited\n", FontAttributes = FontAttributes.Bold });
+
+ var span = new Span { Text = "Favorite resources to quickly navigate to them from the home page." };
+ formattedString.Spans.Add(span);
+ grid.Children.Add(new Label { FormattedText = formattedString },0,0);
ResourceLayout.Children.Add(grid);
- });
+ }
+
+ else
+ {
+ resources.ForEach(o =>
+ {
+ Grid grid = new Grid
+ {
+ Margin = new Thickness(20, 0, 20, 0),
+ HorizontalOptions = LayoutOptions.FillAndExpand,
+ BackgroundColor = Color.MintCream,
+ RowSpacing = 10,
+ ColumnDefinitions =
+ {
+ //new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (2, GridUnitType.Star) },
+ new ColumnDefinition { Width = new GridLength (1, GridUnitType.Star) }
+ }
+ };
+ grid.Children.Add(new Image { Source = getSourceByType(o.type), HeightRequest = 15, VerticalOptions = LayoutOptions.Start }, 0, 0);
+ grid.Children.Add(new Label { Text = o.name, HeightRequest = grid.Height, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start }, 0, 0);
+ grid.Children.Add(new Label { Text = o.type, HeightRequest = grid.Height, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }, 1, 0);
+ ResourceLayout.Children.Add(grid);
+ });
+ }
}
@@ -88,7 +118,7 @@ namespace azure_m.Views
{
swapBtnColors();
//异步 querying datas, 在此期间出现一个刷新标志
- GetResources(1);
+ GetResources(0);
}
public void OnMyIcon_Clicked(object sender, EventArgs e)
@@ -112,17 +142,20 @@ namespace azure_m.Views
public void OnAdd_Clicked(object sender, EventArgs e)
{
//this.Navigation.PushAsync(new AddPage());
- DisplayAlert("Alert", "AddPage", "OK");
+ Xamarin.Essentials.Vibration.Vibrate(500);
+ Navigation.PushAsync(new AddPage());
+
+
}
public void OnSubscribe_Clicked(object sender, EventArgs e)
{
//this.Navigation.PushAsync(new SubscribePage());
- DisplayAlert("Alert", "SubscribePage", "OK");
+ Navigation.PushAsync(new SubscribePage());
}
public void OnVM_Clicked(object sender, EventArgs e)
{
//Navigation.PushAsync(new VirtualMachinePage());
- DisplayAlert("Alert", "VMPage", "OK");
+ Navigation.PushAsync(new VirtualMachinePage());
}
public void OnDashboard_Clicked(object sender, EventArgs e)
{
@@ -136,7 +169,7 @@ namespace azure_m.Views
public void OnMoreService_Clicked(object sender, EventArgs e)
{
//Navigation.PushAsync(new AllService());
- DisplayAlert("Alert", "AllService", "OK");
+ Navigation.PushAsync(new AllServicePage());
}
private void MoreResourceBtn_Clicked(object sender, EventArgs e)
diff --git a/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml b/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml
new file mode 100644
index 00000000..cfd8ef77
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml.cs b/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml.cs
new file mode 100644
index 00000000..59a2a2cb
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/ResourceGroupPage.xaml.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace azure_m.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class ResourceGroupPage : ContentPage
+ {
+ public ResourceGroupPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/SubscribePage.xaml b/azure_m/azure_m/azure_m/Views/SubscribePage.xaml
new file mode 100644
index 00000000..3929504e
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/SubscribePage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/SubscribePage.xaml.cs b/azure_m/azure_m/azure_m/Views/SubscribePage.xaml.cs
new file mode 100644
index 00000000..8613e34e
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/SubscribePage.xaml.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace azure_m.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class SubscribePage : ContentPage
+ {
+ public SubscribePage()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml b/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml
new file mode 100644
index 00000000..d1b8d8bf
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml.cs b/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml.cs
new file mode 100644
index 00000000..aed107c1
--- /dev/null
+++ b/azure_m/azure_m/azure_m/Views/VirtualMachinePage.xaml.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using Xamarin.Forms;
+using Xamarin.Forms.Xaml;
+
+namespace azure_m.Views
+{
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class VirtualMachinePage : ContentPage
+ {
+ public VirtualMachinePage()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/azure_m/azure_m/azure_m/azure_m.csproj b/azure_m/azure_m/azure_m/azure_m.csproj
index f70c4b53..e2d96c5b 100644
--- a/azure_m/azure_m/azure_m/azure_m.csproj
+++ b/azure_m/azure_m/azure_m/azure_m.csproj
@@ -17,12 +17,30 @@
+
+ VirtualMachinePage.xaml
+
+
+
+
+
+ MSBuild:UpdateDesignTimeXaml
+
MSBuild:UpdateDesignTimeXaml
+
+ MSBuild:UpdateDesignTimeXaml
+
+
+ MSBuild:UpdateDesignTimeXaml
+
MSBuild:UpdateDesignTimeXaml
+
+ MSBuild:UpdateDesignTimeXaml
+
MSBuild:UpdateDesignTimeXaml
--
GitLab