From fdc426417f38bc2a4d9ac7f01c4a94a6b79bb018 Mon Sep 17 00:00:00 2001 From: noberumotto Date: Sat, 11 Jun 2022 00:57:32 +0800 Subject: [PATCH] =?UTF-8?q?UI=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/App.xaml.cs | 4 +- UI/Base/Color/Colors.cs | 2 +- UI/Controls/Base/Img.cs | 94 +++++++++++++++++++--- UI/Controls/Base/View.cs | 28 +++++++ UI/Controls/Tabbar/Tabbar.cs | 93 ++++++++++++++------- UI/Models/CategoryAppListPageModel.cs | 2 +- UI/Themes/Base/EmptyData.xaml | 3 +- UI/Themes/Base/Img.xaml | 5 +- UI/Themes/DatePickerBar/DatePickerBar.xaml | 20 ++++- UI/Themes/Navigation/NavigationItem.xaml | 19 ++++- UI/Themes/Select/ImageSelect.xaml | 2 +- UI/Themes/Select/Select.xaml | 2 +- UI/Themes/Tabbar/Tabbar.xaml | 17 +++- UI/UI.csproj | 81 +++++++++++++++++++ UI/ViewModels/CategoryAppListPageVM.cs | 58 ++++++++++--- UI/ViewModels/CategoryPageVM.cs | 21 ++++- UI/ViewModels/ChartPageVM.cs | 48 ++++++----- UI/ViewModels/DataPageVM.cs | 2 +- UI/ViewModels/DetailPageVM.cs | 8 +- UI/ViewModels/IndexPageVM.cs | 58 ++++++++----- UI/Views/CategoryAppListPage.xaml | 26 ++++-- UI/Views/CategoryPage.xaml | 22 +++-- UI/Views/ChartPage.xaml | 4 +- UI/Views/DataPage.xaml | 4 +- UI/Views/DetailPage.xaml | 32 ++++---- UI/Views/IndexPage.xaml | 4 +- UI/Views/SettingPage.xaml | 6 +- 27 files changed, 508 insertions(+), 157 deletions(-) diff --git a/UI/App.xaml.cs b/UI/App.xaml.cs index dc92359..dafb8be 100644 --- a/UI/App.xaml.cs +++ b/UI/App.xaml.cs @@ -66,7 +66,7 @@ namespace UI base.OnExit(e); - appData.SaveAppChanges(); + //appData.SaveAppChanges(); Logger.Save(true); @@ -74,7 +74,7 @@ namespace UI } private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { - appData.SaveAppChanges(); + //appData.SaveAppChanges(); // 记录崩溃错误 Logger.Error("[程序崩溃异常] " + e.Exception.Message); diff --git a/UI/Base/Color/Colors.cs b/UI/Base/Color/Colors.cs index 9086dfb..49632f2 100644 --- a/UI/Base/Color/Colors.cs +++ b/UI/Base/Color/Colors.cs @@ -35,7 +35,7 @@ namespace UI.Base.Color }; - public static string[] MainColors = { "#15C38E", "#A761FF", "#FFE6E6", "#00FFAB", "#B8F1B0", "#DAEAF1", "#1464DF", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#C70B80", "#590696", "#97DBAE" }; + public static string[] MainColors = { "#00FFAB", "#A761FF", "#ff587f", "#ff1801", "#f7fd05", "#DAEAF1", "#2B20D9", "#FF5C01", "#9EB23C", "#FF9999", "#998CEB", "#77E4D4", "#FD5E5E", "#B4FF9F", "#07FF01", "#FFE162", "#C70B80", "#590696", "#97DBAE" }; public static IColor Get(ColorTypes color) { diff --git a/UI/Controls/Base/Img.cs b/UI/Controls/Base/Img.cs index 3df6b04..260d693 100644 --- a/UI/Controls/Base/Img.cs +++ b/UI/Controls/Base/Img.cs @@ -1,6 +1,8 @@ using Core.Librarys.Image; using System; using System.Collections.Generic; +using System.Diagnostics; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -18,6 +20,17 @@ namespace UI.Controls.Base { public class Img : Control { + public CornerRadius Radius + { + get { return (CornerRadius)GetValue(RadiusProperty); } + set { SetValue(RadiusProperty, value); } + } + public static readonly DependencyProperty RadiusProperty = + DependencyProperty.Register("Radius", + typeof(CornerRadius), + typeof(Img)); + + /// /// 图片链接 /// @@ -36,30 +49,93 @@ namespace UI.Controls.Base var control = (d as Img); if (e.Property == URLProperty && e.OldValue != e.NewValue) { - control.Render(); + control.Handle(); } } - - private ImageBrush _image; + //private bool isRendered = false; + //private Image _image; + //Page page; + //private ImageBrush _image; public Img() { DefaultStyleKey = typeof(Img); + + //Loaded += Img_Loaded; } public override void OnApplyTemplate() { base.OnApplyTemplate(); - _image = GetTemplateChild("image") as ImageBrush; - Render(); + //_image = GetTemplateChild("image") as ImageBrush; + //_image = GetTemplateChild("image") as Image; + + //new Border().CornerRadius } - private void Render() + private void Handle() { - if (_image == null) + if (!File.Exists(URL)) { - return; + URL = "pack://application:,,,/Tai;component/Resources/Icons/defaultIcon.png"; } - _image.ImageSource = Imager.Load(URL); } + + + + //private void Page_LayoutUpdated(object sender, EventArgs e) + //{ + // if (!isRendered) + // { + // Rect bounds = this.TransformToAncestor(page).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight)); + // Rect rect = new Rect(0.0, 0.0, page.ActualWidth, page.ActualHeight); + + // if (rect.Contains(bounds)) + // { + // Debug.WriteLine("渲染!"); + + // isRendered = true; + + // Render(); + // } + // } + //} + + //private void Img_Loaded(object sender, RoutedEventArgs e) + //{ + // var parent = VisualTreeHelper.GetParent(this); + // while (!(parent is Page)) + // { + // parent = VisualTreeHelper.GetParent(parent); + // } + // page = (parent as Page); + + // page.LayoutUpdated += Page_LayoutUpdated; + //} + + //private async void Render() + //{ + // if (_image == null) + // { + // return; + // } + + // //_image.Source = Imager.Load(URL); + + + + // //_image.ImageSource = Imager.Load(URL); + // //BitmapImage bitimg = null; + + // string img = URL != null ? URL.ToString() : ""; + + // var res = Task.Run(() => + // { + + // Debug.WriteLine("load:" + img); + // return Imager.Load(img); + // }); + + // _image.Source = await res; + //} } } diff --git a/UI/Controls/Base/View.cs b/UI/Controls/Base/View.cs index dd79c8e..b3727f3 100644 --- a/UI/Controls/Base/View.cs +++ b/UI/Controls/Base/View.cs @@ -38,8 +38,14 @@ namespace UI.Controls.Base public View() { DefaultStyleKey = typeof(View); + + Loaded += View_Loaded; } + private void View_Loaded(object sender, RoutedEventArgs e) + { + Handle(); + } private void Handle() { @@ -65,6 +71,28 @@ namespace UI.Controls.Base string val = Condition.Substring(Condition.IndexOf("=") + 1); isShow = val == Value.ToString(); } + else if (Condition.IndexOf("not null") != -1) + { + + isShow = Value != null; + } + else if (Condition.IndexOf("null") != -1) + { + + isShow = Value == null; + } + else if (Condition.IndexOf("empty") != -1) + { + if (Value == null) + { + isShow = true; + } + else + { + var data = Value as IEnumerable; + isShow = data.Count() == 0; + } + } else { isShow = Condition == Value.ToString(); diff --git a/UI/Controls/Tabbar/Tabbar.cs b/UI/Controls/Tabbar/Tabbar.cs index aeda8a2..ccdb46a 100644 --- a/UI/Controls/Tabbar/Tabbar.cs +++ b/UI/Controls/Tabbar/Tabbar.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; +using System.Diagnostics; using System.Linq; using System.Text; using System.Windows; @@ -61,7 +62,7 @@ namespace UI.Controls.Tabbar private StackPanel ItemsPanel; private List ItemsDictionary; - + private Grid ItemsContainer; // 选中标记块 private Border ActiveBlock; // 动画 @@ -105,18 +106,19 @@ namespace UI.Controls.Tabbar public override void OnApplyTemplate() { base.OnApplyTemplate(); - ItemsPanel = GetTemplateChild("ItemsPanel") as StackPanel; + //ItemsPanel = GetTemplateChild("ItemsPanel") as StackPanel; ActiveBlock = GetTemplateChild("ActiveBlock") as Border; - + ItemsContainer = GetTemplateChild("ItemsContainer") as Grid; Render(); } - private void AddItem(string item) + private void AddItem(string item, int col) { - if (ItemsPanel != null) + if (ItemsContainer != null) { var control = new TextBlock(); + control.TextAlignment= TextAlignment.Center; control.Text = item; control.Margin = new Thickness(0, 0, 10, 0); control.FontSize = 18; @@ -135,11 +137,13 @@ namespace UI.Controls.Tabbar { control.Loaded += (e, c) => { + ActiveBlock.Width = control.ActualWidth; ScrollToActive(); Reset(); }; } - ItemsPanel.Children.Add(control); + Grid.SetColumn(control, col); + ItemsContainer.Children.Add(control); ItemsDictionary.Add(control); } } @@ -150,11 +154,25 @@ namespace UI.Controls.Tabbar { if (Data != null) { - ItemsPanel.Children.Clear(); - foreach (var item in Data) + ItemsContainer.Children.Clear(); + ItemsContainer.ColumnDefinitions.Clear(); + for (int i = 0; i < Data.Count; i++) { - AddItem(item); + var item = Data[i]; + + ItemsContainer.ColumnDefinitions.Add(new ColumnDefinition() + { + Width = new GridLength(1, GridUnitType.Star) + }); + + AddItem(item, i); + } + //foreach (var item in Data) + //{ + + // AddItem(item); + //} } } @@ -188,10 +206,23 @@ namespace UI.Controls.Tabbar storyboard.Children.Clear(); + + var activeBlockTG = ActiveBlock.RenderTransform as TransformGroup; + var blockOldX = (activeBlockTG.Children[0] as TranslateTransform).X; DoubleAnimation scrollAnimation = new DoubleAnimation(); //scrollAnimation.From = activeBlockTTF.Y; - double scrollX = relativePoint.X - 10; + //double scrollX = relativePoint.X + item.ActualWidth / 2 - ActiveBlock.ActualWidth / 2; + double scrollX = relativePoint.X; + scrollX = scrollX < 0 ? 0 : scrollX; + + //scrollX= scrollX + item.ActualWidth / 2 - ActiveBlock.ActualWidth / 2; + if (scrollX != 0) + { + //scrollX = scrollX > blockOldX ? scrollX - 10 : scrollX; + } + + Debug.WriteLine(blockOldX + " -> " + scrollX); scrollAnimation.To = scrollX; scrollAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseIn }; @@ -264,36 +295,40 @@ namespace UI.Controls.Tabbar { Storyboard storyboard = new Storyboard(); - foreach (var item in ItemsPanel.Children) + foreach (var item in ItemsContainer.Children) { - if (item != ItemsPanel.Children[SelectedIndex]) + if (item != ItemsContainer.Children[SelectedIndex]) { - DoubleAnimation fontSizeAnimation = new DoubleAnimation(); - //scrollAnimation.From = activeBlockTTF.Y; - fontSizeAnimation.To = 14; + var text = item as TextBlock; + text.FontSize = 14; + text.Foreground = UI.Base.Color.Colors.GetFromString("#ccc"); + + //DoubleAnimation fontSizeAnimation = new DoubleAnimation(); + ////scrollAnimation.From = activeBlockTTF.Y; + //fontSizeAnimation.To = 14; - fontSizeAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseIn }; - Storyboard.SetTarget(fontSizeAnimation, (UIElement)item); - Storyboard.SetTargetProperty(fontSizeAnimation, new PropertyPath("FontSize")); + //fontSizeAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseIn }; + //Storyboard.SetTarget(fontSizeAnimation, (UIElement)item); + //Storyboard.SetTargetProperty(fontSizeAnimation, new PropertyPath("FontSize")); - fontSizeAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.1)); + //fontSizeAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.1)); - ColorAnimation oldFontColorAnimation = new ColorAnimation(); - //scrollAnimation.From = activeBlockTTF.Y; - oldFontColorAnimation.To = (Color)ColorConverter.ConvertFromString("#CCCCCC"); + //ColorAnimation oldFontColorAnimation = new ColorAnimation(); + ////scrollAnimation.From = activeBlockTTF.Y; + //oldFontColorAnimation.To = (Color)ColorConverter.ConvertFromString("#CCCCCC"); - oldFontColorAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseIn }; - Storyboard.SetTarget(oldFontColorAnimation, (UIElement)item); - Storyboard.SetTargetProperty(oldFontColorAnimation, new PropertyPath("(TextBlock.Foreground).(SolidColorBrush.Color)")); + //oldFontColorAnimation.EasingFunction = new SineEase() { EasingMode = EasingMode.EaseIn }; + //Storyboard.SetTarget(oldFontColorAnimation, (UIElement)item); + //Storyboard.SetTargetProperty(oldFontColorAnimation, new PropertyPath("(TextBlock.Foreground).(SolidColorBrush.Color)")); - oldFontColorAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3)); + //oldFontColorAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3)); - storyboard.Children.Add(fontSizeAnimation); - storyboard.Children.Add(oldFontColorAnimation); + //storyboard.Children.Add(fontSizeAnimation); + //storyboard.Children.Add(oldFontColorAnimation); } } - storyboard.Begin(); + //storyboard.Begin(); } } } diff --git a/UI/Models/CategoryAppListPageModel.cs b/UI/Models/CategoryAppListPageModel.cs index c9ae6c2..bc132d6 100644 --- a/UI/Models/CategoryAppListPageModel.cs +++ b/UI/Models/CategoryAppListPageModel.cs @@ -23,7 +23,7 @@ namespace UI.Models //private List ChooseAppList_; //public List ChooseAppList { get { return ChooseAppList_; } set { ChooseAppList_ = value; OnPropertyChanged(); } } - private Visibility ChooseVisibility_ = Visibility.Collapsed; + private Visibility ChooseVisibility_ = Visibility.Hidden; public Visibility ChooseVisibility { get { return ChooseVisibility_; } set { ChooseVisibility_ = value; OnPropertyChanged(); } } private AppModel SelectedItem_; diff --git a/UI/Themes/Base/EmptyData.xaml b/UI/Themes/Base/EmptyData.xaml index e9a31bf..0b7949e 100644 --- a/UI/Themes/Base/EmptyData.xaml +++ b/UI/Themes/Base/EmptyData.xaml @@ -6,7 +6,8 @@ Value="true" /> - + diff --git a/UI/Themes/Base/Img.xaml b/UI/Themes/Base/Img.xaml index 0069262..004d8c7 100644 --- a/UI/Themes/Base/Img.xaml +++ b/UI/Themes/Base/Img.xaml @@ -8,6 +8,7 @@ + @@ -17,9 +18,9 @@ - + - + diff --git a/UI/Themes/DatePickerBar/DatePickerBar.xaml b/UI/Themes/DatePickerBar/DatePickerBar.xaml index 59cc55d..8dda885 100644 --- a/UI/Themes/DatePickerBar/DatePickerBar.xaml +++ b/UI/Themes/DatePickerBar/DatePickerBar.xaml @@ -14,17 +14,31 @@ + + + + + - + diff --git a/UI/Themes/Navigation/NavigationItem.xaml b/UI/Themes/Navigation/NavigationItem.xaml index 0c2f795..2e9637d 100644 --- a/UI/Themes/Navigation/NavigationItem.xaml +++ b/UI/Themes/Navigation/NavigationItem.xaml @@ -50,10 +50,13 @@ - + - + + + + @@ -95,7 +98,11 @@ + Storyboard.TargetProperty="(base:Icon.RenderTransform).Children[0].(TranslateTransform.Y)" Storyboard.TargetName="Icon" To="0" /> + + @@ -105,7 +112,11 @@ + Storyboard.TargetProperty="(base:Icon.RenderTransform).Children[0].(TranslateTransform.Y)" Storyboard.TargetName="Icon" To="-5" /> + + diff --git a/UI/Themes/Select/ImageSelect.xaml b/UI/Themes/Select/ImageSelect.xaml index 0580201..d50ef34 100644 --- a/UI/Themes/Select/ImageSelect.xaml +++ b/UI/Themes/Select/ImageSelect.xaml @@ -30,7 +30,7 @@ - + diff --git a/UI/Themes/Select/Select.xaml b/UI/Themes/Select/Select.xaml index 36a33b4..7492669 100644 --- a/UI/Themes/Select/Select.xaml +++ b/UI/Themes/Select/Select.xaml @@ -25,7 +25,7 @@ - + diff --git a/UI/Themes/Tabbar/Tabbar.xaml b/UI/Themes/Tabbar/Tabbar.xaml index f847de5..d141601 100644 --- a/UI/Themes/Tabbar/Tabbar.xaml +++ b/UI/Themes/Tabbar/Tabbar.xaml @@ -13,16 +13,27 @@ - + + - - + + + + + diff --git a/UI/UI.csproj b/UI/UI.csproj index 362d232..64c0d33 100644 --- a/UI/UI.csproj +++ b/UI/UI.csproj @@ -119,18 +119,27 @@ + + + + + + + + + @@ -140,14 +149,26 @@ + + + + + + + + + + + + @@ -155,11 +176,23 @@ + + + + + CategoryAppListPage.xaml + + + CategoryPage.xaml + + + ChartPage.xaml + DataPage.xaml @@ -193,6 +226,22 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -205,6 +254,10 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -249,6 +302,22 @@ MSBuild:Compile Designer + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + MSBuild:Compile Designer @@ -289,6 +358,18 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + + + Designer + MSBuild:Compile + MSBuild:Compile Designer diff --git a/UI/ViewModels/CategoryAppListPageVM.cs b/UI/ViewModels/CategoryAppListPageVM.cs index 747820f..feb9817 100644 --- a/UI/ViewModels/CategoryAppListPageVM.cs +++ b/UI/ViewModels/CategoryAppListPageVM.cs @@ -29,6 +29,7 @@ namespace UI.ViewModels ShowChooseCommand = new Command(new Action(OnShowChoose)); ChoosedCommand = new Command(new Action(OnChoosed)); GotoDetailCommand = new Command(new Action(OnGotoDetail)); + LoadData(); } @@ -82,28 +83,59 @@ namespace UI.ViewModels private void OnShowChoose(object obj) { ChooseVisibility = System.Windows.Visibility.Visible; + + + LoadApps(); + } private void LoadData() { - Category = mainVM.Data as UI.Models.Category.CategoryModel; - Data = appData.GetAppsByCategoryID(Category.Data.ID); + Task.Run(() => + { + Category = mainVM.Data as UI.Models.Category.CategoryModel; + Data = appData.GetAppsByCategoryID(Category.Data.ID); + + //var appList = new List(); + //foreach (var item in appData.GetAllApps()) + //{ + // var app = new ChooseAppModel(); + // app.App = item; + // app.IsChoosed = item.CategoryID == Category.Data.ID; + // app.Value.Name = item.Name; + // app.Value.Img = item.IconFile; - var appList = new List(); - foreach (var item in appData.GetAllApps()) + // appList.Add(app); + //} + + //AppList = appList; + }); + } + + private void LoadApps() + { + Task.Run(() => { - var app = new ChooseAppModel(); - app.App = item; - app.IsChoosed = item.CategoryID == Category.Data.ID; - app.Value.Name = item.Name; - app.Value.Img = item.IconFile; + //Category = mainVM.Data as UI.Models.Category.CategoryModel; + if (Category == null) + { + return; + } + var appList = new List(); + foreach (var item in appData.GetAllApps()) + { + var app = new ChooseAppModel(); + app.App = item; + app.IsChoosed = item.CategoryID == Category.Data.ID; + app.Value.Name = item.Name; + app.Value.Img = item.IconFile; - appList.Add(app); - } + appList.Add(app); + } - AppList = appList; - //ChooseAppList = Data; + AppList = appList; + }); } } } diff --git a/UI/ViewModels/CategoryPageVM.cs b/UI/ViewModels/CategoryPageVM.cs index 1fbcf54..a9fc414 100644 --- a/UI/ViewModels/CategoryPageVM.cs +++ b/UI/ViewModels/CategoryPageVM.cs @@ -73,6 +73,10 @@ namespace UI.ViewModels // 从界面移除 Data.Remove(SelectedItem); + if (Data.Count == 0) + { + Data = new System.Collections.ObjectModel.ObservableCollection(); + } mainVM.Toast("分类已删除", Controls.Window.ToastType.Success); } @@ -117,13 +121,22 @@ namespace UI.ViewModels IconFile = EditIconFile, }); - - Data.Add(new CategoryModel() + var item = new CategoryModel() { Data = res, Count = 0 - }); - + }; + if (Data.Count == 0) + { + //Data=new System.Collections.ObjectModel.ObservableCollection() + var list = new System.Collections.ObjectModel.ObservableCollection(); + list.Add(item); + Data = list; + } + else + { + Data.Add(item); + } } else diff --git a/UI/ViewModels/ChartPageVM.cs b/UI/ViewModels/ChartPageVM.cs index 75ff138..3d26a79 100644 --- a/UI/ViewModels/ChartPageVM.cs +++ b/UI/ViewModels/ChartPageVM.cs @@ -174,15 +174,17 @@ namespace UI.ViewModels foreach (var item in list) { var category = categorys.GetCategory(item.CategoryID); - - chartData.Add(new ChartsDataModel() + if (category != null) { + chartData.Add(new ChartsDataModel() + { - Name = category.Name, - Icon = category.IconFile, - Values = item.Values, - ColumnNames = weekNames - }); + Name = category.Name, + Icon = category.IconFile, + Values = item.Values, + ColumnNames = weekNames + }); + } } Data = chartData; @@ -209,14 +211,16 @@ namespace UI.ViewModels foreach (var item in list) { var category = categorys.GetCategory(item.CategoryID); - - chartData.Add(new ChartsDataModel() + if (category != null) { + chartData.Add(new ChartsDataModel() + { - Name = category.Name, - Icon = category.IconFile, - Values = item.Values, - }); + Name = category.Name, + Icon = category.IconFile, + Values = item.Values, + }); + } } Data = chartData; @@ -246,15 +250,17 @@ namespace UI.ViewModels foreach (var item in list) { var category = categorys.GetCategory(item.CategoryID); - - chartData.Add(new ChartsDataModel() + if (category != null) { + chartData.Add(new ChartsDataModel() + { - Name = category.Name, - Icon = category.IconFile, - Values = item.Values, - ColumnNames = names - }); + Name = category.Name, + Icon = category.IconFile, + Values = item.Values, + ColumnNames = names + }); + } } Data = chartData; @@ -307,7 +313,7 @@ namespace UI.ViewModels var bindModel = new ChartsDataModel(); bindModel.Data = item; - bindModel.Name = item.AppModel?.Name; + bindModel.Name = item.AppModel?.Description; bindModel.Value = item.Time; bindModel.Tag = Timer.Fromat(item.Time); bindModel.PopupText = item.AppModel?.File; diff --git a/UI/ViewModels/DataPageVM.cs b/UI/ViewModels/DataPageVM.cs index eb3b524..36a5223 100644 --- a/UI/ViewModels/DataPageVM.cs +++ b/UI/ViewModels/DataPageVM.cs @@ -181,7 +181,7 @@ namespace UI.ViewModels var bindModel = new ChartsDataModel(); bindModel.Data = item; - bindModel.Name = item.AppModel?.Name; + bindModel.Name = item.AppModel?.Description; bindModel.Value = item.Time; bindModel.Tag = Timer.Fromat(item.Time); bindModel.PopupText = item.AppModel?.File; diff --git a/UI/ViewModels/DetailPageVM.cs b/UI/ViewModels/DetailPageVM.cs index 4211e81..6820b73 100644 --- a/UI/ViewModels/DetailPageVM.cs +++ b/UI/ViewModels/DetailPageVM.cs @@ -79,7 +79,7 @@ namespace UI.ViewModels } else { - main.Toast("进程文件似乎不存在", Controls.Window.ToastType.Error, Controls.Base.IconTypes.Blocked); + main.Toast("应用文件似乎不存在", Controls.Window.ToastType.Error, Controls.Base.IconTypes.Blocked); } break; case "open exe": @@ -89,7 +89,7 @@ namespace UI.ViewModels } else { - main.Toast("进程文件似乎不存在", Controls.Window.ToastType.Error, Controls.Base.IconTypes.Blocked); + main.Toast("应用似乎不存在", Controls.Window.ToastType.Error, Controls.Base.IconTypes.Blocked); } break; } @@ -241,7 +241,7 @@ namespace UI.ViewModels if (monthData.Count > 0) { var longDayData = monthData.OrderByDescending(m => m.Time).FirstOrDefault(); - LongDay = longDayData.Date.ToString("最长一天是在 dd 日,使用了 " + Timer.Fromat(longDayData.Time)); + LongDay = longDayData.Date.ToString("最长一天是在 dd 号,使用了 " + Timer.Fromat(longDayData.Time)); } @@ -293,7 +293,7 @@ namespace UI.ViewModels { var bindModel = new ChartsDataModel(); bindModel.Data = item; - bindModel.Name = item.AppModel.Name; + bindModel.Name = item.AppModel.Description; bindModel.Value = item.Time; bindModel.Tag = Timer.Fromat(item.Time); bindModel.PopupText = item.AppModel.File; diff --git a/UI/ViewModels/IndexPageVM.cs b/UI/ViewModels/IndexPageVM.cs index e92891b..684b42b 100644 --- a/UI/ViewModels/IndexPageVM.cs +++ b/UI/ViewModels/IndexPageVM.cs @@ -93,37 +93,57 @@ namespace UI.ViewModels #region 读取数据 #region 本周数据 - private async void LoadThisWeekData() + private void LoadThisWeekData() { + //IsLoading = true; + + //var task = Task.Run(() => + // { + // var list = data.GetThisWeeklogList(); + // var res = MapToChartsData(list); + // IsLoading = false; + // return res; + + // }); + + //WeekData = await task; IsLoading = true; - var task = Task.Run(() => - { - var list = data.GetThisWeeklogList(); - var res = MapToChartsData(list); - IsLoading = false; - return res; + Task.Run(() => + { + var list = data.GetThisWeeklogList(); + var res = MapToChartsData(list); + IsLoading = false; + WeekData = res; + }); - }); - WeekData = await task; } #endregion #region 上周数据 - private async void LoadLastWeekData() + private void LoadLastWeekData() { + //IsLoading = true; + //var task = Task.Run(() => + // { + // var list = data.GetLastWeeklogList(); + // var res = MapToChartsData(list); + // IsLoading = false; + // return res; + // }); + //WeekData = await task; IsLoading = true; - var task = Task.Run(() => - { - var list = data.GetLastWeeklogList(); - var res = MapToChartsData(list); - IsLoading = false; - return res; - }); - WeekData = await task; + Task.Run(() => + { + var list = data.GetLastWeeklogList(); + var res = MapToChartsData(list); + IsLoading = false; + WeekData = res; + }); + } #endregion @@ -136,7 +156,7 @@ namespace UI.ViewModels { var bindModel = new ChartsDataModel(); bindModel.Data = item; - bindModel.Name = item.AppModel?.Name; + bindModel.Name = item.AppModel?.Description; bindModel.Value = item.Time; bindModel.Tag = Timer.Fromat(item.Time); bindModel.PopupText = item.AppModel?.File; diff --git a/UI/Views/CategoryAppListPage.xaml b/UI/Views/CategoryAppListPage.xaml index 9cec77e..598ef66 100644 --- a/UI/Views/CategoryAppListPage.xaml +++ b/UI/Views/CategoryAppListPage.xaml @@ -53,8 +53,9 @@ - - + + + @@ -84,6 +85,9 @@ + + + @@ -110,12 +114,18 @@ - - - - + + + + + + + + + + - + @@ -147,7 +157,7 @@ - + diff --git a/UI/Views/CategoryPage.xaml b/UI/Views/CategoryPage.xaml index b44a308..e978f98 100644 --- a/UI/Views/CategoryPage.xaml +++ b/UI/Views/CategoryPage.xaml @@ -53,6 +53,9 @@ + + + @@ -92,12 +95,17 @@ - - - - - - + + + + + + + + + + + @@ -130,7 +138,7 @@ - + diff --git a/UI/Views/ChartPage.xaml b/UI/Views/ChartPage.xaml index 2b210c7..2534d7d 100644 --- a/UI/Views/ChartPage.xaml +++ b/UI/Views/ChartPage.xaml @@ -11,8 +11,8 @@ - - + + diff --git a/UI/Views/DataPage.xaml b/UI/Views/DataPage.xaml index b9d5e08..8c6fdab 100644 --- a/UI/Views/DataPage.xaml +++ b/UI/Views/DataPage.xaml @@ -19,14 +19,14 @@ - + diff --git a/UI/Views/DetailPage.xaml b/UI/Views/DetailPage.xaml index 3ea7167..4e476ab 100644 --- a/UI/Views/DetailPage.xaml +++ b/UI/Views/DetailPage.xaml @@ -21,10 +21,10 @@ Padding="0,20"> - - - - + + + + @@ -34,9 +34,9 @@ - + - + - + - + - - + + - + + + + + - 忽略此进程 - 取消忽略此进程 + 忽略此应用 + 取消忽略 @@ -113,7 +117,7 @@ - 清空统计 + 清空统计 diff --git a/UI/Views/IndexPage.xaml b/UI/Views/IndexPage.xaml index 8d8995e..1a72b70 100644 --- a/UI/Views/IndexPage.xaml +++ b/UI/Views/IndexPage.xaml @@ -24,8 +24,8 @@ --> - - + + diff --git a/UI/Views/SettingPage.xaml b/UI/Views/SettingPage.xaml index 3a43098..3611b2d 100644 --- a/UI/Views/SettingPage.xaml +++ b/UI/Views/SettingPage.xaml @@ -15,12 +15,12 @@ - + @@ -51,7 +51,7 @@ - + -- GitLab