修复bug 删除单独保存代码
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<hc:Window x:Class="GeekDesk.Control.ConfigDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="450"
|
||||
Width="800"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Opacity="0.9"
|
||||
>
|
||||
<hc:Window.Background>
|
||||
<SolidColorBrush Color="AliceBlue" Opacity="0.9"/>
|
||||
</hc:Window.Background>
|
||||
|
||||
<Grid>
|
||||
<hc:SideMenu BorderThickness="1" Width="200" Margin="32">
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="SelectionChanged">
|
||||
<hc:EventToCommand Command="{Binding SwitchItemCmd}" PassEventArgsToCommand="True" />
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
|
||||
<hc:SideMenuItem Header="Work Items">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<TextBlock Text="" Style="{StaticResource TextBlockFabricIcons}"/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</Grid>
|
||||
|
||||
</hc:Window>
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
namespace GeekDesk.Control
|
||||
{
|
||||
/// <summary>
|
||||
/// ConfigDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ConfigDialog
|
||||
{
|
||||
public ConfigDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Control/ConfigWindow.xaml
Normal file
64
Control/ConfigWindow.xaml
Normal file
@@ -0,0 +1,64 @@
|
||||
<hc:Window x:Class="GeekDesk.Control.ConfigWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Height="450"
|
||||
Width="600"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
Background="Transparent"
|
||||
>
|
||||
<Border CornerRadius="8" BorderThickness="0" Background="White" Opacity="0.9">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<hc:Card Grid.Row="0" Grid.Column="0">
|
||||
<hc:SideMenu BorderThickness="1" AutoSelect="True" Header="WorkItems" BorderBrush="#FF958F8F">
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="SelectionChanged">
|
||||
<hc:EventToCommand Command="{Binding SwitchItemCmd}" PassEventArgsToCommand="True" />
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
<hc:SideMenuItem Header="Work Items" Background="#FFD1C8C8">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
<hc:SideMenuItem Header="Work Items2">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
hc:IconElement.Geometry="M828.770654 148.714771C641.293737-20.89959 354.184117-19.590868 168.245698 152.630946c-212.062907 196.418185-212.062907 522.329912 0 718.748098 185.93842 172.221815 473.048039 173.520546 660.524956 3.916176 219.435707-198.536117 219.435707-528.054322 0-726.580449z m-121.880976 569.643707c-11.708566 11.708566-30.680039 11.708566-42.388605 0L502.729054 556.586459c-0.659356-0.659356-1.728312-0.659356-2.397659 0L338.609327 718.318517c-11.708566 11.708566-30.680039 11.708566-42.388605 0l-0.039961-0.039961c-11.708566-11.708566-11.708566-30.680039 0-42.388605l161.732059-161.732058c0.659356-0.659356 0.659356-1.728312 0-2.397659L296.1408 350.008195c-11.708566-11.708566-11.708566-30.680039 0-42.388605l0.039961-0.039961c11.708566-11.708566 30.680039-11.708566 42.388605 0l161.772019 161.77202c0.659356 0.659356 1.728312 0.659356 2.397659 0L664.551024 307.539668c11.708566-11.708566 30.680039-11.708566 42.388605 0l0.039961 0.039961c11.708566 11.708566 11.708566 30.680039 0 42.388605L545.15762 511.770224c-0.659356 0.659356-0.659356 1.728312 0 2.397659L706.919649 675.939902c11.708566 11.708566 11.708566 30.680039 0 42.388605l-0.029971 0.029971z"
|
||||
hc:IconElement.Height="18"
|
||||
hc:IconElement.Width="18"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
</hc:SideMenuItem.Icon>
|
||||
</hc:SideMenuItem>
|
||||
</hc:SideMenu>
|
||||
</hc:Card>
|
||||
|
||||
<hc:Card x:Name="LeftCard" Grid.Row="0" Grid.Column="1">
|
||||
</hc:Card>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</hc:Window>
|
||||
25
Control/ConfigWindow.xaml.cs
Normal file
25
Control/ConfigWindow.xaml.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using GeekDesk.Control.UserControls;
|
||||
using GeekDesk.ViewModel;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using System;
|
||||
|
||||
namespace GeekDesk.Control
|
||||
{
|
||||
/// <summary>
|
||||
/// ConfigDialog.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class ConfigWindow
|
||||
{
|
||||
public ConfigWindow(AppConfig appConfig)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.DataContext = appConfig;
|
||||
LeftCard.Content = new SettingControl();
|
||||
this.Topmost = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
46
Control/UserControls/SettingControl.xaml
Normal file
46
Control/UserControls/SettingControl.xaml
Normal file
@@ -0,0 +1,46 @@
|
||||
<UserControl x:Class="GeekDesk.Control.UserControls.SettingControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:GeekDesk.Control.UserControls"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
Background="AliceBlue"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<hc:SimplePanel Margin="10" DataContextChanged="SimplePanel_DataContextChanged">
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="0,0,0,10" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="主面板设置" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,26.394,0,-16.394" Grid.ColumnSpan="4">
|
||||
<CheckBox x:Name="IconIsAdmin" Content="启动时显示主面板" IsChecked="{Binding StartedShowPanel}">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,50,0,-102.337" Grid.ColumnSpan="4">
|
||||
<CheckBox Content="显示时追随鼠标位置" IsChecked="{Binding FollowMouse}" Unchecked="CheckBox_Unchecked">
|
||||
<CheckBox.Background>
|
||||
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
|
||||
<GradientStop Color="#FF9EA3A6"/>
|
||||
</LinearGradientBrush>
|
||||
</CheckBox.Background>
|
||||
</CheckBox>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="30,89.49,-30,-79.49" Grid.ColumnSpan="4">
|
||||
<TextBlock Text="面板关闭方式" VerticalAlignment="Center"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
<hc:UniformSpacingPanel Spacing="10" Margin="40,115.004,-10,-102.337" Grid.ColumnSpan="4">
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="运行项目后" IsChecked="True"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="失去焦点后"/>
|
||||
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}" Style="{StaticResource RadioButtonIcon}" Content="手动关闭"/>
|
||||
</hc:UniformSpacingPanel>
|
||||
|
||||
<hc:Divider LineStrokeDashArray="3,3" Margin="10,242.735,-10,-91.735" LineStroke="Black" Grid.ColumnSpan="4"/>
|
||||
|
||||
</hc:SimplePanel>
|
||||
</UserControl>
|
||||
39
Control/UserControls/SettingControl.xaml.cs
Normal file
39
Control/UserControls/SettingControl.xaml.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace GeekDesk.Control.UserControls
|
||||
{
|
||||
/// <summary>
|
||||
/// SettingControl.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class SettingControl : UserControl
|
||||
{
|
||||
public SettingControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void SimplePanel_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,15 @@
|
||||
<Reference Include="CommonServiceLocator, Version=2.0.6.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
|
||||
<HintPath>packages\CommonServiceLocator.2.0.6\lib\net45\CommonServiceLocator.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.4.1.0, Culture=neutral, PublicKeyToken=e7570ab207bcb616, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.4.1.0, Culture=neutral, PublicKeyToken=669f0b5e8f868abf, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Platform, Version=5.4.1.0, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HandyControl, Version=3.1.0.0, Culture=neutral, PublicKeyToken=45be8712787a1e5b, processorArchitecture=MSIL">
|
||||
<HintPath>packages\HandyControl.3.1.0\lib\net452\HandyControl.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -50,6 +59,9 @@
|
||||
<Reference Include="System.Drawing.Common, Version=4.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>packages\System.Drawing.Common.6.0.0-preview.3.21201.4\lib\net461\System.Drawing.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>packages\MvvmLightLibs.5.4.1.1\lib\net45\System.Windows.Interactivity.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -76,12 +88,15 @@
|
||||
<Compile Include="Constant\DefaultConstant.cs" />
|
||||
<Compile Include="Constant\IconStartType.cs" />
|
||||
<Compile Include="Constant\SortType.cs" />
|
||||
<Compile Include="Control\ConfigDialog.xaml.cs">
|
||||
<DependentUpon>ConfigDialog.xaml</DependentUpon>
|
||||
<Compile Include="Control\ConfigWindow.xaml.cs">
|
||||
<DependentUpon>ConfigWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\IconInfoDialog.xaml.cs">
|
||||
<DependentUpon>IconInfoDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Control\UserControls\SettingControl.xaml.cs">
|
||||
<DependentUpon>SettingControl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.cs" />
|
||||
<Compile Include="DraggAnimatedPanel\DraggAnimatedPanel.Drag.cs" />
|
||||
<Compile Include="EditTextBlock\EditableTextBlock.cs" />
|
||||
@@ -102,7 +117,7 @@
|
||||
<Compile Include="ViewModel\AppData.cs" />
|
||||
<Compile Include="ViewModel\IconInfo.cs" />
|
||||
<Compile Include="ViewModel\MenuInfo.cs" />
|
||||
<Page Include="Control\ConfigDialog.xaml">
|
||||
<Page Include="Control\ConfigWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
@@ -110,6 +125,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Control\UserControls\SettingControl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</MultiTrigger.EnterActions>
|
||||
<MultiTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard Timeline.DesiredFrameRate="30">
|
||||
<Storyboard Timeline.DesiredFrameRate="60">
|
||||
<DoubleAnimation To="18" Duration="0:0:0.001" Storyboard.TargetProperty="FontSize"/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
@@ -97,7 +97,7 @@
|
||||
</Window.Resources>
|
||||
|
||||
|
||||
<Border CornerRadius="5" BorderThickness="0" Background="White">
|
||||
<Border CornerRadius="5" BorderThickness="0" Background="White" LostFocus="App_LostFocus">
|
||||
<Border CornerRadius="5" BorderThickness="0">
|
||||
<!--背景图片-->
|
||||
<Border.Background>
|
||||
@@ -143,11 +143,11 @@
|
||||
Initialized="SettingButton_Initialized"
|
||||
x:Name="SettingButton"
|
||||
>
|
||||
<Button.ContextMenu>
|
||||
<!--<Button.ContextMenu>
|
||||
<ContextMenu Width="200" x:Name="SettingMenu">
|
||||
<MenuItem Header="设置" Click="ConfigApp"/>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button.ContextMenu>-->
|
||||
</Button>
|
||||
<Button Background="Transparent"
|
||||
BorderThickness="0"
|
||||
@@ -180,11 +180,10 @@
|
||||
</hc:Card.ContextMenu>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<ListBox x:Name="menus"
|
||||
ItemsSource="{Binding MenuList}"
|
||||
BorderThickness="0" Foreground="{x:Null}"
|
||||
>
|
||||
|
||||
|
||||
ItemsSource="{Binding MenuList}"
|
||||
BorderThickness="0" Foreground="{x:Null}"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="menuDialog" Width="200">
|
||||
<MenuItem Header="新建菜单" Click="CreateMenu"/>
|
||||
@@ -262,9 +261,10 @@
|
||||
</hc:Card.BorderBrush>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<ListBox x:Name="icons" ItemsSource="{Binding}"
|
||||
BorderThickness="0"
|
||||
SelectionChanged="IconSelectionChanged"
|
||||
>
|
||||
BorderThickness="0"
|
||||
SelectionChanged="IconSelectionChanged"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling"
|
||||
>
|
||||
<ListBox.Background>
|
||||
<SolidColorBrush Opacity="0"/>
|
||||
</ListBox.Background>
|
||||
|
||||
@@ -26,20 +26,21 @@ namespace GeekDesk
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
loadData();
|
||||
LoadData();
|
||||
this.Topmost = true;
|
||||
this.Loaded += Window_Loaded;
|
||||
this.SizeChanged += MainWindow_Resize;
|
||||
this.Topmost = true;
|
||||
}
|
||||
|
||||
private void loadData()
|
||||
private void LoadData()
|
||||
{
|
||||
this.DataContext = appData;
|
||||
if (appData.MenuList.Count == 0)
|
||||
{
|
||||
appData.MenuList.Add(new MenuInfo() { MenuName = "NewMenu", MenuId = System.Guid.NewGuid().ToString(), MenuEdit = Visibility.Collapsed});
|
||||
}
|
||||
this.Visibility = appData.AppConfig.StartedShowPanel;
|
||||
|
||||
|
||||
//窗体大小
|
||||
LeftColumn.Width = new GridLength(appData.AppConfig.MenuCardWidth);
|
||||
this.Width = appData.AppConfig.WindowWidth;
|
||||
@@ -69,7 +70,6 @@ namespace GeekDesk
|
||||
|
||||
iconList.Remove(dragged);
|
||||
iconList.Insert(to, dragged);
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
);
|
||||
return _swap;
|
||||
@@ -94,7 +94,6 @@ namespace GeekDesk
|
||||
menuList.Insert(to, dragged);
|
||||
menus.SelectedIndex = to;
|
||||
appData.MenuList = menuList;
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
);
|
||||
return _swap2;
|
||||
@@ -120,7 +119,6 @@ namespace GeekDesk
|
||||
iconInfo.Name = Path.GetFileNameWithoutExtension(path);
|
||||
appData.MenuList[menus.SelectedIndex].IconList.Add(iconInfo);
|
||||
}
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +129,6 @@ namespace GeekDesk
|
||||
MenuInfo mi = (MenuInfo)(((StackPanel)sender).Tag);
|
||||
icons.ItemsSource = mi.IconList;
|
||||
appData.AppConfig.SelectedMenuIndex = menus.Items.IndexOf(mi);
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
|
||||
@@ -197,10 +194,16 @@ namespace GeekDesk
|
||||
p.StartInfo.CreateNoWindow = false; //设置显示窗口
|
||||
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动进程
|
||||
p.StartInfo.ErrorDialog = false;
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
break;// c#好像不能case穿透
|
||||
case IconStartType.DEFAULT_STARTUP:
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
if (appData.AppConfig.AppHideType == AppHideType.START_EXE)
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
break;
|
||||
case IconStartType.SHOW_IN_EXPLORE:
|
||||
p.StartInfo.FileName = "Explorer.exe";
|
||||
@@ -209,14 +212,11 @@ namespace GeekDesk
|
||||
}
|
||||
p.Start();
|
||||
icon.Count++;
|
||||
CommonCode.SaveAppData(appData);
|
||||
} catch (Exception)
|
||||
{
|
||||
HandyControl.Controls.Growl.WarningGlobal("程序启动失败(不支持的启动方式)!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -231,12 +231,16 @@ namespace GeekDesk
|
||||
|
||||
void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!appData.AppConfig.StartedShowPanel)
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
//加载完毕注册热键
|
||||
Hotkey.Regist(this, HotkeyModifiers.MOD_CONTROL, Key.Y, ()=>
|
||||
{
|
||||
if (this.Visibility == Visibility.Collapsed)
|
||||
{
|
||||
ShowAppAndFollowMouse();
|
||||
ShowApp();
|
||||
} else
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
@@ -252,7 +256,6 @@ namespace GeekDesk
|
||||
AppData appData = this.DataContext as AppData;
|
||||
appData.AppConfig.WindowWidth = this.Width;
|
||||
appData.AppConfig.WindowHeight = this.Height;
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +269,6 @@ namespace GeekDesk
|
||||
{
|
||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||
appData.MenuList.Remove(menuInfo);
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
private void DragMove(object sender, MouseEventArgs e)
|
||||
@@ -310,7 +312,6 @@ namespace GeekDesk
|
||||
{
|
||||
MenuInfo menuInfo = ((MenuItem)sender).Tag as MenuInfo;
|
||||
menuInfo.MenuEdit = (int)Visibility.Visible;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -339,7 +340,6 @@ namespace GeekDesk
|
||||
string text = menuBox.Text;
|
||||
menuInfo.MenuName = text;
|
||||
menuInfo.MenuEdit = Visibility.Collapsed;
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,10 +387,12 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void CreateMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
appData.MenuList.Add(new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" });
|
||||
MenuInfo info = new MenuInfo() { MenuEdit = Visibility.Collapsed, MenuId = System.Guid.NewGuid().ToString(), MenuName = "NewMenu" };
|
||||
appData.MenuList.Add(info);
|
||||
menus.Items.Refresh();
|
||||
menus.SelectedIndex = appData.MenuList.Count - 1;
|
||||
//appData.MenuList[appData.MenuList.Count - 1].MenuEdit = (int)Visibility.Visible;
|
||||
CommonCode.SaveAppData(appData);
|
||||
appData.AppConfig.SelectedMenuIndex = menus.SelectedIndex;
|
||||
icons.ItemsSource = info.IconList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -423,7 +425,6 @@ namespace GeekDesk
|
||||
private void RemoveIcon(object sender, RoutedEventArgs e)
|
||||
{
|
||||
appData.MenuList[menus.SelectedIndex].IconList.Remove((IconInfo)((MenuItem)sender).Tag);
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -434,7 +435,6 @@ namespace GeekDesk
|
||||
private void LeftCardResize(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
|
||||
{
|
||||
appData.AppConfig.MenuCardWidth = LeftColumn.Width.Value;
|
||||
CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -493,8 +493,13 @@ namespace GeekDesk
|
||||
}
|
||||
private void ShowApp()
|
||||
{
|
||||
this.Visibility = Visibility.Visible;
|
||||
ShowAppAndFollowMouse();
|
||||
if (appData.AppConfig.FollowMouse)
|
||||
{
|
||||
ShowAppAndFollowMouse();
|
||||
} else
|
||||
{
|
||||
this.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -526,7 +531,7 @@ namespace GeekDesk
|
||||
|
||||
|
||||
|
||||
CommonCode.SaveAppData(appData);
|
||||
//CommonCode.SaveAppData(appData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -551,7 +556,8 @@ namespace GeekDesk
|
||||
/// <param name="e"></param>
|
||||
private void ConfigButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SettingMenu.IsOpen = true;
|
||||
//SettingMenu.IsOpen = true;
|
||||
new ConfigWindow(appData.AppConfig).Show();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -563,6 +569,14 @@ namespace GeekDesk
|
||||
{
|
||||
SettingButton.ContextMenu = null;
|
||||
}
|
||||
|
||||
private void App_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (appData.AppConfig.AppHideType == AppHideType.LOST_FOCUS)
|
||||
{
|
||||
this.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
using GeekDesk.Constant;
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
@@ -22,12 +23,12 @@ namespace GeekDesk.ViewModel
|
||||
private bool followMouse = true; //面板跟随鼠标 默认是
|
||||
private Visibility configIconVisible = Visibility.Visible; // 设置按钮是否显示
|
||||
private AppHideType appHideType = AppHideType.START_EXE; //面板关闭方式 (默认启动程序后)
|
||||
private Visibility startedShowPanel = Visibility.Visible; //启动时是否显示主面板 默认显示
|
||||
private bool startedShowPanel = true; //启动时是否显示主面板 默认显示
|
||||
|
||||
|
||||
#region GetSet
|
||||
|
||||
public Visibility StartedShowPanel
|
||||
public bool StartedShowPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -163,6 +164,7 @@ namespace GeekDesk.ViewModel
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
@@ -46,6 +47,7 @@ namespace GeekDesk.ViewModel
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ namespace GeekDesk.ViewModel
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using GeekDesk.Util;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
@@ -26,7 +27,7 @@ namespace GeekDesk.ViewModel
|
||||
set
|
||||
{
|
||||
menuName = value;
|
||||
OnPropertyChanged("MenuName");
|
||||
OnPropertyChanged("MenuName");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ namespace GeekDesk.ViewModel
|
||||
private void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
CommonCode.SaveAppData(MainWindow.appData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
<packages>
|
||||
<package id="CommonServiceLocator" version="2.0.6" targetFramework="net452" requireReinstallation="true" />
|
||||
<package id="HandyControl" version="3.1.0" targetFramework="net452" requireReinstallation="true" />
|
||||
<package id="MvvmLightLibs" version="5.4.1.1" targetFramework="net472" />
|
||||
<package id="System.Drawing.Common" version="6.0.0-preview.3.21201.4" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user