:fire:增加自定义背景保存
This commit is contained in:
@@ -30,7 +30,7 @@ namespace GeekDesk.Constant
|
|||||||
|
|
||||||
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
|
public static string PW_FILE_BAK_PATH = APP_DIR + "bak\\pw.txt"; //密码文件路径
|
||||||
|
|
||||||
public static string UUID_FILE_BAK_PATH = APP_DIR + "bak\\uuid.txt"; //密码文件路径
|
public static string UUID_FILE_BAK_PATH = APP_DIR + "bak\\uuid.txt"; //uuid文件路径
|
||||||
|
|
||||||
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件
|
public static string LOG_FILE_PATH = APP_DIR + "logs\\log.log"; //日志文件
|
||||||
|
|
||||||
|
|||||||
17
Constant/DictConst.cs
Normal file
17
Constant/DictConst.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Constant
|
||||||
|
{
|
||||||
|
public class DictConst
|
||||||
|
{
|
||||||
|
public static readonly Dictionary<bool, string> batchMenuHeaderDict = new Dictionary<bool, string>();
|
||||||
|
static DictConst() {
|
||||||
|
batchMenuHeaderDict.Add(true, "取消批量操作");
|
||||||
|
batchMenuHeaderDict.Add(false, "批量操作");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
Control/Other/BGNmaeDialog.xaml
Normal file
34
Control/Other/BGNmaeDialog.xaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<Border x:Class="GeekDesk.Control.Other.BGNmaeDialog"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:cvt="clr-namespace:GeekDesk.Converts"
|
||||||
|
CornerRadius="4"
|
||||||
|
Width="350"
|
||||||
|
Height="160"
|
||||||
|
Style="{StaticResource BorderBG}"
|
||||||
|
>
|
||||||
|
<Border.Resources>
|
||||||
|
<Style x:Key="LeftTB" TargetType="TextBlock" BasedOn="{StaticResource TextBlockBaseStyle}">
|
||||||
|
<Setter Property="Width" Value="75"/>
|
||||||
|
<Setter Property="TextAlignment" Value="Left"/>
|
||||||
|
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
<Setter Property="Margin" Value="5,8,0,0"/>
|
||||||
|
<Setter Property="FontSize" Value="14"/>
|
||||||
|
</Style>
|
||||||
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
|
</Border.Resources>
|
||||||
|
<hc:SimplePanel Margin="10" VerticalAlignment="Center">
|
||||||
|
<StackPanel>
|
||||||
|
<Button Width="22" Height="22" Command="hc:ControlCommands.Close" Style="{StaticResource ButtonIcon}" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" hc:IconElement.Geometry="{StaticResource ErrorGeometry}" Padding="0" HorizontalAlignment="Right" VerticalAlignment="Top"/>
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="0,15,0,0">
|
||||||
|
<TextBlock Text="起个名字吧:" Style="{StaticResource LeftTB}"/>
|
||||||
|
<TextBox x:Name="BGName" Style="{StaticResource MyTextBoxStyle}" Text="{Binding Name, Mode=OneWay}" Width="230" FontSize="14"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel Margin="0,25,0,0" Spacing="10" Grid.ColumnSpan="4">
|
||||||
|
<Button Content="保存" Style="{StaticResource MyBtnStyle}" Click="Save" Margin="265,10,0,0"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</hc:SimplePanel>
|
||||||
|
</Border>
|
||||||
42
Control/Other/BGNmaeDialog.xaml.cs
Normal file
42
Control/Other/BGNmaeDialog.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using GeekDesk.Constant;
|
||||||
|
using GeekDesk.Util;
|
||||||
|
using GeekDesk.ViewModel;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
|
|
||||||
|
namespace GeekDesk.Control.Other
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// TextDialog.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class BGNmaeDialog
|
||||||
|
{
|
||||||
|
public HandyControl.Controls.Dialog dialog;
|
||||||
|
|
||||||
|
public BGNmaeDialog()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void Save(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
GradientBGParam bg = new GradientBGParam();
|
||||||
|
bg.Id = Guid.NewGuid().ToString();
|
||||||
|
bg.Name = BGName.Text;
|
||||||
|
bg.Color1 = MainWindow.appData.AppConfig.GradientBGParam.Color1;
|
||||||
|
bg.Color2 = MainWindow.appData.AppConfig.GradientBGParam.Color2;
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams.Add(bg);
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
|
||||||
|
dialog.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -20,19 +20,27 @@
|
|||||||
Width="600"
|
Width="600"
|
||||||
Height="400"
|
Height="400"
|
||||||
Margin="0,-620,0,0">
|
Margin="0,-620,0,0">
|
||||||
|
|
||||||
<Border Style="{StaticResource BorderBG}">
|
<Border Style="{StaticResource BorderBG}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<TextBlock Text="提示: 右键点击可以删除自定义的背景颜色哦" Foreground="Gray" HorizontalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
|
|
||||||
<ListBox x:Name="GradientBGs"
|
<ListBox x:Name="GradientBGs"
|
||||||
ItemsSource="{Binding}"
|
ItemsSource="{Binding}"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
Margin="20,20,20,50"
|
Margin="20,20,20,50"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
>
|
>
|
||||||
|
<ListBox.Resources>
|
||||||
|
<ContextMenu x:Key="CMDialog" Width="200">
|
||||||
|
<MenuItem Header="删除" Click="Delete" Tag="{Binding}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.Resources>
|
||||||
<ListBox.ItemContainerStyle>
|
<ListBox.ItemContainerStyle>
|
||||||
<Style TargetType="ListBoxItem">
|
<Style TargetType="ListBoxItem">
|
||||||
|
<Setter Property="ContextMenu" Value="{StaticResource CMDialog}"/>
|
||||||
<Setter Property="Margin" Value="10"/>
|
<Setter Property="Margin" Value="10"/>
|
||||||
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
|
<Setter Property="Effect" Value="{StaticResource EffectShadow2}"/>
|
||||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
||||||
</Style>
|
</Style>
|
||||||
</ListBox.ItemContainerStyle>
|
</ListBox.ItemContainerStyle>
|
||||||
<ListBox.ItemsPanel>
|
<ListBox.ItemsPanel>
|
||||||
@@ -40,6 +48,7 @@
|
|||||||
<WrapPanel Background="Transparent"/>
|
<WrapPanel Background="Transparent"/>
|
||||||
</ItemsPanelTemplate>
|
</ItemsPanelTemplate>
|
||||||
</ListBox.ItemsPanel>
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<Border CornerRadius="4" Width="100" Height="100"
|
<Border CornerRadius="4" Width="100" Height="100"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using GeekDesk.Util;
|
using GeekDesk.Util;
|
||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using GeekDesk.ViewModel.Temp;
|
using GeekDesk.ViewModel.Temp;
|
||||||
|
using System;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
@@ -16,7 +18,13 @@ namespace GeekDesk.Control.Other
|
|||||||
|
|
||||||
public GradientBGDialog()
|
public GradientBGDialog()
|
||||||
{
|
{
|
||||||
this.DataContext = GradientBGParamList.GradientBGParams;
|
ObservableCollection<GradientBGParam> bgArr = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams);
|
||||||
|
foreach(var bg in MainWindow.appData.AppConfig.CustomBGParams)
|
||||||
|
{
|
||||||
|
bgArr.Add(bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DataContext = DeepCopyUtil.DeepCopy(bgArr);
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,8 +53,38 @@ namespace GeekDesk.Control.Other
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Delete(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
HandyControl.Controls.Growl.Ask("确认删除吗?", isConfirmed =>
|
||||||
|
{
|
||||||
|
if (isConfirmed)
|
||||||
|
{
|
||||||
|
GradientBGParam bg = (GradientBGParam)(((MenuItem)sender).Tag);
|
||||||
|
ObservableCollection<GradientBGParam> bgArr = (ObservableCollection<GradientBGParam>)this.DataContext;
|
||||||
|
bgArr.Remove(bg);
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams.Remove(bg);
|
||||||
|
for (int i = MainWindow.appData.AppConfig.CustomBGParams.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
var cbg = MainWindow.appData.AppConfig.CustomBGParams[i];
|
||||||
|
if (cbg.Id == null)
|
||||||
|
{
|
||||||
|
if (cbg.Color1.Equals(bg.Color1) && cbg.Color2.Equals(bg.Color2))
|
||||||
|
{
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (cbg.Id.Equals(bg.Id))
|
||||||
|
{
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams.RemoveAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
MainWindow.appData.AppConfig.CustomBGParams = DeepCopyUtil.DeepCopy(MainWindow.appData.AppConfig.CustomBGParams);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}, "ConfigWindowAskGrowl");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
<cvt:BGStyleConvert x:Key="BGStyleConvert"/>
|
||||||
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
<cvt:StringAppendConvert x:Key="StringAppendConvert"/>
|
||||||
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
<cvt:Visibility2BooleanConverter x:Key="Visibility2BooleanConverter"/>
|
||||||
|
<cvt:TextToColorConverter x:Key="TextToColorConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
@@ -70,7 +71,8 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,0,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
<TextBlock Text="色彩1:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True}"
|
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color1, Converter={StaticResource TextToColorConverter}}"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color1, NotifyOnTargetUpdated=True, Mode=OneWay}"
|
||||||
TargetUpdated="Color_TargetUpdated"
|
TargetUpdated="Color_TargetUpdated"
|
||||||
Width="65"
|
Width="65"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
@@ -83,7 +85,8 @@
|
|||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0" Grid.ColumnSpan="4">
|
||||||
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
<TextBlock Text="色彩2:" VerticalAlignment="Center" Margin="0,5,0,0"/>
|
||||||
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True}"
|
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=GradientBGParam.Color2, Converter={StaticResource TextToColorConverter}}"/>
|
||||||
|
<TextBlock Text="{Binding GradientBGParam.Color2, NotifyOnTargetUpdated=True, Mode=OneWay}"
|
||||||
TargetUpdated="Color_TargetUpdated"
|
TargetUpdated="Color_TargetUpdated"
|
||||||
Width="65"
|
Width="65"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
@@ -95,7 +98,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
<hc:UniformSpacingPanel HorizontalAlignment="Center" Spacing="10" Grid.ColumnSpan="4">
|
||||||
<Button Content="系统预设"
|
<Button Content="系统预设"
|
||||||
Style="{StaticResource MyBtnStyle}"
|
Style="{StaticResource MyBtnStyle}"
|
||||||
Margin="0,5,0,0"
|
Margin="0,5,0,0"
|
||||||
@@ -105,6 +108,12 @@
|
|||||||
hc:Poptip.Placement="Top"
|
hc:Poptip.Placement="Top"
|
||||||
Click="SysBG_Click"
|
Click="SysBG_Click"
|
||||||
/>
|
/>
|
||||||
|
<Button Content="保存当前颜色到系统预设"
|
||||||
|
Style="{StaticResource MyBtnStyle}"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
Click="NewBGBtn_Click"
|
||||||
|
/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</hc:TransitioningContentControl>
|
</hc:TransitioningContentControl>
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
@@ -133,6 +142,10 @@
|
|||||||
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
|
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示主面板Logo" IsChecked="{Binding TitleLogoVisible, Mode=TwoWay, Converter={StaticResource Visibility2BooleanConverter}}"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
<hc:UniformSpacingPanel Spacing="10" Margin="5,10,0,0" Grid.ColumnSpan="4">
|
||||||
|
<CheckBox Style="{StaticResource MyCheckBoxStyle}" Content="显示图标标题" IsChecked="{Binding ShowIconTitle, Mode=TwoWay}"/>
|
||||||
|
</hc:UniformSpacingPanel>
|
||||||
|
|
||||||
|
|
||||||
<StackPanel Margin="0,15,0,0">
|
<StackPanel Margin="0,15,0,0">
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
@@ -216,6 +229,7 @@
|
|||||||
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
<hc:Divider LineStrokeDashArray="3,3" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||||
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
<hc:UniformSpacingPanel Spacing="10" Grid.ColumnSpan="4">
|
||||||
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
<TextBlock VerticalAlignment="Center" Text="图标字体颜色:" />
|
||||||
|
<Rectangle Width="10" Height="10" Stroke="White" Margin="0,0,0,5" Fill="{Binding Path=TextColor, Converter={StaticResource TextToColorConverter}}"/>
|
||||||
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
<TextBlock VerticalAlignment="Center" Text="{Binding TextColor}" Foreground="{Binding TextColor}" Width="100"/>
|
||||||
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
<Button Style="{StaticResource MyBtnStyle}" Content="选择" Margin="0,-10,0,0" Tag="Text" Click="ColorButton_Click"/>
|
||||||
</hc:UniformSpacingPanel>
|
</hc:UniformSpacingPanel>
|
||||||
|
|||||||
@@ -168,5 +168,15 @@ namespace GeekDesk.Control.UserControls.Config
|
|||||||
appConfig.IsShow = null;
|
appConfig.IsShow = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存当前颜色到系统预设
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void NewBGBtn_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
BGNmaeDialog dialog = new BGNmaeDialog();
|
||||||
|
dialog.dialog = HandyControl.Controls.Dialog.Show(dialog, "ConfigWindowDialog");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -463,6 +463,10 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
int index = MenuListBox.ItemContainerGenerator.IndexFromContainer(lbi);
|
int index = MenuListBox.ItemContainerGenerator.IndexFromContainer(lbi);
|
||||||
MenuListBox.SelectedIndex = index;
|
MenuListBox.SelectedIndex = index;
|
||||||
|
if (appData.AppConfig.IconBatch_NoWrite)
|
||||||
|
{
|
||||||
|
appData.AppConfig.IconBatch_NoWrite = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -487,6 +491,12 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
MenuInfo mi = lbi.DataContext as MenuInfo;
|
MenuInfo mi = lbi.DataContext as MenuInfo;
|
||||||
int index = MenuListBox.Items.IndexOf(mi);
|
int index = MenuListBox.Items.IndexOf(mi);
|
||||||
MenuListBox.SelectedIndex = index;
|
MenuListBox.SelectedIndex = index;
|
||||||
|
|
||||||
|
if (appData.AppConfig.IconBatch_NoWrite)
|
||||||
|
{
|
||||||
|
appData.AppConfig.IconBatch_NoWrite = false;
|
||||||
|
MainWindow.mainWindow.RightCard.IconListBox.SelectionMode = SelectionMode.Extended;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,9 @@
|
|||||||
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
<cvt:GetWidthByWWConvert x:Key="GetWidthByWWConvert"/>
|
||||||
<temp:SearchIconList x:Key="SearchIconList"/>
|
<temp:SearchIconList x:Key="SearchIconList"/>
|
||||||
<cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
|
<cvt:Boolean2VisibilityConverter x:Key="MyBoolean2VisibilityConverter"/>
|
||||||
|
<cvt:ValueConvert x:Key="ValueConvert"/>
|
||||||
|
<cst:RunTimeStatus x:Key="RunTimeStatus"/>
|
||||||
|
<cst:DictConst x:Key="DictConst"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<!--右侧栏-->
|
<!--右侧栏-->
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -150,6 +153,7 @@
|
|||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
<MenuItem x:Name="CardLockCM" Header="锁定主面板" Click="LockAppPanel"/>
|
||||||
<MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
|
<MenuItem x:Name="showTitle" Header="隐藏/显示标题" Click="ShowTitle_Click"/>
|
||||||
|
<MenuItem Header="{Binding AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}" Click="BatchHandle" Tag="{Binding}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</hc:Card.ContextMenu>
|
</hc:Card.ContextMenu>
|
||||||
<hc:DialogContainer>
|
<hc:DialogContainer>
|
||||||
@@ -171,6 +175,7 @@
|
|||||||
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
ItemsSource="{Binding AppConfig.SelectedMenuIcons, Mode=OneWay}"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
Padding="0,10,0,0"
|
Padding="0,10,0,0"
|
||||||
|
SelectionChanged="IconListBox_SelectionChanged"
|
||||||
ScrollViewer.CanContentScroll ="True"
|
ScrollViewer.CanContentScroll ="True"
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||||
VirtualizingPanel.IsVirtualizing="True"
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
@@ -225,7 +230,12 @@
|
|||||||
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
<MenuItem Header="添加系统项目" Click="AddSystemIcon"/>
|
||||||
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
<MenuItem Header="资源管理器菜单" Click="SystemContextMenu" Tag="{Binding}"/>
|
||||||
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
<MenuItem Header="属性" Click="PropertyConfig" Tag="{Binding}"/>
|
||||||
<MenuItem Header="从列表移除" Click="RemoveIcon" Tag="{Binding}"/>
|
<MenuItem Header="从列表移除"
|
||||||
|
Click="RemoveIcon"
|
||||||
|
Tag="{Binding}"/>
|
||||||
|
<!--MenuItem Header="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource ValueConvert}, ConverterParameter={x:Static cst:DictConst.batchMenuHeaderDict}}"
|
||||||
|
Click="BatchHandle"
|
||||||
|
Tag="{Binding}"/>-->
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</ListBox.Resources>
|
</ListBox.Resources>
|
||||||
|
|
||||||
@@ -249,7 +259,7 @@
|
|||||||
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
MouseLeftButtonDown="Icon_MouseLeftButtonDown"
|
||||||
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
MouseLeftButtonUp="Icon_MouseLeftButtonUp"
|
||||||
>
|
>
|
||||||
<CheckBox Margin="0,0,0,-20" HorizontalAlignment="Right"/>
|
<!--<CheckBox IsChecked="{Binding IsChecked_NoWrite}" Visibility="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}},Path=DataContext.AppConfig.IconBatch_NoWrite, Mode=OneWay, Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,0,-20" HorizontalAlignment="Right"/>-->
|
||||||
<!--<StackPanel Background="#00FFFFFF"
|
<!--<StackPanel Background="#00FFFFFF"
|
||||||
MouseEnter="CursorPanel_MouseEnter"
|
MouseEnter="CursorPanel_MouseEnter"
|
||||||
MouseLeave="CursorPanel_MouseLeave"
|
MouseLeave="CursorPanel_MouseLeave"
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ using GeekDesk.Util;
|
|||||||
using GeekDesk.ViewModel;
|
using GeekDesk.ViewModel;
|
||||||
using GeekDesk.ViewModel.Temp;
|
using GeekDesk.ViewModel.Temp;
|
||||||
using HandyControl.Controls;
|
using HandyControl.Controls;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
@@ -105,6 +107,11 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void Icon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (appData.AppConfig.IconBatch_NoWrite)
|
||||||
|
{
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (appData.AppConfig.DoubleOpen)
|
if (appData.AppConfig.DoubleOpen)
|
||||||
{
|
{
|
||||||
IconClick(sender, e);
|
IconClick(sender, e);
|
||||||
@@ -113,6 +120,18 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
|
|
||||||
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
private void Icon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
//Console.WriteLine("选中:" + IconListBox.SelectedItems.Count);
|
||||||
|
if (appData.AppConfig.IconBatch_NoWrite)
|
||||||
|
{
|
||||||
|
//查找checkbox更改选中状态
|
||||||
|
Panel p = sender as Panel;
|
||||||
|
var ens = p.Children.OfType<CheckBox>();
|
||||||
|
foreach (CheckBox cb in ens)
|
||||||
|
{
|
||||||
|
cb.IsChecked = !cb.IsChecked;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!appData.AppConfig.DoubleOpen)
|
if (!appData.AppConfig.DoubleOpen)
|
||||||
{
|
{
|
||||||
IconClick(sender, e);
|
IconClick(sender, e);
|
||||||
@@ -352,9 +371,14 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
Panel sp = sender as Panel;
|
Panel sp = sender as Panel;
|
||||||
|
|
||||||
DependencyObject dos = sp.Parent;
|
DependencyObject dos = sp.Parent;
|
||||||
|
Image img = null;
|
||||||
|
|
||||||
Image img = sp.Children[1] as Image;
|
foreach (var imgBak in sp.Children.OfType<Image>())
|
||||||
|
{
|
||||||
|
img = (Image)imgBak;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (img == null) return;
|
||||||
double afterHeight = img.Height;
|
double afterHeight = img.Height;
|
||||||
double afterWidth = img.Width;
|
double afterWidth = img.Width;
|
||||||
|
|
||||||
@@ -692,5 +716,30 @@ namespace GeekDesk.Control.UserControls.PannelCard
|
|||||||
{
|
{
|
||||||
appData.AppConfig.ShowIconTitle = !appData.AppConfig.ShowIconTitle;
|
appData.AppConfig.ShowIconTitle = !appData.AppConfig.ShowIconTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量操作
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="e"></param>
|
||||||
|
private void BatchHandle(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!appData.AppConfig.IconBatch_NoWrite)
|
||||||
|
{
|
||||||
|
//开启批量操作时把所有的状态更改为未选中
|
||||||
|
foreach(var ic in IconListBox.Items)
|
||||||
|
{
|
||||||
|
IconInfo info = ic as IconInfo;
|
||||||
|
info.IsChecked_NoWrite = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
appData.AppConfig.IconBatch_NoWrite = !appData.AppConfig.IconBatch_NoWrite;
|
||||||
|
IconListBox.SelectionMode = SelectionMode.Multiple;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IconListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
//Console.WriteLine(sender.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,13 @@
|
|||||||
>
|
>
|
||||||
|
|
||||||
<Grid Margin="30">
|
<Grid Margin="30">
|
||||||
|
|
||||||
<Grid.Effect>
|
<Grid.Effect>
|
||||||
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
<DropShadowEffect BlurRadius="20" Direction="-90" Color="Gray"
|
||||||
RenderingBias="Quality" ShadowDepth="2"/>
|
RenderingBias="Quality" ShadowDepth="2"/>
|
||||||
</Grid.Effect>
|
</Grid.Effect>
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="9999" hc:Growl.GrowlParent="False" hc:Growl.Token="ConfigWindowAskGrowl" Grid.Column="1" Grid.Row="1"/>
|
||||||
|
|
||||||
<Grid hc:Dialog.Token="ConfigWindowDialog">
|
<Grid hc:Dialog.Token="ConfigWindowDialog">
|
||||||
<hc:DialogContainer Margin="10">
|
<hc:DialogContainer Margin="10">
|
||||||
<Border Style="{StaticResource BorderBG}">
|
<Border Style="{StaticResource BorderBG}">
|
||||||
@@ -37,6 +40,7 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
|
||||||
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
<hc:Card Grid.Row="0" Grid.Column="0" Background="Transparent" BorderThickness="0">
|
||||||
|
|
||||||
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
<hc:SideMenu AutoSelect="True" Background="Transparent" Margin="1,7,0,3">
|
||||||
|
|||||||
30
Converts/TextToColorConverter.cs
Normal file
30
Converts/TextToColorConverter.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
internal class TextToColorConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
string str = value as string;
|
||||||
|
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
string str = value as string;
|
||||||
|
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Converts/ValueConvert.cs
Normal file
32
Converts/ValueConvert.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace GeekDesk.Converts
|
||||||
|
{
|
||||||
|
internal class ValueConvert : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool) {
|
||||||
|
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
|
||||||
|
bool val = (bool)value;
|
||||||
|
return dict[val];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool)
|
||||||
|
{
|
||||||
|
Dictionary<bool, string> dict = (Dictionary<bool, string>)parameter;
|
||||||
|
bool val = (bool)value;
|
||||||
|
return dict[val];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -168,6 +168,7 @@
|
|||||||
<Compile Include="Command\DelegateCommandBase.cs" />
|
<Compile Include="Command\DelegateCommandBase.cs" />
|
||||||
<Compile Include="Constant\AppHideType.cs" />
|
<Compile Include="Constant\AppHideType.cs" />
|
||||||
<Compile Include="Constant\Constants.cs" />
|
<Compile Include="Constant\Constants.cs" />
|
||||||
|
<Compile Include="Constant\DictConst.cs" />
|
||||||
<Compile Include="Constant\HotKeyType.cs" />
|
<Compile Include="Constant\HotKeyType.cs" />
|
||||||
<Compile Include="Constant\IconType.cs" />
|
<Compile Include="Constant\IconType.cs" />
|
||||||
<Compile Include="Constant\CommonEnum.cs" />
|
<Compile Include="Constant\CommonEnum.cs" />
|
||||||
@@ -193,6 +194,9 @@
|
|||||||
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
<Compile Include="Control\Other\GradientBGDialog.xaml.cs">
|
||||||
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
<DependentUpon>GradientBGDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Control\Other\BGNmaeDialog.xaml.cs">
|
||||||
|
<DependentUpon>BGNmaeDialog.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Control\Other\PasswordDialog.xaml.cs">
|
<Compile Include="Control\Other\PasswordDialog.xaml.cs">
|
||||||
<DependentUpon>PasswordDialog.xaml</DependentUpon>
|
<DependentUpon>PasswordDialog.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -259,6 +263,7 @@
|
|||||||
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
<Compile Include="Control\Windows\UpdateWindow.xaml.cs">
|
||||||
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
<DependentUpon>UpdateWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Converts\ValueConvert.cs" />
|
||||||
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
|
<Compile Include="Converts\CountGreZero2BoolConvert.cs" />
|
||||||
<Compile Include="Converts\Count2VisibleConvert.cs" />
|
<Compile Include="Converts\Count2VisibleConvert.cs" />
|
||||||
<Compile Include="Converts\GetWidthByWWConvert.cs" />
|
<Compile Include="Converts\GetWidthByWWConvert.cs" />
|
||||||
@@ -275,6 +280,7 @@
|
|||||||
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
<Compile Include="Converts\UpdateTypeConvert.cs" />
|
||||||
<Compile Include="Converts\ReverseBoolConvert.cs" />
|
<Compile Include="Converts\ReverseBoolConvert.cs" />
|
||||||
<Compile Include="Converts\Boolean2VisibilityConverter.cs" />
|
<Compile Include="Converts\Boolean2VisibilityConverter.cs" />
|
||||||
|
<Compile Include="Converts\TextToColorConverter.cs" />
|
||||||
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
<Compile Include="Converts\Visibility2BooleanConverter.cs" />
|
||||||
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||||
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
<Compile Include="CustomComponent\DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||||
@@ -299,6 +305,7 @@
|
|||||||
<Compile Include="Util\BGSettingUtil.cs" />
|
<Compile Include="Util\BGSettingUtil.cs" />
|
||||||
<Compile Include="Util\BlurGlassUtil.cs" />
|
<Compile Include="Util\BlurGlassUtil.cs" />
|
||||||
<Compile Include="Util\ColorUtil.cs" />
|
<Compile Include="Util\ColorUtil.cs" />
|
||||||
|
<Compile Include="Util\DeepCopyUtil.cs" />
|
||||||
<Compile Include="Util\DefaultIcons.cs" />
|
<Compile Include="Util\DefaultIcons.cs" />
|
||||||
<Compile Include="Util\DragAdorner.cs" />
|
<Compile Include="Util\DragAdorner.cs" />
|
||||||
<Compile Include="Util\FileWatcher.cs" />
|
<Compile Include="Util\FileWatcher.cs" />
|
||||||
@@ -365,6 +372,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Control\Other\BGNmaeDialog.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Include="Control\Other\PasswordDialog.xaml">
|
<Page Include="Control\Other\PasswordDialog.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -126,17 +126,17 @@ namespace ShowSeconds
|
|||||||
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
|
private void SecondsHookSetFuc(object sender, MouseEventExtArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
IntPtr taskBarWnd = WindowUtil.FindWindow("Shell_TrayWnd", null);
|
//IntPtr taskBarWnd = WindowUtil.FindWindow("Shell_TrayWnd", null);
|
||||||
IntPtr tray = WindowUtil.FindWindowEx(taskBarWnd, IntPtr.Zero, "TrayNotifyWnd", null);
|
//IntPtr tray = WindowUtil.FindWindowEx(taskBarWnd, IntPtr.Zero, "TrayNotifyWnd", null);
|
||||||
//IntPtr trayclock = WindowUtil.FindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null);
|
////IntPtr trayclock = WindowUtil.FindWindowEx(tray, IntPtr.Zero, "TrayClockWClass", null);
|
||||||
IntPtr trayclock = WindowUtil.GetForegroundWindow();
|
//IntPtr trayclock = WindowUtil.GetForegroundWindow();
|
||||||
StringBuilder title = new StringBuilder(256);
|
//StringBuilder title = new StringBuilder(256);
|
||||||
WindowUtil.GetWindowText(trayclock, title, title.Capacity);//得到窗口的标题
|
//WindowUtil.GetWindowText(trayclock, title, title.Capacity);//得到窗口的标题
|
||||||
Console.WriteLine(title.ToString());
|
////Console.WriteLine(title.ToString());
|
||||||
if (title.Equals("通知中心"))
|
//if (title.Equals("通知中心"))
|
||||||
{
|
//{
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
if (e.Button == System.Windows.Forms.MouseButtons.Left)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace GeekDesk.Task
|
|||||||
System.Timers.Timer timer = new System.Timers.Timer
|
System.Timers.Timer timer = new System.Timers.Timer
|
||||||
{
|
{
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
Interval = 60 * 1000 * 60, //60秒 * 60分钟
|
Interval = 60 * 1000 * 60, //60秒 * 60
|
||||||
//Interval = 6000,
|
//Interval = 6000,
|
||||||
};
|
};
|
||||||
timer.Start();
|
timer.Start();
|
||||||
@@ -45,7 +45,8 @@ namespace GeekDesk.Task
|
|||||||
if (dirInfo.Exists)
|
if (dirInfo.Exists)
|
||||||
{
|
{
|
||||||
// 获取文件信息并按创建时间倒序排序
|
// 获取文件信息并按创建时间倒序排序
|
||||||
FileInfo[] files = dirInfo.GetFiles();
|
FileInfo[] files = dirInfo.GetFiles()
|
||||||
|
.Where(f => f.Extension.Equals(".bak", StringComparison.OrdinalIgnoreCase)).ToArray();
|
||||||
if (files.Length > 0)
|
if (files.Length > 0)
|
||||||
{
|
{
|
||||||
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
|
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ namespace GeekDesk.Util
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
DirectoryInfo dirInfo = new DirectoryInfo(Constants.DATA_FILE_BAK_DIR_PATH);
|
DirectoryInfo dirInfo = new DirectoryInfo(Constants.DATA_FILE_BAK_DIR_PATH);
|
||||||
FileInfo[] files = dirInfo.GetFiles();
|
FileInfo[] files = dirInfo.GetFiles()
|
||||||
|
.Where(f => f.Extension.Equals(".bak", StringComparison.OrdinalIgnoreCase)).ToArray(); ;
|
||||||
if (files.Length > 0)
|
if (files.Length > 0)
|
||||||
{
|
{
|
||||||
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
|
FileInfo[] sortedFiles = files.OrderByDescending(file => file.CreationTime).ToArray();
|
||||||
|
|||||||
28
Util/DeepCopyUtil.cs
Normal file
28
Util/DeepCopyUtil.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.Serialization.Formatters.Binary;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace GeekDesk.Util
|
||||||
|
{
|
||||||
|
public static class DeepCopyUtil
|
||||||
|
{
|
||||||
|
// 使用序列化和反序列化实现深度拷贝
|
||||||
|
public static T DeepCopy<T>(T obj)
|
||||||
|
{
|
||||||
|
if (obj == null)
|
||||||
|
throw new ArgumentNullException(nameof(obj));
|
||||||
|
|
||||||
|
using (var memoryStream = new MemoryStream())
|
||||||
|
{
|
||||||
|
var formatter = new BinaryFormatter();
|
||||||
|
formatter.Serialize(memoryStream, obj); // 序列化
|
||||||
|
memoryStream.Seek(0, SeekOrigin.Begin);
|
||||||
|
return (T)formatter.Deserialize(memoryStream); // 反序列化
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -144,10 +144,10 @@ namespace GeekDesk.Util
|
|||||||
icon.Count++;
|
icon.Count++;
|
||||||
|
|
||||||
//隐藏搜索框
|
//隐藏搜索框
|
||||||
if (RunTimeStatus.SEARCH_BOX_SHOW)
|
//if (RunTimeStatus.SEARCH_BOX_SHOW)
|
||||||
{
|
//{
|
||||||
MainWindow.mainWindow.HidedSearchBox();
|
// MainWindow.mainWindow.HidedSearchBox();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private string customIconUrl; //自定义图标url
|
private string customIconUrl; //自定义图标url
|
||||||
private string customIconJsonUrl; //自定义图标json信息url
|
private string customIconJsonUrl; //自定义图标json信息url
|
||||||
|
|
||||||
private bool blurEffect = false; //毛玻璃效果 默认否
|
private bool blurEffect = true; //毛玻璃效果 默认是
|
||||||
private double blurValue;
|
private double blurValue;
|
||||||
|
|
||||||
private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
|
private UpdateType updateType = UpdateType.Gitee; //更新源 默认gitee源
|
||||||
@@ -74,7 +74,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
|
private int imageWidth = (int)CommonEnum.IMAGE_WIDTH; //图片宽度
|
||||||
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
|
private int imageHeight = (int)CommonEnum.IMAGE_HEIGHT; //图片高度
|
||||||
|
|
||||||
private bool mouseMiddleShow = false; //鼠标中键呼出 默认不启用
|
private bool mouseMiddleShow = true; //鼠标中键呼出 默认启用
|
||||||
|
|
||||||
private bool showBarIcon = true; //显示托盘图标 默认显示
|
private bool showBarIcon = true; //显示托盘图标 默认显示
|
||||||
|
|
||||||
@@ -111,12 +111,46 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private bool? showIconTitle = true; //是否显示iconTitle
|
private bool? showIconTitle = true; //是否显示iconTitle
|
||||||
|
|
||||||
|
private bool iconBatch = false; //批量操作图标状态
|
||||||
|
|
||||||
|
private ObservableCollection<GradientBGParam> customBGParams; //自定义纯色背景
|
||||||
|
|
||||||
|
|
||||||
|
public ObservableCollection<GradientBGParam> CustomBGParams
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (customBGParams == null)
|
||||||
|
{
|
||||||
|
customBGParams = new ObservableCollection<GradientBGParam>();
|
||||||
|
}
|
||||||
|
return customBGParams;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
customBGParams = value;
|
||||||
|
OnPropertyChanged("CustomBGParams");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IconBatch_NoWrite
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return iconBatch;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
iconBatch = value;
|
||||||
|
OnPropertyChanged("IconBatch_NoWrite");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool? ShowIconTitle
|
public bool? ShowIconTitle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (showIconTitle == null) showIconTitle = false;
|
if (showIconTitle == null) showIconTitle = true;
|
||||||
return showIconTitle;
|
return showIconTitle;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -306,7 +340,7 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
if (gradientBGParam == null)
|
if (gradientBGParam == null)
|
||||||
{
|
{
|
||||||
gradientBGParam = GradientBGParamList.GradientBGParams[0];
|
gradientBGParam = DeepCopyUtil.DeepCopy(GradientBGParamList.GradientBGParams[0]);
|
||||||
}
|
}
|
||||||
return gradientBGParam;
|
return gradientBGParam;
|
||||||
}
|
}
|
||||||
@@ -690,6 +724,14 @@ namespace GeekDesk.ViewModel
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (blurEffect)
|
||||||
|
{
|
||||||
|
BlurValue = 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BlurValue = 0;
|
||||||
|
}
|
||||||
return blurValue;
|
return blurValue;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -1035,8 +1077,11 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
if (propertyName != null && !propertyName.Contains("NoWrite"))
|
||||||
|
{
|
||||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ namespace GeekDesk.ViewModel
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class GradientBGParam : INotifyPropertyChanged
|
public class GradientBGParam : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
private string id;
|
||||||
|
|
||||||
private string color1;
|
private string color1;
|
||||||
|
|
||||||
private string color2;
|
private string color2;
|
||||||
@@ -16,14 +18,26 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
public GradientBGParam() { }
|
public GradientBGParam() { }
|
||||||
|
|
||||||
public GradientBGParam(string name, string color1, string color2)
|
public GradientBGParam(string id, string name, string color1, string color2)
|
||||||
{
|
{
|
||||||
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.color1 = color1;
|
this.color1 = color1;
|
||||||
this.color2 = color2;
|
this.color2 = color2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Id
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
id = value;
|
||||||
|
OnPropertyChanged("Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string Color1
|
public string Color1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -28,6 +28,21 @@ namespace GeekDesk.ViewModel
|
|||||||
|
|
||||||
private IconType iconType = IconType.OTHER;
|
private IconType iconType = IconType.OTHER;
|
||||||
|
|
||||||
|
private bool isChecked = false; //是否选中
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsChecked_NoWrite
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return isChecked;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
isChecked = value;
|
||||||
|
OnPropertyChanged("IsChecked_NoWrite");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string RelativePath_NoWrite
|
public string RelativePath_NoWrite
|
||||||
{
|
{
|
||||||
@@ -347,7 +362,7 @@ namespace GeekDesk.ViewModel
|
|||||||
private void OnPropertyChanged(string propertyName)
|
private void OnPropertyChanged(string propertyName)
|
||||||
{
|
{
|
||||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
if (propertyName!=null && propertyName.Contains("NoWrite"))
|
if (propertyName!=null && !propertyName.Contains("NoWrite"))
|
||||||
{
|
{
|
||||||
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
CommonCode.SaveAppData(MainWindow.appData, Constants.DATA_FILE_PATH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ namespace GeekDesk.ViewModel.Temp
|
|||||||
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
|
//gradientBGParams = (ObservableCollection<GradientBGParam>)ConfigurationManager.GetSection("SystemBGs")
|
||||||
gradientBGParams = new ObservableCollection<GradientBGParam>
|
gradientBGParams = new ObservableCollection<GradientBGParam>
|
||||||
{
|
{
|
||||||
new GradientBGParam("魅惑妖术", "#EE9CA7", "#FFDDE1"),
|
new GradientBGParam("1E7BFD15-92CE-1332-F583-94E1C39729FF", "魅惑妖术", "#EE9CA7", "#FFDDE1"),
|
||||||
new GradientBGParam ("森林之友", "#EBF7E3", "#A8E4C0"),
|
new GradientBGParam ("F54F9B03-8F50-8FFB-54C6-1BCCA03BF0F8", "森林之友", "#EBF7E3", "#A8E4C0"),
|
||||||
new GradientBGParam("完美谢幕", "#D76D77", "#FFAF7B")
|
new GradientBGParam("36C16080-0516-0DAC-FE09-721CC6AB57A4", "完美谢幕", "#D76D77", "#FFAF7B")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user