mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-06 03:07:54 +08:00
Save and close for setting tab
This commit is contained in:
parent
ba78637361
commit
e7f5491239
@ -11,8 +11,15 @@
|
|||||||
Title="{DynamicResource wox_settings}"
|
Title="{DynamicResource wox_settings}"
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown"
|
Height="600" Width="800"
|
||||||
|
Closed="OnClosed"
|
||||||
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
|
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
|
||||||
|
<Window.InputBindings>
|
||||||
|
<KeyBinding Key="Escape" Command="Close"/>
|
||||||
|
</Window.InputBindings>
|
||||||
|
<Window.CommandBindings>
|
||||||
|
<CommandBinding Command="Close" Executed="OnCloseExecuted"/>
|
||||||
|
</Window.CommandBindings>
|
||||||
<TabControl Height="auto" SelectedIndex="0">
|
<TabControl Height="auto" SelectedIndex="0">
|
||||||
<TabItem Header="{DynamicResource general}">
|
<TabItem Header="{DynamicResource general}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
|
@ -309,15 +309,6 @@ namespace Wox
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
// Hide window with ESC, but make sure it is not pressed as a hotkey
|
|
||||||
if (e.Key == Key.Escape && !HotkeyControl.IsFocused)
|
|
||||||
{
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async void OnCheckUpdates(object sender, RoutedEventArgs e)
|
private async void OnCheckUpdates(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var version = await Updater.NewVersion();
|
var version = await Updater.NewVersion();
|
||||||
@ -338,5 +329,15 @@ namespace Wox
|
|||||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnClosed(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_viewModel.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using PropertyChanged;
|
using PropertyChanged;
|
||||||
@ -32,7 +33,6 @@ namespace Wox.ViewModel
|
|||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//todo happlebao save
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
_storage.Save();
|
_storage.Save();
|
||||||
|
Loading…
Reference in New Issue
Block a user