修复bug 删除单独保存代码

This commit is contained in:
liufei
2021-05-20 17:33:49 +08:00
parent 4701ecc781
commit 13e5ca9794
14 changed files with 262 additions and 96 deletions

View File

@@ -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="&#xf314;" Style="{StaticResource TextBlockFabricIcons}"/>
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
</hc:SideMenu>
</Grid>
</hc:Window>

View File

@@ -1,14 +0,0 @@

namespace GeekDesk.Control
{
/// <summary>
/// ConfigDialog.xaml 的交互逻辑
/// </summary>
public partial class ConfigDialog
{
public ConfigDialog()
{
InitializeComponent();
}
}
}

64
Control/ConfigWindow.xaml Normal file
View 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>

View 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;
}
}
}

View 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>

View 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)
{
}
}
}