mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Assign Setting to Welcome Page
This commit is contained in:
parent
7e2a3bc115
commit
05c1466b8b
9 changed files with 109 additions and 90 deletions
|
|
@ -31,7 +31,7 @@ namespace Flow.Launcher
|
|||
tbMsg.Visibility = Visibility.Hidden;
|
||||
|
||||
//when alt is pressed, the real key should be e.SystemKey
|
||||
Key key = (e.Key == Key.System ? e.SystemKey : e.Key);
|
||||
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
|
||||
|
||||
SpecialKeyState specialKeyState = GlobalHotkey.Instance.CheckModifiers();
|
||||
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void OpenWelcomeWindow()
|
||||
{
|
||||
Flow.Launcher.WelcomeWindow WelcomeWindow = new Flow.Launcher.WelcomeWindow();
|
||||
Flow.Launcher.WelcomeWindow WelcomeWindow = new WelcomeWindow(_settings);
|
||||
WelcomeWindow.Show();
|
||||
}
|
||||
private void ToggleGameMode()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<Page
|
||||
x:Class="Flow.Launcher.Resources.Pages.WelcomePage1"
|
||||
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:local="clr-namespace:Flow.Launcher.Resources.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="WelcomePage1"
|
||||
mc:Ignorable="d">
|
||||
<Page x:Class="Flow.Launcher.Resources.Pages.WelcomePage1"
|
||||
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:local="clr-namespace:Flow.Launcher.Resources.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="WelcomePage1"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
|
||||
<Setter Property="Opacity" Value="0" />
|
||||
|
|
@ -17,10 +17,7 @@
|
|||
<BeginStoryboard>
|
||||
<BeginStoryboard.Storyboard>
|
||||
<Storyboard x:Name="FadeIn">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1"
|
||||
Duration="0:0:2" />
|
||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:2" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard.Storyboard>
|
||||
</BeginStoryboard>
|
||||
|
|
@ -47,17 +44,15 @@
|
|||
</Border.Background>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<Image
|
||||
Name="Logo"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Source="../../images/app.png"
|
||||
Style="{DynamicResource StyleImageFadeIn}" />
|
||||
<TextBlock
|
||||
Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
Foreground="White">
|
||||
<Image Name="Logo"
|
||||
Width="60"
|
||||
Height="60"
|
||||
Source="../../images/app.png"
|
||||
Style="{DynamicResource StyleImageFadeIn}" />
|
||||
<TextBlock Margin="12,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="30"
|
||||
Foreground="White">
|
||||
Flow Launcher
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
|
@ -65,32 +60,25 @@
|
|||
|
||||
<StackPanel Grid.Row="1" Margin="24,20,24,20">
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource Welcome_Page1_Title}" />
|
||||
<TextBlock
|
||||
Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource Welcome_Page1_Text01}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock
|
||||
Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource Welcome_Page1_Text02}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock
|
||||
Margin="0,30,0,0"
|
||||
FontSize="14"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource language}" />
|
||||
<ComboBox
|
||||
Width="200"
|
||||
Margin="0,10,0,0"
|
||||
DisplayMemberPath="Display"
|
||||
ItemsSource="{Binding Languages}"
|
||||
SelectedValue="{Binding Language}"
|
||||
SelectedValuePath="LanguageCode" />
|
||||
<TextBlock FontSize="20" FontWeight="SemiBold" Text="{DynamicResource Welcome_Page1_Title}" />
|
||||
<TextBlock Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource Welcome_Page1_Text01}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock Margin="0,10,0,0"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource Welcome_Page1_Text02}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock Margin="0,30,0,0"
|
||||
FontSize="14"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource language}" />
|
||||
<ComboBox Width="200"
|
||||
Margin="0,10,0,0"
|
||||
DisplayMemberPath="Display"
|
||||
ItemsSource="{Binding Languages}"
|
||||
SelectedValue="{Binding CustomLanguage, Mode=TwoWay}"
|
||||
SelectedValuePath="LanguageCode" />
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ using System.Windows.Interop;
|
|||
using Microsoft.Win32;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
using Flow.Launcher.Core.Resource;
|
||||
|
||||
namespace Flow.Launcher.Resources.Pages
|
||||
{
|
||||
|
|
@ -27,10 +27,31 @@ namespace Flow.Launcher.Resources.Pages
|
|||
/// </summary>
|
||||
public partial class WelcomePage1 : Page
|
||||
{
|
||||
public WelcomePage1()
|
||||
{
|
||||
|
||||
public WelcomePage1(Settings settings)
|
||||
{
|
||||
Settings = settings;
|
||||
InitializeComponent();
|
||||
}
|
||||
private Internationalization _translater => InternationalizationManager.Instance;
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
|
||||
public Settings Settings { get; }
|
||||
|
||||
public string CustomLanguage
|
||||
{
|
||||
get
|
||||
{
|
||||
return Settings.Language;
|
||||
}
|
||||
set
|
||||
{
|
||||
InternationalizationManager.Instance.ChangeLanguage(value);
|
||||
|
||||
if (InternationalizationManager.Instance.PromptShouldUsePinyin(value))
|
||||
Settings.ShouldUsePinyin = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
Title="WelcomePage2"
|
||||
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<converters:BorderClipConverter x:Key="BorderClipConverter" />
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -20,9 +22,21 @@ namespace Flow.Launcher.Resources.Pages
|
|||
/// </summary>
|
||||
public partial class WelcomePage2 : Page
|
||||
{
|
||||
public WelcomePage2()
|
||||
private readonly Settings settings;
|
||||
|
||||
public WelcomePage2(Settings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.settings = settings;
|
||||
HotkeyControl.HotkeyChanged += (_, _) =>
|
||||
{
|
||||
if (HotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
|
||||
HotKeyMapper.RemoveHotkey(settings.Hotkey);
|
||||
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,12 @@ namespace Flow.Launcher.Resources.Pages
|
|||
public partial class WelcomePage5 : Page
|
||||
{
|
||||
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||
public WelcomePage5()
|
||||
private readonly Settings settings;
|
||||
|
||||
public WelcomePage5(Settings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
private void OnAutoStartupChecked(object sender, RoutedEventArgs e)
|
||||
|
|
@ -46,11 +49,13 @@ namespace Flow.Launcher.Resources.Pages
|
|||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.DeleteValue(Constant.FlowLauncher, false);
|
||||
settings.StartFlowLauncherOnSystemStartup = false;
|
||||
}
|
||||
public static void SetStartup()
|
||||
public void SetStartup()
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(StartupPath, true);
|
||||
key?.SetValue(Constant.FlowLauncher, Constant.ExecutablePath);
|
||||
settings.StartFlowLauncherOnSystemStartup = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (HotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
|
||||
HotKeyMapper.RemoveHotkey(settings.Hotkey);
|
||||
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
|
|
@ -277,7 +276,7 @@ namespace Flow.Launcher
|
|||
|
||||
private void OpenWelcomeWindow(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Flow.Launcher.WelcomeWindow WelcomeWindow = new Flow.Launcher.WelcomeWindow();
|
||||
Flow.Launcher.WelcomeWindow WelcomeWindow = new Flow.Launcher.WelcomeWindow(settings);
|
||||
WelcomeWindow.Show();
|
||||
}
|
||||
private void OpenLogFolder(object sender, RoutedEventArgs e)
|
||||
|
|
|
|||
|
|
@ -12,19 +12,31 @@ using System.Windows.Media;
|
|||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Resources.Pages;
|
||||
using ModernWpf.Media.Animation;
|
||||
using Page = ModernWpf.Controls.Page;
|
||||
using WelcomePages = Flow.Launcher.Resources.Pages;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
public partial class WelcomeWindow : Window
|
||||
{
|
||||
public WelcomeWindow()
|
||||
private readonly List<Page> pages;
|
||||
private readonly Settings settings;
|
||||
|
||||
public WelcomeWindow(Settings settings)
|
||||
{
|
||||
InitializeComponent();
|
||||
ContentFrame.Navigate(typeof(WelcomePages.WelcomePage1));
|
||||
BackButton.IsEnabled = false;
|
||||
this.settings = settings;
|
||||
pages = new()
|
||||
{
|
||||
new WelcomePage1(settings),
|
||||
new WelcomePage2(settings),
|
||||
new WelcomePage3(),
|
||||
new WelcomePage4(),
|
||||
new WelcomePage5(settings),
|
||||
};
|
||||
ContentFrame.Navigate(pages[0]);
|
||||
}
|
||||
private int page;
|
||||
private int MaxPage = 5;
|
||||
|
|
@ -41,7 +53,7 @@ namespace Flow.Launcher
|
|||
BackButton.IsEnabled = true;
|
||||
NextButton.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
BackButton.IsEnabled = true;
|
||||
NextButton.IsEnabled = true;
|
||||
|
|
@ -49,39 +61,20 @@ namespace Flow.Launcher
|
|||
}
|
||||
private NavigationTransitionInfo _transitionInfo = new SlideNavigationTransitionInfo() { Effect = SlideNavigationTransitionEffect.FromRight };
|
||||
Storyboard sb = new Storyboard();
|
||||
|
||||
private static Type PageSelector(int a)
|
||||
{
|
||||
|
||||
switch (a)
|
||||
{
|
||||
case 0:
|
||||
return typeof(WelcomePages.WelcomePage1);
|
||||
case 1:
|
||||
return typeof(WelcomePages.WelcomePage2);
|
||||
case 2:
|
||||
return typeof(WelcomePages.WelcomePage3);
|
||||
case 3:
|
||||
return typeof(WelcomePages.WelcomePage4);
|
||||
case 4:
|
||||
return typeof(WelcomePages.WelcomePage5);
|
||||
default:
|
||||
return typeof(WelcomePages.WelcomePage1);
|
||||
}
|
||||
}
|
||||
private void ForwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
page = page + 1;
|
||||
ButtonDisabler();
|
||||
var pageToNavigateTo = PageSelector(page);
|
||||
ContentFrame.Navigate(pageToNavigateTo, null, _transitionInfo);
|
||||
var pageToNavigateTo = pages[page];
|
||||
|
||||
ContentFrame.Navigate(pageToNavigateTo, _transitionInfo);
|
||||
}
|
||||
|
||||
private void BackwardButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (page > 0)
|
||||
{
|
||||
page = page - 1;
|
||||
page--;
|
||||
ButtonDisabler();
|
||||
ContentFrame.GoBack();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue