Skip to content

Commit

Permalink
savepoint before adding weather module
Browse files Browse the repository at this point in the history
  • Loading branch information
panxuc committed Aug 4, 2023
1 parent e55f83d commit 2bff975
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 289 deletions.
36 changes: 21 additions & 15 deletions android/XPrism/XPrism/AboutPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@
xmlns:local="clr-namespace:XPrism"
x:Class="XPrism.AboutPage"
Title="关于 XPrism">
<VerticalStackLayout Margin="10">
<Label Text="关于 XPrism" FontSize="Title" HorizontalOptions="Center" />
<Label Text="清华大学电子工程系硬件设计大赛参赛作品。" />
<Label Text="XPrism 是基于 ESP32-PICO-D4 开发的智能眼镜。" />
<Label Text="本应用是基于 .NET MAUI 开发的 Android 端控制器。" />
<Label Text="Copyright © 2023 潘徐成 孙宇琦" />
<Label Text="All rights reserved." />
<Label Text=" " />
<Label Text="License" FontSize="Title" HorizontalOptions="Center" />
<Label Text="MIT License" FontAttributes="Bold" HorizontalOptions="Center" />
<Label Text="Copyright (c) 2023 潘徐成 孙宇琦" HorizontalOptions="Center" />
<Label Text="Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:" />
<Label Text="The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." />
<Label Text="THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." />
</VerticalStackLayout>
<ScrollView>
<VerticalStackLayout Margin="16">
<Label Text="关于 XPrism" FontSize="Title" HorizontalOptions="Center" />
<Label Text="清华大学电子工程系硬件设计大赛参赛作品。" />
<Label Text="XPrism 是基于 ESP32-PICO-D4 开发的智能眼镜。" />
<Label Text="本应用是基于 .NET MAUI 开发的 Android 端控制器。" />
<Label Text="Copyright © 2023 潘徐成 孙宇琦" />
<Label Text="All rights reserved." />
<Label Text=" " />
<Label Text="设备信息" FontSize="Title" HorizontalOptions="Center" />
<Label Text="获取失败" x:Name="deviceInfo" />
<Button Text="刷新设备信息" Clicked="OnRefreshClicked" />
<Label Text=" " />
<Label Text="License" FontSize="Title" HorizontalOptions="Center" />
<Label Text="MIT License" FontAttributes="Bold" HorizontalOptions="Center" />
<Label Text="Copyright (c) 2023 潘徐成 孙宇琦" HorizontalOptions="Center" />
<Label Text="Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:" />
<Label Text="The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software." />
<Label Text="THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." />
</VerticalStackLayout>
</ScrollView>
</ContentPage>
34 changes: 34 additions & 0 deletions android/XPrism/XPrism/AboutPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using Microsoft.Maui.Devices;
using System.Windows.Input;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Alerts;

namespace XPrism;

Expand All @@ -10,5 +13,36 @@ public AboutPage()
{
InitializeComponent();
BindingContext = this;
ReadDeviceInfo();
}

public async void OnRefreshClicked(object sender, EventArgs e)
{
ReadDeviceInfo();
var toast = Toast.Make("刷新成功", ToastDuration.Short, 14);
await toast.Show();
}

public void ReadDeviceInfo()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();

sb.AppendLine($"设备型号:{DeviceInfo.Current.Model}");
sb.AppendLine($"制造厂商:{DeviceInfo.Current.Manufacturer}");
sb.AppendLine($"设备名称:{DeviceInfo.Current.Name}");
sb.AppendLine($"设备平台:{DeviceInfo.Current.Platform}");
sb.AppendLine($"系统版本:{DeviceInfo.Current.VersionString}");
sb.AppendLine($"设备类型:{DeviceInfo.Current.Idiom}");

bool isVirtual = DeviceInfo.Current.DeviceType switch
{
DeviceType.Physical => false,
DeviceType.Virtual => true,
_ => false
};

sb.AppendLine($"虚拟设备:{isVirtual}");

deviceInfo.Text = sb.ToString();
}
}
34 changes: 8 additions & 26 deletions android/XPrism/XPrism/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,12 @@
x:Class="XPrism.MainPage"
Title="XPrism 智能眼镜控制器">

<!-- 使用Grid作为根布局 -->
<Grid x:Name="standard" RowSpacing="10" ColumnSpacing="10" Margin="10">

<!-- 设置六行四列的网格 -->
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<!-- 使用Button创建键盘按钮,并占据特定的Grid位置,设置Clicked事件处理程序 -->
<Button Text="发送信息" ImageSource="material_message_white.png" ContentLayout="Left, 0" FontSize="Large" Clicked="OnSendClicked" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4"/>
<Button Text="关于 XPrism" ImageSource="material_information_white.png" ContentLayout="Left, 0" FontSize="Large" Clicked="OnAboutClicked" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="4"/>

</Grid>

<ScrollView>
<VerticalStackLayout Margin="24">
<Button Text="发送信息" ImageSource="material_message_white.png" ContentLayout="Left, 0" Clicked="OnSendClicked" />
<Label></Label>
<Button Text="关于 XPrism" ImageSource="material_information_white.png" ContentLayout="Left, 0" Clicked="OnAboutClicked" />
</VerticalStackLayout>
</ScrollView>

</ContentPage>
3 changes: 2 additions & 1 deletion android/XPrism/XPrism/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public partial class MainPage : ContentPage
public MainPage()
{
InitializeComponent();
}
Application.Current.UserAppTheme = AppTheme.Light;
}

public async void OnSendClicked(object sender, System.EventArgs e)
{
Expand Down
7 changes: 5 additions & 2 deletions android/XPrism/XPrism/Platforms/Android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:roundIcon="@mipmap/appicon_round" android:supportsRtl="true"></application>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="io.panxuc.xprism">
<application android:allowBackup="true" android:icon="@mipmap/appicon" android:supportsRtl="true" android:label="XPrism"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_NOTIFICATIONS" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31" />
</manifest>
9 changes: 0 additions & 9 deletions android/XPrism/XPrism/Platforms/MacCatalyst/AppDelegate.cs

This file was deleted.

30 changes: 0 additions & 30 deletions android/XPrism/XPrism/Platforms/MacCatalyst/Info.plist

This file was deleted.

15 changes: 0 additions & 15 deletions android/XPrism/XPrism/Platforms/MacCatalyst/Program.cs

This file was deleted.

16 changes: 0 additions & 16 deletions android/XPrism/XPrism/Platforms/Tizen/Main.cs

This file was deleted.

15 changes: 0 additions & 15 deletions android/XPrism/XPrism/Platforms/Tizen/tizen-manifest.xml

This file was deleted.

8 changes: 0 additions & 8 deletions android/XPrism/XPrism/Platforms/Windows/App.xaml

This file was deleted.

24 changes: 0 additions & 24 deletions android/XPrism/XPrism/Platforms/Windows/App.xaml.cs

This file was deleted.

46 changes: 0 additions & 46 deletions android/XPrism/XPrism/Platforms/Windows/Package.appxmanifest

This file was deleted.

15 changes: 0 additions & 15 deletions android/XPrism/XPrism/Platforms/Windows/app.manifest

This file was deleted.

9 changes: 0 additions & 9 deletions android/XPrism/XPrism/Platforms/iOS/AppDelegate.cs

This file was deleted.

32 changes: 0 additions & 32 deletions android/XPrism/XPrism/Platforms/iOS/Info.plist

This file was deleted.

15 changes: 0 additions & 15 deletions android/XPrism/XPrism/Platforms/iOS/Program.cs

This file was deleted.

Loading

0 comments on commit 2bff975

Please sign in to comment.