添加开机自启动

This commit is contained in:
liufei
2021-07-21 11:15:51 +08:00
parent 7bab664283
commit 81f3ad0fdc
12 changed files with 251 additions and 88 deletions

View File

@@ -25,7 +25,7 @@
Command="hc:ControlCommands.OpenLink"
CommandParameter="https://github.com/Demo-Liu/GeekDesk"
Margin="0,0,10,0" Color="#24292F"/>
<hc:Shield Subject="码云" Status="Demo-liu"
<hc:Shield Subject="Gitee" Status="Demo-liu"
Command="hc:ControlCommands.OpenLink"
CommandParameter=""
Margin="0,5,10,0" Color="#C71D23"/>
@@ -63,7 +63,7 @@
</hc:UniformSpacingPanel>
<TextBlock Margin="0,20,0,0" FontSize="13" Width="200" TextAlignment="Center" Text="这是个人开发的程序,所有人可任意修改和免费使用(商用请联系作者)" TextWrapping="Wrap"/>
<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
<!--<hc:UniformSpacingPanel Spacing="10" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,10,0,0">
<TextBlock Text="更新源:" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
@@ -71,7 +71,7 @@
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
</hc:UniformSpacingPanel>-->
</StackPanel>
</hc:SimplePanel>

View File

@@ -0,0 +1,45 @@
<UserControl x:Class="GeekDesk.Control.UserControls.Config.OtherControl"
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:cvt="clr-namespace:GeekDesk.Converts"
xmlns:local="clr-namespace:GeekDesk.Control.UserControls.PannelCard"
xmlns:hc="https://handyorg.github.io/handycontrol"
mc:Ignorable="d"
Background="AliceBlue"
d:DesignHeight="400" d:DesignWidth="500"
>
<UserControl.Resources>
<cvt:UpdateTypeConvert x:Key="UpdateTypeConvert"/>
</UserControl.Resources>
<hc:SimplePanel Margin="20">
<StackPanel >
<TextBlock Text="程序设置" />
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
<CheckBox x:Name="SelfStartUpBox" Content="开机自启动" IsChecked="{Binding SelfStartUp}" Click="SelfStartUpBox_Click">
<CheckBox.Background>
<LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
<GradientStop Color="#FF9EA3A6"/>
</LinearGradientBrush>
</CheckBox.Background>
</CheckBox>
</hc:UniformSpacingPanel>
<TextBlock Text="更新源" Margin="0,20,0,0"/>
<hc:UniformSpacingPanel Spacing="10" Margin="20,5,0,0">
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
Style="{StaticResource RadioButtonIcon}" Content="Gitee"
hc:IconElement.Geometry="{StaticResource Gitee}"
Foreground="#B32225"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=1}"/>
<RadioButton Margin="10,0,0,0" Background="{DynamicResource SecondaryRegionBrush}"
hc:IconElement.Geometry="{StaticResource GitHub}"
Style="{StaticResource RadioButtonIcon}" Content="GitHub"
Foreground="Black"
IsChecked="{Binding UpdateType, Mode=TwoWay, Converter={StaticResource UpdateTypeConvert}, ConverterParameter=2}"/>
</hc:UniformSpacingPanel>
</StackPanel>
</hc:SimplePanel>
</UserControl>

View File

@@ -0,0 +1,37 @@
using GeekDesk.Constant;
using GeekDesk.Util;
using GeekDesk.ViewModel;
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.Config
{
/// <summary>
/// OtherControl.xaml 的交互逻辑
/// </summary>
public partial class OtherControl : UserControl
{
public OtherControl()
{
InitializeComponent();
}
private void SelfStartUpBox_Click(object sender, RoutedEventArgs e)
{
AppConfig appConfig = MainWindow.appData.AppConfig;
RegisterUtil.SetSelfStarting(appConfig.SelfStartUp, Constants.MY_NAME);
}
}
}

View File

@@ -103,6 +103,21 @@
/>
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
<hc:SideMenuItem Header="其它"
Tag="Other"
Selected="MemuClick">
<hc:SideMenuItem.Icon>
<Button Background="Transparent"
IsEnabled="False"
Opacity="1"
BorderThickness="0"
hc:IconElement.Geometry="{StaticResource Other}"
hc:IconElement.Height="18"
hc:IconElement.Width="18"
HorizontalAlignment="Right"
/>
</hc:SideMenuItem.Icon>
</hc:SideMenuItem>
</hc:SideMenu>
</hc:Card>
<hc:ScrollViewer Grid.Row="0" Grid.Column="1">

View File

@@ -18,6 +18,7 @@ namespace GeekDesk.Control.Windows
private static AboutControl about = new AboutControl();
private static ThemeControl theme = new ThemeControl();
private static MotionControl motion = new MotionControl();
private static OtherControl other = new OtherControl();
public MainWindow mainWindow;
private ConfigWindow(AppConfig appConfig, MainWindow mainWindow)
@@ -64,6 +65,9 @@ namespace GeekDesk.Control.Windows
case "Theme":
RightCard.Content = theme;
break;
case "Other":
RightCard.Content = other;
break;
default:
RightCard.Content = about;
break;