提交记录修改Core/Models/CategoryModel.cs+4 −0看文件
修改Core/Properties/AssemblyInfo.cs+2 −2看文件
修改Core/Servicers/Instances/Categorys.cs+1 −0看文件
新增UI/Controls/Base/ColorSelect.cs+198 −0看文件
修改UI/Controls/Converters/HextoColorConverter.cs+4 −0看文件
修改UI/Models/CategoryPageModel.cs+3 −0看文件
新增UI/Themes/Base/ColorSelect.xaml+133 −0看文件
修改UI/Themes/Generic.xaml+1 −0看文件
修改UI/UI.csproj+5 −0看文件
修改UI/ViewModels/CategoryPageVM.cs+7 −2看文件
修改UI/ViewModels/ChartPageVM.cs+3 −2看文件
修改UI/Views/CategoryPage.xaml+31 −13看文件
| @@ -24,5 +24,9 @@ namespace Core.Models | ||
| 24 | 24 | /// 分类图标路径 |
| 25 | 25 | /// </summary> |
| 26 | 26 | public string IconFile { get; set; } |
| 27 | 新增: /// <summary> | |
| 28 | 新增: /// 颜色 | |
| 29 | 新增: /// </summary> | |
| 30 | 新增: public string Color { get; set; } | |
| 27 | 31 | } |
| 28 | 32 | } |
| @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; | ||
| 32 | 32 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 |
| 33 | 33 | //通过使用 "*",如下所示: |
| 34 | 34 | // [assembly: AssemblyVersion("1.0.*")] |
| 35 | 删除:[assembly: AssemblyVersion("1.0.0.3")] | |
| 36 | 删除:[assembly: AssemblyFileVersion("1.0.0.1")] | |
| 35 | 新增:[assembly: AssemblyVersion("1.0.0.4")] | |
| 36 | 新增:[assembly: AssemblyFileVersion("1.0.0.4")] | |
| @@ -90,6 +90,7 @@ namespace Core.Servicers.Instances | ||
| 90 | 90 | { |
| 91 | 91 | model.IconFile = item.IconFile; |
| 92 | 92 | model.Name = item.Name; |
| 93 | 新增: model.Color = item.Color; | |
| 93 | 94 | } |
| 94 | 95 | } |
| 95 | 96 | db.SaveChanges(); |
| @@ -0,0 +1,198 @@ | ||
| 1 | 新增:using Core.Librarys; | |
| 2 | 新增:using System; | |
| 3 | 新增:using System.Collections.Generic; | |
| 4 | 新增:using System.Linq; | |
| 5 | 新增:using System.Text; | |
| 6 | 新增:using System.Threading.Tasks; | |
| 7 | 新增:using System.Windows; | |
| 8 | 新增:using System.Windows.Controls; | |
| 9 | 新增:using System.Windows.Input; | |
| 10 | 新增: | |
| 11 | 新增:namespace UI.Controls.Base | |
| 12 | 新增:{ | |
| 13 | 新增: public class ColorSelect : Control | |
| 14 | 新增: { | |
| 15 | 新增: public List<string> Colors | |
| 16 | 新增: { | |
| 17 | 新增: get { return (List<string>)GetValue(ColorsProperty); } | |
| 18 | 新增: set { SetValue(ColorsProperty, value); } | |
| 19 | 新增: } | |
| 20 | 新增: public static readonly DependencyProperty ColorsProperty = | |
| 21 | 新增: DependencyProperty.Register("Colors", | |
| 22 | 新增: typeof(List<string>), | |
| 23 | 新增: typeof(ColorSelect) | |
| 24 | 新增: ); | |
| 25 | 新增: | |
| 26 | 新增: | |
| 27 | 新增: public string Color | |
| 28 | 新增: { | |
| 29 | 新增: get { return (string)GetValue(ColorProperty); } | |
| 30 | 新增: set { SetValue(ColorProperty, value); } | |
| 31 | 新增: } | |
| 32 | 新增: public static readonly DependencyProperty ColorProperty = | |
| 33 | 新增: DependencyProperty.Register("Color", | |
| 34 | 新增: typeof(string), | |
| 35 | 新增: typeof(ColorSelect), new PropertyMetadata(new PropertyChangedCallback(OnColorPropertyChanged))); | |
| 36 | 新增: | |
| 37 | 新增: private static void OnColorPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |
| 38 | 新增: { | |
| 39 | 新增: var control = d as ColorSelect; | |
| 40 | 新增: if (string.IsNullOrEmpty(control.Color)) | |
| 41 | 新增: { | |
| 42 | 新增: control.Color = control.Colors[0]; | |
| 43 | 新增: } | |
| 44 | 新增: } | |
| 45 | 新增: | |
| 46 | 新增: public bool IsOpen | |
| 47 | 新增: { | |
| 48 | 新增: get { return (bool)GetValue(IsOpenProperty); } | |
| 49 | 新增: set { SetValue(IsOpenProperty, value); } | |
| 50 | 新增: } | |
| 51 | 新增: public static readonly DependencyProperty IsOpenProperty = | |
| 52 | 新增: DependencyProperty.Register("IsOpen", | |
| 53 | 新增: typeof(bool), | |
| 54 | 新增: typeof(ColorSelect), new PropertyMetadata(new PropertyChangedCallback(OnPropertyChanged))); | |
| 55 | 新增: | |
| 56 | 新增: private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | |
| 57 | 新增: { | |
| 58 | 新增: var control = d as ColorSelect; | |
| 59 | 新增: if (e.Property == IsOpenProperty) | |
| 60 | 新增: { | |
| 61 | 新增: control.HandleHook(); | |
| 62 | 新增: } | |
| 63 | 新增: } | |
| 64 | 新增: private Win32API.LowLevelKeyboardProc mouseProc; | |
| 65 | 新增: private static IntPtr hookMouseID = IntPtr.Zero; | |
| 66 | 新增: private IntPtr hook; | |
| 67 | 新增: private bool IsFirstClick = false; | |
| 68 | 新增: private Border SelectContainer; | |
| 69 | 新增: | |
| 70 | 新增: | |
| 71 | 新增: #region hook | |
| 72 | 新增: private void HandleHook() | |
| 73 | 新增: { | |
| 74 | 新增: if (IsOpen) | |
| 75 | 新增: { | |
| 76 | 新增: // 设置键盘钩子 | |
| 77 | 新增: hook = Win32API.SetMouseHook(mouseProc); | |
| 78 | 新增: } | |
| 79 | 新增: else | |
| 80 | 新增: { | |
| 81 | 新增: Win32API.UnhookWindowsHookEx(hook); | |
| 82 | 新增: } | |
| 83 | 新增: } | |
| 84 | 新增: private IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) | |
| 85 | 新增: { | |
| 86 | 新增: | |
| 87 | 新增: if (nCode >= 0) | |
| 88 | 新增: { | |
| 89 | 新增: if (wParam == (IntPtr)Win32API.WM_LBUTTONDBLCLK || wParam == (IntPtr)Win32API.WM_WHEEL) | |
| 90 | 新增: { | |
| 91 | 新增: if (!IsFirstClick) | |
| 92 | 新增: { | |
| 93 | 新增: bool isInControl = IsInControl(); | |
| 94 | 新增: | |
| 95 | 新增: if (!isInControl) | |
| 96 | 新增: { | |
| 97 | 新增: IsOpen = false; | |
| 98 | 新增: } | |
| 99 | 新增: } | |
| 100 | 新增: IsFirstClick = false; | |
| 101 | 新增: } | |
| 102 | 新增: | |
| 103 | 新增: } | |
| 104 | 新增: | |
| 105 | 新增: return Win32API.CallNextHookEx(hookMouseID, nCode, wParam, lParam); | |
| 106 | 新增: } | |
| 107 | 新增: private bool IsInControl() | |
| 108 | 新增: { | |
| 109 | 新增: var p = Mouse.GetPosition(SelectContainer); | |
| 110 | 新增: if (p.X < 0 || p.Y < 0 || p.X > SelectContainer.ActualWidth || p.Y > SelectContainer.ActualHeight) | |
| 111 | 新增: { | |
| 112 | 新增: return false; | |
| 113 | 新增: } | |
| 114 | 新增: | |
| 115 | 新增: | |
| 116 | 新增: return true; | |
| 117 | 新增: } | |
| 118 | 新增: #endregion | |
| 119 | 新增: | |
| 120 | 新增: public Command ShowSelectCommand { get; set; } | |
| 121 | 新增: public Command ColorSelectCommand { get; set; } | |
| 122 | 新增: | |
| 123 | 新增: public ColorSelect() | |
| 124 | 新增: { | |
| 125 | 新增: DefaultStyleKey = typeof(ColorSelect); | |
| 126 | 新增: ShowSelectCommand = new Command(new Action<object>(OnShowSelect)); | |
| 127 | 新增: ColorSelectCommand = new Command(new Action<object>(OnColorSelect)); | |
| 128 | 新增: mouseProc = HookCallback; | |
| 129 | 新增: | |
| 130 | 新增: Unloaded += ColorSelect_Unloaded; | |
| 131 | 新增: LoadColors(); | |
| 132 | 新增: } | |
| 133 | 新增: | |
| 134 | 新增: private void LoadColors() | |
| 135 | 新增: { | |
| 136 | 新增: var list = new List<string>() | |
| 137 | 新增: { | |
| 138 | 新增: "#00FFAB", | |
| 139 | 新增: "#017aff", | |
| 140 | 新增: "#6c47ff", | |
| 141 | 新增: "#39c0c8", | |
| 142 | 新增: "#f96300", | |
| 143 | 新增: "#f34971", | |
| 144 | 新增: "#ff9382", | |
| 145 | 新增: "#f5c900", | |
| 146 | 新增: "#cdad7a", | |
| 147 | 新增: "#aabb5d", | |
| 148 | 新增: "#000000", | |
| 149 | 新增: "#2B20D9" | |
| 150 | 新增: }; | |
| 151 | 新增: | |
| 152 | 新增: | |
| 153 | 新增: Colors = list; | |
| 154 | 新增: Color = list[0]; | |
| 155 | 新增: } | |
| 156 | 新增: private void OnShowSelect(object obj) | |
| 157 | 新增: { | |
| 158 | 新增: IsOpen = true; | |
| 159 | 新增: IsFirstClick = true; | |
| 160 | 新增: } | |
| 161 | 新增: | |
| 162 | 新增: private string HexConverter(System.Drawing.Color c) | |
| 163 | 新增: { | |
| 164 | 新增: return "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"); | |
| 165 | 新增: } | |
| 166 | 新增: | |
| 167 | 新增: private void OnColorSelect(object obj) | |
| 168 | 新增: { | |
| 169 | 新增: IsOpen = false; | |
| 170 | 新增: IsFirstClick = false; | |
| 171 | 新增: | |
| 172 | 新增: System.Windows.Forms.ColorDialog colorDialog = new System.Windows.Forms.ColorDialog(); | |
| 173 | 新增: if (colorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |
| 174 | 新增: { | |
| 175 | 新增: Color = HexConverter(colorDialog.Color); | |
| 176 | 新增: } | |
| 177 | 新增: } | |
| 178 | 新增: | |
| 179 | 新增: public override void OnApplyTemplate() | |
| 180 | 新增: { | |
| 181 | 新增: base.OnApplyTemplate(); | |
| 182 | 新增: | |
| 183 | 新增: SelectContainer = GetTemplateChild("SelectContainer") as Border; | |
| 184 | 新增: } | |
| 185 | 新增: | |
| 186 | 新增: private void ColorSelect_Unloaded(object sender, RoutedEventArgs e) | |
| 187 | 新增: { | |
| 188 | 新增: Win32API.UnhookWindowsHookEx(hook); | |
| 189 | 新增: } | |
| 190 | 新增: | |
| 191 | 新增: protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) | |
| 192 | 新增: { | |
| 193 | 新增: base.OnMouseLeftButtonDown(e); | |
| 194 | 新增: } | |
| 195 | 新增: | |
| 196 | 新增: | |
| 197 | 新增: } | |
| 198 | 新增:} | |
| @@ -14,6 +14,10 @@ namespace UI.Controls.Converters | ||
| 14 | 14 | { |
| 15 | 15 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) |
| 16 | 16 | { |
| 17 | 新增: if(value == null) | |
| 18 | 新增: { | |
| 19 | 新增: return null; | |
| 20 | 新增: } | |
| 17 | 21 | return UI.Base.Color.Colors.GetFromString(value.ToString()); |
| 18 | 22 | } |
| 19 | 23 | |
| @@ -55,5 +55,8 @@ namespace UI.Models | ||
| 55 | 55 | } |
| 56 | 56 | private bool IsEditError_ = false; |
| 57 | 57 | public bool IsEditError { get { return IsEditError_; } set { IsEditError_ = value; OnPropertyChanged(); } } |
| 58 | 新增: | |
| 59 | 新增: private string EditColor_; | |
| 60 | 新增: public string EditColor { get { return EditColor_; } set { EditColor_ = value; OnPropertyChanged(); } } | |
| 58 | 61 | } |
| 59 | 62 | } |
| 文件末尾没有换行 | ||
| @@ -0,0 +1,133 @@ | ||
| 1 | 新增:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 2 | 新增: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| 3 | 新增: xmlns:local="clr-namespace:UI.Controls.Base" xmlns:button="clr-namespace:UI.Controls.Button" xmlns:converter="clr-namespace:UI.Controls.Converters"> | |
| 4 | 新增: <converter:HextoColorConverter x:Key="HextoColorConverter"/> | |
| 5 | 新增: | |
| 6 | 新增: <Style TargetType="{x:Type local:ColorSelect}"> | |
| 7 | 新增: <Setter Property="SnapsToDevicePixels" | |
| 8 | 新增: Value="true" /> | |
| 9 | 新增: <Setter Property="Background" Value="Transparent"/> | |
| 10 | 新增: | |
| 11 | 新增: <Setter Property="Template"> | |
| 12 | 新增: <Setter.Value> | |
| 13 | 新增: <ControlTemplate TargetType="{x:Type local:ColorSelect}"> | |
| 14 | 新增: <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True" BorderBrush="#f7f8fa" CornerRadius="5" BorderThickness="2" Width="38" Height="38"> | |
| 15 | 新增: <Border.InputBindings> | |
| 16 | 新增: <MouseBinding Gesture="LeftClick" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=ShowSelectCommand}"/> | |
| 17 | 新增: </Border.InputBindings> | |
| 18 | 新增: <Grid> | |
| 19 | 新增: <Border CornerRadius="4" Width="28" Height="28" Background="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=Color,Converter={StaticResource HextoColorConverter}}"/> | |
| 20 | 新增: <Popup | |
| 21 | 新增: x:Name="Popup" | |
| 22 | 新增: Placement="Bottom" | |
| 23 | 新增: IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" | |
| 24 | 新增: > | |
| 25 | 新增: <Border | |
| 26 | 新增: x:Name="SelectContainer" | |
| 27 | 新增: CornerRadius="10" | |
| 28 | 新增: BorderBrush="#CCC" | |
| 29 | 新增: BorderThickness="1" | |
| 30 | 新增: Background="White" Padding="10" Width="275" MaxHeight="300" Margin="10"> | |
| 31 | 新增: <Border.Effect> | |
| 32 | 新增: <DropShadowEffect BlurRadius="6" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/> | |
| 33 | 新增: </Border.Effect> | |
| 34 | 新增: <Grid> | |
| 35 | 新增: <Grid.RowDefinitions> | |
| 36 | 新增: <RowDefinition Height="auto"/> | |
| 37 | 新增: <RowDefinition Height="*"/> | |
| 38 | 新增: <RowDefinition Height="auto"/> | |
| 39 | 新增: </Grid.RowDefinitions> | |
| 40 | 新增: | |
| 41 | 新增: <TextBlock Text="选择颜色" VerticalAlignment="Center" HorizontalAlignment="Left"/> | |
| 42 | 新增: | |
| 43 | 新增: <ScrollViewer Grid.Row="1"> | |
| 44 | 新增: <ListView Grid.Row="1" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=Colors}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=Color,Mode=TwoWay}" Margin="0,10,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > | |
| 45 | 新增: <!--<i:Interaction.Triggers> | |
| 46 | 新增: <i:EventTrigger EventName="MouseLeftButtonUp"> | |
| 47 | 新增: <i:InvokeCommandAction Command="{Binding GotoDetailCommand}" | |
| 48 | 新增: CommandParameter="{Binding SelectedItem}" /> | |
| 49 | 新增: </i:EventTrigger> | |
| 50 | 新增: </i:Interaction.Triggers>--> | |
| 51 | 新增: <ListBox.Resources> | |
| 52 | 新增: <Style TargetType="{x:Type ListView}"> | |
| 53 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 54 | 新增: | |
| 55 | 新增: <Setter Property="Template"> | |
| 56 | 新增: <Setter.Value> | |
| 57 | 新增: <ControlTemplate TargetType="{x:Type ListView}"> | |
| 58 | 新增: <Border> | |
| 59 | 新增: <ItemsPresenter /> | |
| 60 | 新增: </Border> | |
| 61 | 新增: </ControlTemplate> | |
| 62 | 新增: </Setter.Value> | |
| 63 | 新增: </Setter> | |
| 64 | 新增: </Style> | |
| 65 | 新增: <Style TargetType="{x:Type ListViewItem}"> | |
| 66 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 67 | 新增: <Setter Property="Foreground" Value="#1a1a1a"/> | |
| 68 | 新增: | |
| 69 | 新增: <Setter Property="Template"> | |
| 70 | 新增: <Setter.Value> | |
| 71 | 新增: <ControlTemplate TargetType="{x:Type ListViewItem}"> | |
| 72 | 新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="White" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5"> | |
| 73 | 新增: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> | |
| 74 | 新增: </Border> | |
| 75 | 新增: <ControlTemplate.Triggers> | |
| 76 | 新增: | |
| 77 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 78 | 新增: <Setter TargetName="Border" Property="Background" Value="#FFE8E6FF"/> | |
| 79 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 80 | 新增: | |
| 81 | 新增: </Trigger> | |
| 82 | 新增: <Trigger Property="IsSelected" Value="True"> | |
| 83 | 新增: <Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/> | |
| 84 | 新增: <Setter Property="Foreground" Value="White"/> | |
| 85 | 新增: | |
| 86 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 87 | 新增: | |
| 88 | 新增: </Trigger> | |
| 89 | 新增: </ControlTemplate.Triggers> | |
| 90 | 新增: </ControlTemplate> | |
| 91 | 新增: </Setter.Value> | |
| 92 | 新增: </Setter> | |
| 93 | 新增: | |
| 94 | 新增: </Style> | |
| 95 | 新增: </ListBox.Resources> | |
| 96 | 新增: <ListBox.ItemsPanel> | |
| 97 | 新增: <ItemsPanelTemplate> | |
| 98 | 新增: <WrapPanel/> | |
| 99 | 新增: </ItemsPanelTemplate> | |
| 100 | 新增: </ListBox.ItemsPanel> | |
| 101 | 新增: <ListView.ItemTemplate> | |
| 102 | 新增: <DataTemplate> | |
| 103 | 新增: | |
| 104 | 新增: <WrapPanel Orientation="Horizontal"> | |
| 105 | 新增: | |
| 106 | 新增: <!--<local:Img URL="{Binding}" Width="25" Height="25"/>--> | |
| 107 | 新增: <Border Width="25" CornerRadius="4" Height="25" Background="{Binding .,Converter={StaticResource HextoColorConverter}}"> | |
| 108 | 新增: </Border> | |
| 109 | 新增: | |
| 110 | 新增: </WrapPanel> | |
| 111 | 新增: | |
| 112 | 新增: </DataTemplate> | |
| 113 | 新增: </ListView.ItemTemplate> | |
| 114 | 新增: </ListView> | |
| 115 | 新增: </ScrollViewer> | |
| 116 | 新增: <button:Button Grid.Row="2" HorizontalAlignment="Right" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:ColorSelect}}, Path=ColorSelectCommand}" Content="自定义颜色" Width="120"/> | |
| 117 | 新增: </Grid> | |
| 118 | 新增: </Border> | |
| 119 | 新增: | |
| 120 | 新增: </Popup> | |
| 121 | 新增: </Grid> | |
| 122 | 新增: </Border> | |
| 123 | 新增: <ControlTemplate.Triggers> | |
| 124 | 新增: | |
| 125 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 126 | 新增: <Setter Property="Background" Value="#FFE8E6FF"/> | |
| 127 | 新增: </Trigger> | |
| 128 | 新增: </ControlTemplate.Triggers> | |
| 129 | 新增: </ControlTemplate> | |
| 130 | 新增: </Setter.Value> | |
| 131 | 新增: </Setter> | |
| 132 | 新增: </Style> | |
| 133 | 新增:</ResourceDictionary> | |
| 文件末尾没有换行 | ||
| @@ -13,6 +13,7 @@ | ||
| 13 | 13 | <ResourceDictionary Source="/Tai;component/Themes/Base/Text.xaml"/> |
| 14 | 14 | <ResourceDictionary Source="/Tai;component/Themes/Base/View.xaml"/> |
| 15 | 15 | <ResourceDictionary Source="/Tai;component/Themes/Base/IconSelect.xaml"/> |
| 16 | 新增: <ResourceDictionary Source="/Tai;component/Themes/Base/ColorSelect.xaml"/> | |
| 16 | 17 | |
| 17 | 18 | <ResourceDictionary Source="/Tai;component/Themes/PageContainer.xaml"/> |
| 18 | 19 | <ResourceDictionary Source="/Tai;component/Themes/Charts/Charts.xaml"/> |
| @@ -129,6 +129,7 @@ | ||
| 129 | 129 | <Compile Include="Base\Color\ColorTypes.cs" /> |
| 130 | 130 | <Compile Include="Controls\Base\EmptyData.cs" /> |
| 131 | 131 | <Compile Include="Controls\Base\CheckBox.cs" /> |
| 132 | 新增: <Compile Include="Controls\Base\ColorSelect.cs" /> | |
| 132 | 133 | <Compile Include="Controls\Base\IconSelect.cs" /> |
| 133 | 134 | <Compile Include="Controls\Base\Img.cs" /> |
| 134 | 135 | <Compile Include="Controls\Base\Placeholder.cs" /> |
| @@ -240,6 +241,10 @@ | ||
| 240 | 241 | <Generator>MSBuild:Compile</Generator> |
| 241 | 242 | <SubType>Designer</SubType> |
| 242 | 243 | </Page> |
| 244 | 新增: <Page Include="Themes\Base\ColorSelect.xaml"> | |
| 245 | 新增: <Generator>MSBuild:Compile</Generator> | |
| 246 | 新增: <SubType>Designer</SubType> | |
| 247 | 新增: </Page> | |
| 243 | 248 | <Page Include="Themes\Base\IconSelect.xaml"> |
| 244 | 249 | <Generator>MSBuild:Compile</Generator> |
| 245 | 250 | <SubType>Designer</SubType> |
| @@ -107,7 +107,7 @@ namespace UI.ViewModels | ||
| 107 | 107 | mainVM.Toast("请选择一个分类图标", Controls.Window.ToastType.Error, Controls.Base.IconTypes.CriticalErrorSolid); |
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 删除: if (EditIconFile.IndexOf("pack://") ==-1 && new FileInfo(EditIconFile).Length > 1000000) | |
| 110 | 新增: if (EditIconFile.IndexOf("pack://") == -1 && new FileInfo(EditIconFile).Length > 1000000) | |
| 111 | 111 | { |
| 112 | 112 | mainVM.Toast("图标文件不能超过1MB", Controls.Window.ToastType.Error, Controls.Base.IconTypes.CriticalErrorSolid); |
| 113 | 113 | return; |
| @@ -132,6 +132,7 @@ namespace UI.ViewModels | ||
| 132 | 132 | { |
| 133 | 133 | Name = EditName, |
| 134 | 134 | IconFile = EditIconFile, |
| 135 | 新增: Color = EditColor, | |
| 135 | 136 | }); |
| 136 | 137 | |
| 137 | 138 | var item = new CategoryModel() |
| @@ -162,7 +163,7 @@ namespace UI.ViewModels | ||
| 162 | 163 | mainVM.Toast("分类名称已存在", Controls.Window.ToastType.Error, Controls.Base.IconTypes.CriticalErrorSolid); |
| 163 | 164 | return; |
| 164 | 165 | } |
| 165 | 删除: if (EditName == SelectedItem.Data.Name && EditIconFile == SelectedItem.Data.IconFile) | |
| 166 | 新增: if (EditName == SelectedItem.Data.Name && EditIconFile == SelectedItem.Data.IconFile && EditColor==SelectedItem.Data.Color) | |
| 166 | 167 | { |
| 167 | 168 | mainVM.Toast("没有修改"); |
| 168 | 169 | EditVisibility = System.Windows.Visibility.Collapsed; |
| @@ -175,6 +176,8 @@ namespace UI.ViewModels | ||
| 175 | 176 | { |
| 176 | 177 | category.Name = EditName; |
| 177 | 178 | category.IconFile = EditIconFile; |
| 179 | 新增: category.Color = EditColor; | |
| 180 | 新增: | |
| 178 | 181 | categorys.Update(category); |
| 179 | 182 | categorys.SaveChanged(); |
| 180 | 183 | } |
| @@ -189,6 +192,7 @@ namespace UI.ViewModels | ||
| 189 | 192 | ID = item.Data.ID, |
| 190 | 193 | Name = EditName, |
| 191 | 194 | IconFile = EditIconFile, |
| 195 | 新增: Color = EditColor | |
| 192 | 196 | } |
| 193 | 197 | }; |
| 194 | 198 | |
| @@ -212,6 +216,7 @@ namespace UI.ViewModels | ||
| 212 | 216 | var select = obj as CategoryModel; |
| 213 | 217 | EditName = select.Data.Name; |
| 214 | 218 | EditIconFile = select.Data.IconFile; |
| 219 | 新增: EditColor = select.Data.Color; | |
| 215 | 220 | } |
| 216 | 221 | else |
| 217 | 222 | { |
| @@ -136,7 +136,7 @@ namespace UI.ViewModels | ||
| 136 | 136 | DataMaximum = 3600; |
| 137 | 137 | Task.Run(() => |
| 138 | 138 | { |
| 139 | 删除: | |
| 139 | 新增: | |
| 140 | 140 | |
| 141 | 141 | var list = data.GetCategoryHoursData(Date); |
| 142 | 142 | |
| @@ -163,6 +163,7 @@ namespace UI.ViewModels | ||
| 163 | 163 | Name = category.Name, |
| 164 | 164 | Icon = category.IconFile, |
| 165 | 165 | Values = item.Values, |
| 166 | 新增: Color = category.Color | |
| 166 | 167 | }; |
| 167 | 168 | if (category.ID == 0) |
| 168 | 169 | { |
| @@ -390,7 +391,7 @@ namespace UI.ViewModels | ||
| 390 | 391 | bindModel.Data = item; |
| 391 | 392 | bindModel.Name = string.IsNullOrEmpty(item.AppModel?.Description) ? item.AppModel.Name : item.AppModel.Description; |
| 392 | 393 | bindModel.Value = item.Time; |
| 393 | 删除: bindModel.Tag =Time.ToString(item.Time); | |
| 394 | 新增: bindModel.Tag = Time.ToString(item.Time); | |
| 394 | 395 | bindModel.PopupText = item.AppModel?.File; |
| 395 | 396 | bindModel.Icon = item.AppModel?.IconFile; |
| 396 | 397 | resData.Add(bindModel); |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | 6 | xmlns:local="clr-namespace:UI.Views" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:Button="clr-namespace:UI.Controls.Button" xmlns:input="clr-namespace:UI.Controls.Input" xmlns:select="clr-namespace:UI.Controls.Select" |
| 7 | 7 | mc:Ignorable="d" |
| 8 | 删除: xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" | |
| 8 | 新增: xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:converter="clr-namespace:UI.Controls.Converters" | |
| 9 | 9 | d:DesignHeight="450" d:DesignWidth="800" |
| 10 | 10 | Title="CategoryPage"> |
| 11 | 11 | |
| @@ -28,14 +28,24 @@ | ||
| 28 | 28 | <Button:IconButton Foreground="#ccc" Icon="ChromeClose" HorizontalAlignment="Right" FontSize="12" Margin="0,0,10,0" Command="{Binding EditCloseCommand}"/> |
| 29 | 29 | </Grid> |
| 30 | 30 | <!--<TextBlock Text="编辑" VerticalAlignment="Center" Margin="10,0,0,0"/>--> |
| 31 | 新增: <ScrollViewer Grid.Row="1"> | |
| 31 | 32 | <StackPanel Grid.Row="1" Margin="10"> |
| 32 | 33 | <TextBlock Text="分类名称"/> |
| 33 | 删除: <input:InputBox Error="{Binding EditErrorText}" IsShowError="{Binding IsEditError,Mode=TwoWay}" Text="{Binding EditName,Mode=TwoWay}" MaxLength="10" Margin="0,10,0,0"/> | |
| 34 | 34 | |
| 35 | 删除: <TextBlock Text="分类图标" Margin="0,10,0,0"/> | |
| 35 | 新增: <Grid> | |
| 36 | 新增: <Grid.ColumnDefinitions> | |
| 37 | 新增: <ColumnDefinition Width="auto"/> | |
| 38 | 新增: <ColumnDefinition Width="*"/> | |
| 39 | 新增: </Grid.ColumnDefinitions> | |
| 40 | 新增: <base:ColorSelect Color="{Binding EditColor,Mode=TwoWay}" ToolTip="选择分类颜色" HorizontalAlignment="Left" Margin="0,10,0,0" /> | |
| 41 | 新增: | |
| 42 | 新增: <input:InputBox Grid.Column="1" Error="{Binding EditErrorText}" IsShowError="{Binding IsEditError,Mode=TwoWay}" Text="{Binding EditName,Mode=TwoWay}" MaxLength="10" Margin="5,10,0,0"/> | |
| 43 | 新增: </Grid> | |
| 44 | 新增: | |
| 45 | 新增: <TextBlock Text="图标" Margin="0,10,0,0"/> | |
| 36 | 46 | <base:IconSelect URL="{Binding EditIconFile,Mode=TwoWay}" HorizontalAlignment="Left" Margin="0,10,0,0" /> |
| 37 | 47 | </StackPanel> |
| 38 | 删除: | |
| 48 | 新增: </ScrollViewer> | |
| 39 | 49 | <Button:Button Grid.Row="2" HorizontalAlignment="Right" Text="?创建:更新" Value="{Binding IsCreate}" Width="120" Margin="0,0,10,0" VerticalAlignment="Center" Command="{Binding EditDoneCommand}"> |
| 40 | 50 | |
| 41 | 51 | </Button:Button> |
| @@ -77,6 +87,8 @@ | ||
| 77 | 87 | </ContextMenu> |
| 78 | 88 | </ListView.ContextMenu> |
| 79 | 89 | <ListBox.Resources> |
| 90 | 新增: <converter:HextoColorConverter x:Key="HextoColorConverter"/> | |
| 91 | 新增: | |
| 80 | 92 | <Style TargetType="{x:Type ListView}"> |
| 81 | 93 | <Setter Property="OverridesDefaultStyle" Value="True"/> |
| 82 | 94 | |
| @@ -101,7 +113,7 @@ | ||
| 101 | 113 | <DropShadowEffect Color="#d8d2d2" BlurRadius="10" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> |
| 102 | 114 | </Border.Effect> |
| 103 | 115 | </Border> |
| 104 | 删除: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="White" Margin="5" CornerRadius="10"> | |
| 116 | 新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="White" Margin="5" CornerRadius="20"> | |
| 105 | 117 | <ContentPresenter/> |
| 106 | 118 | </Border> |
| 107 | 119 | </Grid> |
| @@ -126,27 +138,33 @@ | ||
| 126 | 138 | </ListBox.ItemsPanel> |
| 127 | 139 | <ListView.ItemTemplate> |
| 128 | 140 | <DataTemplate> |
| 141 | 新增: | |
| 129 | 142 | |
| 130 | 143 | <WrapPanel Orientation="Vertical"> |
| 131 | 144 | <Border Width="150" Height="150"> |
| 132 | 145 | |
| 133 | 146 | <Grid> |
| 134 | 147 | <Grid.RowDefinitions> |
| 135 | 删除: <RowDefinition Height="80"/> | |
| 148 | 新增: <RowDefinition Height="40"/> | |
| 149 | 新增: | |
| 150 | 新增: <RowDefinition Height="40"/> | |
| 136 | 151 | <RowDefinition Height="30"/> |
| 137 | 152 | <RowDefinition Height="*"/> |
| 138 | 153 | |
| 139 | 154 | </Grid.RowDefinitions> |
| 140 | 删除: <Border> | |
| 141 | 删除: <base:Img Radius="10" Width="50" Height="50" URL="{Binding Data.IconFile}"/> | |
| 142 | 删除: </Border> | |
| 143 | 删除: <TextBlock Foreground="#202020" HorizontalAlignment="Center" Grid.Row="1" Text="{Binding Data.Name}" FontSize="14"/> | |
| 155 | 新增: <Rectangle HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" RadiusX="20" RadiusY="20" Width="20" Height="20" Fill="{Binding Data.Color,Converter={StaticResource HextoColorConverter}}"/> | |
| 156 | 新增: <Grid Grid.Row="1"> | |
| 157 | 新增: | |
| 158 | 新增: <base:Img Radius="8" Width="40" Height="40" URL="{Binding Data.IconFile}"/> | |
| 159 | 新增: </Grid> | |
| 160 | 新增: <TextBlock Foreground="#202020" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="2" Text="{Binding Data.Name}" FontSize="14"/> | |
| 144 | 161 | |
| 145 | 删除: <Border Grid.Row="2" > | |
| 146 | 删除: <Border Margin="10,0,0,0" CornerRadius="5" Background="#f9f9f9" HorizontalAlignment="Left" VerticalAlignment="Center" Padding="15,5"> | |
| 162 | 新增: <Border Grid.Row="3" > | |
| 163 | 新增: <Border Margin="10,0,10,0" CornerRadius="10" Background="#f9f9f9" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="10,5"> | |
| 147 | 164 | <TextBlock Foreground="#FF737373"> |
| 165 | 新增: <Run Text="×"/> | |
| 166 | 新增: | |
| 148 | 167 | <Run Text="{Binding Count}"/> |
| 149 | 删除: <Run Text="个应用"/> | |
| 150 | 168 | </TextBlock> |
| 151 | 169 | |
| 152 | 170 | </Border> |

