Fix HideOnstartup Checkbox

This commit is contained in:
DB p 2021-12-02 15:14:48 +09:00
parent 0cf7fa7c17
commit 0982198bc3
2 changed files with 61 additions and 48 deletions

View file

@ -1,15 +1,16 @@
<Page x:Class="Flow.Launcher.Resources.Pages.WelcomePage5" <Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Class="Flow.Launcher.Resources.Pages.WelcomePage5"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="WelcomePage5" xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure"
d:DesignHeight="450" Title="WelcomePage5"
d:DesignWidth="800" d:DesignHeight="450"
DataContext="{Binding RelativeSource={RelativeSource Self}}" d:DesignWidth="800"
mc:Ignorable="d"> DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Page.Resources> <Page.Resources>
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}"> <Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
<Setter Property="Opacity" Value="0" /> <Setter Property="Opacity" Value="0" />
@ -20,7 +21,10 @@
<BeginStoryboard> <BeginStoryboard>
<BeginStoryboard.Storyboard> <BeginStoryboard.Storyboard>
<Storyboard x:Name="FadeIn"> <Storyboard x:Name="FadeIn">
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:2"> <DoubleAnimation
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:2">
<DoubleAnimation.EasingFunction> <DoubleAnimation.EasingFunction>
<QuadraticEase EasingMode="EaseOut" /> <QuadraticEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction> </DoubleAnimation.EasingFunction>
@ -51,46 +55,49 @@
</Border.Background> </Border.Background>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal"> <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Image Name="Logo" <Image
Width="90" Name="Logo"
Height="90" Width="90"
Source="../../images/app.png" Height="90"
Style="{DynamicResource StyleImageFadeIn}" /> Source="../../images/app.png"
Style="{DynamicResource StyleImageFadeIn}" />
</StackPanel> </StackPanel>
</Border> </Border>
<StackPanel Grid.Row="1" Margin="24,20,24,20"> <StackPanel Grid.Row="1" Margin="24,20,24,20">
<StackPanel> <StackPanel>
<TextBlock FontSize="20" FontWeight="SemiBold" Text="{DynamicResource Welcome_Page5_Title}" /> <TextBlock
<TextBlock Margin="0,10,0,0" FontSize="20"
FontSize="14" FontWeight="SemiBold"
Text="{DynamicResource Welcome_Page5_Text01}" Text="{DynamicResource Welcome_Page5_Title}" />
TextWrapping="WrapWithOverflow" /> <TextBlock
Margin="0,10,0,0"
FontSize="14"
Text="{DynamicResource Welcome_Page5_Text01}"
TextWrapping="WrapWithOverflow" />
<StackPanel Margin="0,30,0,0" Orientation="Horizontal"> <StackPanel Margin="0,30,0,0" Orientation="Horizontal">
<CheckBox IsChecked="{Binding Settings.HideOnStartup}" Style="{DynamicResource DefaultCheckBoxStyle}" /> <CheckBox
<TextBlock Margin="0,5,0,0" Checked="OnAutoStartupChecked"
FontSize="14" Content="{DynamicResource startFlowLauncherOnSystemStartup}"
FontWeight="SemiBold" IsChecked="{Binding Settings.StartFlowLauncherOnSystemStartup}"
Text="{DynamicResource hideOnStartup}" /> Style="{DynamicResource DefaultCheckBoxStyle}"
Unchecked="OnAutoStartupUncheck" />
</StackPanel> </StackPanel>
<StackPanel Margin="0,0,0,0" Orientation="Horizontal"> <StackPanel Margin="0,0,0,0" Orientation="Horizontal">
<CheckBox Checked="OnAutoStartupChecked" <CheckBox
IsChecked="{Binding Settings.StartFlowLauncherOnSystemStartup}" Checked="OnHideOnStartupChecked"
Style="{DynamicResource DefaultCheckBoxStyle}" Content="{DynamicResource hideOnStartup}"
Unchecked="OnAutoStartupUncheck" /> IsChecked="{Binding Settings.HideOnStartup}"
<TextBlock Margin="0,5,0,0" Style="{DynamicResource DefaultCheckBoxStyle}"
FontSize="14" Unchecked="OnHideOnStartupUnchecked" />
FontWeight="SemiBold"
Text="{DynamicResource startFlowLauncherOnSystemStartup}" />
</StackPanel> </StackPanel>
<Button Width="150" <Button
Height="40" Width="150"
Margin="0,60,0,0" Height="40"
HorizontalAlignment="Right" Margin="0,60,0,0"
Content="{DynamicResource done}" HorizontalAlignment="Right"
Style="{DynamicResource AccentButtonStyle}" /> Content="{DynamicResource done}"
Style="{DynamicResource AccentButtonStyle}" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View file

@ -21,14 +21,11 @@ using Flow.Launcher.ViewModel;
namespace Flow.Launcher.Resources.Pages namespace Flow.Launcher.Resources.Pages
{ {
/// <summary>
/// WelcomePage5.xaml에 대한 상호 작용 논리
/// </summary>
public partial class WelcomePage5 : Page public partial class WelcomePage5 : Page
{ {
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"; private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
private readonly Settings settings; private readonly Settings settings;
public bool HideOnStartup { get; set; }
public WelcomePage5(Settings settings) public WelcomePage5(Settings settings)
{ {
InitializeComponent(); InitializeComponent();
@ -58,6 +55,15 @@ namespace Flow.Launcher.Resources.Pages
settings.StartFlowLauncherOnSystemStartup = true; settings.StartFlowLauncherOnSystemStartup = true;
} }
private void OnHideOnStartupChecked(object sender, RoutedEventArgs e)
{
settings.HideOnStartup = true;
}
private void OnHideOnStartupUnchecked(object sender, RoutedEventArgs e)
{
settings.HideOnStartup = false;
}
} }
} }