Skip to content

Commit

Permalink
更新系统重新设计,多处细节修改
Browse files Browse the repository at this point in the history
  • Loading branch information
zsh2401 committed May 27, 2019
1 parent 12e51ea commit db8e8c6
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 143 deletions.
19 changes: 0 additions & 19 deletions AutumnBox.Bridge.Shared/AutumnBox.Bridge.Shared.projitems

This file was deleted.

13 changes: 0 additions & 13 deletions AutumnBox.Bridge.Shared/AutumnBox.Bridge.Shared.shproj

This file was deleted.

14 changes: 0 additions & 14 deletions AutumnBox.Bridge.Shared/IAtmbLibManager.cs

This file was deleted.

19 changes: 0 additions & 19 deletions AutumnBox.Bridge.Shared/IAtmbSlice.cs

This file was deleted.

7 changes: 7 additions & 0 deletions AutumnBox.GUI/AutumnBox.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@
<Compile Include="View\Windows\StartWindow.xaml.cs">
<DependentUpon>StartWindow.xaml</DependentUpon>
</Compile>
<Compile Include="View\Windows\UpdateLogsWindow.xaml.cs">
<DependentUpon>UpdateLogsWindow.xaml</DependentUpon>
</Compile>
<Compile Include="View\Windows\UpdateNoticeWindow.xaml.cs">
<DependentUpon>UpdateNoticeWindow.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -770,6 +773,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Windows\UpdateLogsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="View\Windows\UpdateNoticeWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand Down
5 changes: 1 addition & 4 deletions AutumnBox.GUI/Util/AppLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,7 @@ private void RunDeviceListener()
}
private void FetchRemoteData()
{
Updater.RefreshAsync(() =>
{
Updater.ShowUI(false);
});
Updater.Do();
Statistics.Do();
ToastMotd.Do();
Banner.Check();
Expand Down
45 changes: 7 additions & 38 deletions AutumnBox.GUI/Util/Net/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
** desc: ...
*************************************************/
using AutumnBox.GUI.Properties;
using AutumnBox.GUI.Util.Bus;
using AutumnBox.GUI.Util.Debugging;
using AutumnBox.GUI.Util.Net;
using AutumnBox.GUI.Util.Net.Getters;
Expand All @@ -25,49 +26,17 @@ static Updater()
Settings.Default.Save();
}
}
public static Task RefreshAsync(Action callback)
public static void Do()
{
return Task.Run(() =>
var getter = new RemoteVersionInfoGetter();
MainWindowBus.Info("正在检测更新");
getter.Advance().ContinueWith(result =>
{
RemoteVersionInfoGetter getter = new RemoteVersionInfoGetter();
try
if (Result.Version > Self.Version)
{
Result = getter.GetSync();
callback?.Invoke();
}
catch (Exception e)
{
SLogger.Warn(nameof(Updater), "cannot refresh update informations", e);
MainWindowBus.Info("检测到更新");
}
});
}
public static void ShowUI(bool showIsLatestVersion = true, bool showSkippedVersion = false)
{
if (Result == null) return;

if (Result.Version > Self.Version &&
(Result.Version > Version.Parse(Settings.Default.SkipVersion) ||
showSkippedVersion))
{
App.Current.Dispatcher.Invoke(() =>
{
new UpdateNoticeWindow() {
Owner = App.Current.MainWindow,
}.Show();
});
}
else if (showIsLatestVersion)
{
App.Current.Dispatcher.Invoke(() =>
{
new MessageWindow()
{
MsgTitle = "PanelSettingsTitleDontNeedUpdate",
Message = "PanelSettingsMsgDontNeedUpdate",
Owner = App.Current.MainWindow
}.Show();
});
}
}
}
}
8 changes: 6 additions & 2 deletions AutumnBox.GUI/View/Panel/PanelLoading.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:AutumnBox.GUI.View.Panel"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
mc:Ignorable="d"
FontFamily="{DynamicResource AutumnBox.Font}"
Height="720" Width="1280" Background="WhiteSmoke">
Height="720" Width="1280" Background="White">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="120">Autumn Box</TextBlock>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="120">Autumn Box</TextBlock>
<controls:LoadingLine/>
</StackPanel>
</Grid>
</UserControl>
42 changes: 20 additions & 22 deletions AutumnBox.GUI/View/Windows/LibsWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<Window x:Class="AutumnBox.GUI.View.Windows.LibsWindow"
<controls:BlurWindow
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
x:Class="AutumnBox.GUI.View.Windows.LibsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand All @@ -7,31 +9,27 @@
xmlns:viewmodel="clr-namespace:AutumnBox.GUI.ViewModel"
mc:Ignorable="d"
x:Name="thisCtrl"
Style="{StaticResource WindowBlur}"
ShowTitle="True"
Title="{DynamicResource LibsWindowTitle}" ResizeMode="NoResize" Height="300" Width="400">
<Window.DataContext>
<viewmodel:VMLibsView x:Name="mContext"/>
</Window.DataContext>
<Grid>
<ListView ItemsSource="{Binding Libs}" SelectedItem="{Binding SelectedItem}">
<ListView.ItemTemplate>
<ItemContainerTemplate>
<Grid>
<Grid.InputBindings>
<MouseBinding MouseAction="LeftDoubleClick" Command="{Binding DataContext.ShowInformation,ElementName=thisCtrl}"/>
</Grid.InputBindings>
<Grid.ToolTip>
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{DynamicResource LibsWindowLoadedWrapper}"/>
<TextBlock Text="{Binding Count}"/>
</StackPanel>
</Grid>
</Grid.ToolTip>
<ItemsControl ItemsSource="{Binding Libs}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Width="300" Command="{Binding DataContext.ShowInformation,ElementName=thisCtrl}" Margin="20">
<Button.ToolTip>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{DynamicResource LibsWindowLoadedWrapper}"/>
<TextBlock Text="{Binding Count}"/>
</StackPanel>
</Button.ToolTip>
<TextBlock Text="{Binding Lib.Name}"/>
</Grid>

</ItemContainerTemplate>
</ListView.ItemTemplate>
</ListView>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Window>
</controls:BlurWindow>
2 changes: 1 addition & 1 deletion AutumnBox.GUI/View/Windows/LibsWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace AutumnBox.GUI.View.Windows
/// <summary>
/// LibsWindow.xaml 的交互逻辑
/// </summary>
public partial class LibsWindow : Window
public partial class LibsWindow
{
public LibsWindow()
{
Expand Down
43 changes: 43 additions & 0 deletions AutumnBox.GUI/View/Windows/UpdateLogsWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<controls:BlurWindow
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
x:Class="AutumnBox.GUI.View.Windows.UpdateLogsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:AutumnBox.GUI.View.Windows"
xmlns:viewmodel="clr-namespace:AutumnBox.GUI.ViewModel"
mc:Ignorable="d"
ResizeMode="NoResize"
Style="{StaticResource WindowBlur}"
ShowTitle="True"
FontFamily="{DynamicResource AutumnBox.Font}"
WindowStartupLocation="CenterOwner"
Height="450" Width="600">
<Window.DataContext>
<viewmodel:VMUpdateLogs/>
</Window.DataContext>
<Grid>
<DockPanel>

<TextBlock DockPanel.Dock="Top" Margin="5" FontSize="40">Farewell under the stars</TextBlock>

<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<ItemsControl ItemsSource="{Binding Versions}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<DockPanel Margin="10">
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
<TextBlock FontSize="30" Text="{Binding Version}"/>
<TextBlock VerticalAlignment="Center" Foreground="Gray" Margin="10,0,0,0" Text="{Binding Time}"/>
</StackPanel>
<TextBlock Margin="5" Text="{Binding Content}" TextWrapping="Wrap"/>
</DockPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</DockPanel>
</Grid>

</controls:BlurWindow>
28 changes: 28 additions & 0 deletions AutumnBox.GUI/View/Windows/UpdateLogsWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using HandyControl.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AutumnBox.GUI.View.Windows
{
/// <summary>
/// UpdateLogsWindow.xaml 的交互逻辑
/// </summary>
public partial class UpdateLogsWindow : BlurWindow
{
public UpdateLogsWindow()
{
InitializeComponent();
}
}
}
5 changes: 3 additions & 2 deletions AutumnBox.GUI/ViewModel/VMMainMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using AutumnBox.Basic.ManagedAdb;
using AutumnBox.GUI.MVVM;
using AutumnBox.GUI.Util.Bus;
using AutumnBox.GUI.Util.Net;
using AutumnBox.GUI.View.Slices;
using AutumnBox.GUI.View.Windows;
using System;
Expand All @@ -22,9 +23,9 @@ public VMMainMenu()
{
Exit = new MVVMCommand(p => { App.Current.Shutdown(0); });
OpenLoggingWindow = new MVVMCommand(p => { new LogWindow().Show(); });
OpenUpdateLogs = new MVVMCommand(p => MainWindowBus.ShowSlice(new UpdateLog(), "Farewell under the stars"));
OpenUpdateLogs = new MVVMCommand(p => new UpdateLogsWindow() { Owner = App.Current.MainWindow }.ShowDialog());
OpenSettings = new MVVMCommand(p => new SettingsWindow().ShowDialog());
UpdateCheck = new MVVMCommand(P => MainWindowBus.Info("wtf"));
UpdateCheck = new MVVMCommand(P => Updater.Do());
OpenOSInformation = new MVVMCommand(p => new OpenSourceWindow() { Owner = App.Current.MainWindow }.ShowDialog());
OpenShell = new MVVMCommand(p =>
{
Expand Down
5 changes: 1 addition & 4 deletions AutumnBox.GUI/ViewModel/VMSettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,7 @@ public VMSettingsDialog()
});
UpdateCheck = new FlexiableCommand(() =>
{
Updater.RefreshAsync(() =>
{
Updater.ShowUI(true, true);
});
Updater.Do();
});
OpenLogFloder = new MVVMCommand((p) =>
{
Expand Down
6 changes: 1 addition & 5 deletions AutumnBox.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AutumnBox.Logging.Shared",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutumnBox.Logging", "AutumnBox.Logging\AutumnBox.Logging.csproj", "{F90CB434-6ED4-4244-9D78-C8016F0856C1}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "AutumnBox.Bridge.Shared", "AutumnBox.Bridge.Shared\AutumnBox.Bridge.Shared.shproj", "{00C8E06D-EA63-441F-8BDD-5B45D04A7B96}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
AutumnBox.Bridge.Shared\AutumnBox.Bridge.Shared.projitems*{00c8e06d-ea63-441f-8bdd-5b45d04a7b96}*SharedItemsImports = 13
AutumnBox.OpenFramework.Shared\AutumnBox.OpenFramework.Shared.projitems*{49e6d09e-b234-4aa4-97b0-e82fb60c36d2}*SharedItemsImports = 13
AutumnBox.Basic.Shared\AutumnBox.Basic.Shared.projitems*{5276bfb4-b089-4e34-9c42-42ea019ef320}*SharedItemsImports = 4
AutumnBox.OpenFramework.Shared\AutumnBox.OpenFramework.Shared.projitems*{60988b1a-74b7-470a-aeba-6d7fe474614d}*SharedItemsImports = 4
Expand Down Expand Up @@ -265,10 +262,9 @@ Global
{60988B1A-74B7-470A-AEBA-6D7FE474614D} = {FA99B881-45A3-4D66-8ECE-9D65DFC57C48}
{B29DEA5D-D4C3-4C8B-810E-52466875835D} = {2377CBDA-1330-43FC-BBD0-9D6B26FD9DA2}
{F90CB434-6ED4-4244-9D78-C8016F0856C1} = {FA99B881-45A3-4D66-8ECE-9D65DFC57C48}
{00C8E06D-EA63-441F-8BDD-5B45D04A7B96} = {2377CBDA-1330-43FC-BBD0-9D6B26FD9DA2}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E8E55705-AE5C-4952-B4C7-9D7F81C38731}
EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.Common.6.0.1304.0\lib\NET45;packages\EnterpriseLibrary.PolicyInjection.6.0.1304.0\lib\NET45
SolutionGuid = {E8E55705-AE5C-4952-B4C7-9D7F81C38731}
EndGlobalSection
EndGlobal

0 comments on commit db8e8c6

Please sign in to comment.