Databinding for theme tab

This commit is contained in:
bao-qian
2016-05-22 19:14:59 +01:00
parent 1867e56739
commit 38cf74d83b
9 changed files with 242 additions and 239 deletions

View File

@@ -24,12 +24,7 @@
Left="{Binding Left, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Top="{Binding Top, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
d:DataContext="{d:DesignInstance vm:MainViewModel, IsDesignTimeCreatable=True}">
<Window.Resources>
<DataTemplate DataType="{x:Type vm:ResultsViewModel}">
<wox:ResultListBox PreviewMouseDown="OnPreviewMouseButtonDown" />
</DataTemplate>
</Window.Resources>
d:DataContext="{d:DesignInstance vm:MainViewModel}">
<Border Style="{DynamicResource WindowBorderStyle}" MouseDown="OnMouseDown">
<StackPanel Orientation="Vertical">
<TextBox Style="{DynamicResource QueryBoxStyle}"
@@ -51,8 +46,12 @@
Style="{DynamicResource PendingLineStyle}" Visibility="{Binding ProgressBarVisibility, Mode=TwoWay}"
Y1="0" Y2="0" X2="100" Height="2" Width="752" StrokeThickness="1">
</Line>
<ContentControl Name="Results" Content="{Binding Results}" Visibility="{Binding ResultListBoxVisibility}" />
<ContentControl Name ="ContextMenu" Content="{Binding ContextMenu}" Visibility="{Binding ContextMenuVisibility}" />
<ContentControl Visibility="{Binding ResultListBoxVisibility}" >
<wox:ResultListBox DataContext="{Binding Results}" PreviewMouseDown="OnPreviewMouseButtonDown" />
</ContentControl>
<ContentControl Visibility="{Binding ContextMenuVisibility}">
<wox:ResultListBox DataContext="{Binding ContextMenu}" PreviewMouseDown="OnPreviewMouseButtonDown" />
</ContentControl>
</StackPanel>
</Border>
</Window>

View File

@@ -101,8 +101,8 @@ namespace Wox
{
Application.Current.Dispatcher.Invoke(() =>
{
_settingsViewModel.SelectedTab = (Tab)tab;
SettingWindow sw = SingletonWindowOpener.Open<SettingWindow>(this, _settingsViewModel);
_settingsViewModel.SelectedTab = (Tab) tab;
});
}

View File

@@ -9,7 +9,8 @@
MaxHeight="{Binding MaxHeight}"
SelectedIndex="{Binding SelectedIndex, Mode=TwoWay}"
SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
HorizontalContentAlignment="Stretch" ItemsSource="{Binding Results}" Margin="{Binding Margin}"
HorizontalContentAlignment="Stretch" ItemsSource="{Binding Results}"
Margin="{Binding Margin}"
Style="{DynamicResource BaseListboxStyle}" Focusable="False"
KeyboardNavigation.DirectionalNavigation="Cycle" SelectionMode="Single"
VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Standard"

View File

@@ -12,15 +12,6 @@ namespace Wox
[Synchronization]
public partial class ResultListBox
{
public void AddResults(List<Result> newRawResults)
{
var vm = (ResultsViewModel) DataContext;
var newResults = newRawResults.Select(r => new ResultViewModel(r)).ToList();
vm.Results.Update(newResults);
vm.SelectedIndex = 0;
}
public ResultListBox()
{
InitializeComponent();

View File

@@ -12,7 +12,7 @@
WindowStartupLocation="CenterScreen"
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown"
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
<TabControl Height="auto" SelectedIndex="{Binding SelectedTab}">
<TabControl Height="auto" SelectedIndex="{Binding SelectedTab, FallbackValue=0}">
<TabItem Header="{DynamicResource general}" Height="24" VerticalAlignment="Top">
<StackPanel Orientation="Vertical">
<CheckBox IsChecked="{Binding Settings.StartWoxOnSystemStartup}" Margin="10">
@@ -64,7 +64,7 @@
MouseUp="OnMorePluginsClicked" Foreground="Blue"
Text="{DynamicResource browserMorePlugins}" />
<ListBox SelectedIndex="0" SelectedItem="{Binding SelectedPlugin}"
ItemsSource="{Binding MetadataViewModels}"
ItemsSource="{Binding PluginViewModels}"
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemTemplate>
<DataTemplate>
@@ -152,7 +152,7 @@
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource theme}" Selector.Selected="OnThemeTabSelected">
<TabItem Header="{DynamicResource theme}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
@@ -160,18 +160,18 @@
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<TextBlock DockPanel.Dock="Top" Margin="10" HorizontalAlignment="Left" Cursor="Hand"
MouseUp="tbMoreThemes_MouseUp" Foreground="Blue"
MouseUp="OnMoreThemesClick" Foreground="Blue"
Text="{DynamicResource browserMoreThemes}" />
<ListBox x:Name="Theme" Margin="10, 0, 10, 10"
SelectionChanged="ThemeComboBox_OnSelectionChanged" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Width="180" />
<ListBox SelectedItem="{Binding SelectedTheme}" ItemsSource="{Binding Themes}"
Margin="10, 0, 10, 10" Width="180"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
</DockPanel>
<Grid Margin="0" Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<StackPanel x:Name="PreviewPanel" Grid.Row="0" Margin="0">
<StackPanel Background="{Binding PreviewBackground}" Grid.Row="0" Margin="0">
<StackPanel Orientation="Horizontal" Margin="10"
HorizontalAlignment="Center" VerticalAlignment="Center">
<Border Width="500" Style="{DynamicResource WindowBorderStyle}">
@@ -182,7 +182,9 @@
</Grid.RowDefinitions>
<TextBox Text="{DynamicResource helloWox}" IsReadOnly="True"
Style="{DynamicResource QueryBoxStyle}" Grid.Row="0" />
<wox:ResultListBox Grid.Row="1" x:Name="ResultListBoxPreview" />
<ContentControl Visibility="Visible" Grid.Row="1">
<wox:ResultListBox DataContext="{Binding PreviewResults}" />
</ContentControl>
</Grid>
</Border>
</StackPanel>
@@ -191,15 +193,13 @@
<StackPanel Grid.Row="1" Margin="0 10 0 10" Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="{DynamicResource queryBoxFont}" />
<ComboBox Margin="10 -2 5 0" x:Name="QueryBoxFont"
ItemsSource="{x:Static Fonts.SystemFontFamilies}"
SelectionChanged="CbQueryBoxFont_OnSelectionChanged" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="160" />
<ComboBox Margin="0 -2 0 0"
x:Name="QueryBoxFontFaces"
ItemsSource="{Binding SelectedValue.FamilyTypefaces, ElementName=QueryBoxFont}"
SelectionChanged="CbQueryBoxFontFaces_OnSelectionChanged"
HorizontalAlignment="Left" VerticalAlignment="Top" Width="120">
<ComboBox ItemsSource="{x:Static Fonts.SystemFontFamilies}"
SelectedItem="{Binding SelectedQueryBoxFont}"
HorizontalAlignment="Left" VerticalAlignment="Top" Width="160" Margin="10 -2 5 0"/>
<ComboBox ItemsSource="{Binding SelectedQueryBoxFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedQueryBoxFontFaces}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="120" Margin="0 -2 0 0">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
@@ -215,15 +215,14 @@
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="2">
<TextBlock Text="{DynamicResource resultItemFont}" />
<ComboBox Margin="5 -2 5 0" x:Name="ResultFontComboBox"
ItemsSource="{x:Static Fonts.SystemFontFamilies}"
SelectionChanged="OnResultFontSelectionChanged" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="160" />
<ComboBox Margin="0 -2 0 0"
x:Name="ResultFontFacesComboBox"
ItemsSource="{Binding SelectedValue.FamilyTypefaces, ElementName=ResultFontComboBox}"
SelectionChanged="OnResultFontFacesSelectionChanged" HorizontalAlignment="Left"
VerticalAlignment="Top" Width="120">
<ComboBox ItemsSource="{x:Static Fonts.SystemFontFamilies}"
SelectedItem="{Binding SelectedResultFont}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="160" Margin="5 -2 5 0" />
<ComboBox ItemsSource="{Binding SelectedResultFont.FamilyTypefaces}"
SelectedItem="{Binding SelectedResultFontFaces}"
HorizontalAlignment="Left" VerticalAlignment="Top"
Width="120" Margin="0 -2 0 0">
<ComboBox.ItemTemplate>
<DataTemplate>
<ItemsControl ItemsSource="{Binding AdjustedFaceNames}">
@@ -242,7 +241,7 @@
</Grid>
</Grid>
</TabItem>
<TabItem Header="{DynamicResource hotkey}" Selector.Selected="OnThemeTabSelected">
<TabItem Header="{DynamicResource hotkey}" Selector.Selected="OnHotkeyTabSelected">
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />

View File

@@ -42,7 +42,6 @@ namespace Wox
DataContext = viewModel;
_viewModel = viewModel;
_api = api;
ResultListBoxPreview.DataContext = new ResultsViewModel(_settings);
Loaded += Setting_Loaded;
}
@@ -260,189 +259,10 @@ namespace Wox
#region Theme
private void tbMoreThemes_MouseUp(object sender, MouseButtonEventArgs e)
private void OnMoreThemesClick(object sender, MouseButtonEventArgs e)
{
Process.Start("http://www.getwox.com/theme");
}
public void OnThemeTabSelected(object sender, RoutedEventArgs e)
{
Stopwatch.Debug("theme load", () =>
{
var s = Fonts.SystemFontFamilies;
});
if (themeTabLoaded) return;
themeTabLoaded = true;
if (!string.IsNullOrEmpty(_settings.QueryBoxFont) &&
Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(_settings.QueryBoxFont)) > 0)
{
QueryBoxFont.Text = _settings.QueryBoxFont;
QueryBoxFontFaces.SelectedItem =
SyntaxSugars.CallOrRescueDefault(
() => ((FontFamily)QueryBoxFont.SelectedItem).ConvertFromInvariantStringsOrNormal(
_settings.QueryBoxFontStyle,
_settings.QueryBoxFontWeight,
_settings.QueryBoxFontStretch
));
}
if (!string.IsNullOrEmpty(_settings.ResultFont) &&
Fonts.SystemFontFamilies.Count(o => o.FamilyNames.Values.Contains(_settings.ResultFont)) > 0)
{
ResultFontComboBox.Text = _settings.ResultFont;
ResultFontFacesComboBox.SelectedItem =
SyntaxSugars.CallOrRescueDefault(
() => ((FontFamily)ResultFontComboBox.SelectedItem).ConvertFromInvariantStringsOrNormal(
_settings.ResultFontStyle,
_settings.ResultFontWeight,
_settings.ResultFontStretch
));
}
ResultListBoxPreview.AddResults(new List<Result>
{
new Result
{
Title = "Wox is an effective launcher for windows",
SubTitle = "Wox provide bundles of features let you access infomations quickly.",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "Search applications",
SubTitle = "Search applications, files (via everything plugin) and browser bookmarks",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "Search web contents with shortcuts",
SubTitle = "e.g. search google with g keyword or youtube keyword)",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "clipboard history ",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "Themes support",
SubTitle = "get more themes from http://www.getwox.com/theme",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "Plugins support",
SubTitle = "get more plugins from http://www.getwox.com/plugin",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
},
new Result
{
Title = "Wox is an open-source software",
SubTitle = "Wox benefits from the open-source community a lot",
IcoPath = "Images/app.png",
PluginDirectory = Path.GetDirectoryName(Infrastructure.Constant.ProgramDirectory)
}
});
foreach (string theme in ThemeManager.Instance.LoadAvailableThemes())
{
string themeName = Path.GetFileNameWithoutExtension(theme);
Theme.Items.Add(themeName);
}
Theme.SelectedItem = _settings.Theme;
var wallpaper = WallpaperPathRetrieval.GetWallpaperPath();
if (wallpaper != null && File.Exists(wallpaper))
{
var memStream = new MemoryStream(File.ReadAllBytes(wallpaper));
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = memStream;
bitmap.EndInit();
var brush = new ImageBrush(bitmap);
brush.Stretch = Stretch.UniformToFill;
PreviewPanel.Background = brush;
}
else
{
var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
PreviewPanel.Background = new SolidColorBrush(wallpaperColor);
}
}
private void ThemeComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
string themeName = Theme.SelectedItem.ToString();
ThemeManager.Instance.ChangeTheme(themeName);
}
private void CbQueryBoxFont_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!settingsLoaded) return;
string queryBoxFontName = QueryBoxFont.SelectedItem.ToString();
_settings.QueryBoxFont = queryBoxFontName;
QueryBoxFontFaces.SelectedItem = ((FontFamily)QueryBoxFont.SelectedItem).ChooseRegularFamilyTypeface();
ThemeManager.Instance.ChangeTheme(_settings.Theme);
}
private void CbQueryBoxFontFaces_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!settingsLoaded) return;
FamilyTypeface typeface = (FamilyTypeface)QueryBoxFontFaces.SelectedItem;
if (typeface == null)
{
if (QueryBoxFontFaces.Items.Count > 0)
QueryBoxFontFaces.SelectedIndex = 0;
}
else
{
_settings.QueryBoxFontStretch = typeface.Stretch.ToString();
_settings.QueryBoxFontWeight = typeface.Weight.ToString();
_settings.QueryBoxFontStyle = typeface.Style.ToString();
ThemeManager.Instance.ChangeTheme(_settings.Theme);
}
}
private void OnResultFontSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!settingsLoaded) return;
string resultItemFont = ResultFontComboBox.SelectedItem.ToString();
_settings.ResultFont = resultItemFont;
ResultFontFacesComboBox.SelectedItem =
((FontFamily)ResultFontComboBox.SelectedItem).ChooseRegularFamilyTypeface();
ThemeManager.Instance.ChangeTheme(_settings.Theme);
}
private void OnResultFontFacesSelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (!settingsLoaded) return;
FamilyTypeface typeface = (FamilyTypeface)ResultFontFacesComboBox.SelectedItem;
if (typeface == null)
{
if (ResultFontFacesComboBox.Items.Count > 0)
ResultFontFacesComboBox.SelectedIndex = 0;
}
else
{
_settings.ResultFontStretch = typeface.Stretch.ToString();
_settings.ResultFontWeight = typeface.Weight.ToString();
_settings.ResultFontStyle = typeface.Style.ToString();
ThemeManager.Instance.ChangeTheme(_settings.Theme);
}
}
#endregion
#region Plugin

View File

@@ -232,14 +232,14 @@ namespace Wox.ViewModel
private void InitializeResultListBox()
{
Results = new ResultsViewModel(_settings);
Results = new ResultsViewModel(_settings.MaxResultsToShow);
ResultListBoxVisibility = Visibility.Collapsed;
}
private void InitializeContextMenu()
{
ContextMenu = new ResultsViewModel(_settings);
ContextMenu = new ResultsViewModel(_settings.MaxResultsToShow);
ContextMenuVisibility = Visibility.Collapsed;
}

View File

@@ -19,20 +19,23 @@ namespace Wox.ViewModel
private readonly object _addResultsLock = new object();
private readonly object _collectionLock = new object();
private readonly Settings _settings;
public int MaxResults = 6;
public ResultsViewModel(Settings settings)
public ResultsViewModel()
{
_settings = settings;
Results = new ResultCollection();
BindingOperations.EnableCollectionSynchronization(Results, _collectionLock);
}
public ResultsViewModel(int maxResults) : this()
{
MaxResults = maxResults;
}
#endregion
#region ViewModel Properties
public int MaxHeight => _settings.MaxResultsToShow * 50;
public int MaxHeight => MaxResults * 50;
public int SelectedIndex
{
@@ -108,12 +111,12 @@ namespace Wox.ViewModel
public void SelectNextPage()
{
SelectedIndex = NewIndex(SelectedIndex + _settings.MaxResultsToShow);
SelectedIndex = NewIndex(SelectedIndex + MaxResults);
}
public void SelectPrevPage()
{
SelectedIndex = NewIndex(SelectedIndex - _settings.MaxResultsToShow);
SelectedIndex = NewIndex(SelectedIndex - MaxResults);
}
public void Clear()

View File

@@ -1,12 +1,17 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using PropertyChanged;
using Wox.Core.Plugin;
using Wox.Core.Resource;
using Wox.Core.UserSettings;
using Wox.Helper;
using Wox.Infrastructure.Storage;
using Wox.Plugin;
using static System.String;
@@ -22,8 +27,11 @@ namespace Wox.ViewModel
private readonly Dictionary<ISettingProvider, Control> _featureControls = new Dictionary<ISettingProvider, Control>();
public Tab SelectedTab { get; set; } = Tab.General;
#region general
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
#endregion
#region plugin
public PluginViewModel SelectedPlugin { get; set; }
public IList<PluginViewModel> PluginViewModels
{
@@ -92,16 +100,198 @@ namespace Wox.ViewModel
}
}
}
#endregion
#region theme
public string SelectedTheme
{
get
{
return Settings.Theme;
}
set
{
Settings.Theme = value;
ThemeManager.Instance.ChangeTheme(value);
}
}
public List<string> Themes => ThemeManager.Instance.LoadAvailableThemes().Select(Path.GetFileNameWithoutExtension).ToList();
public Brush PreviewBackground
{
get
{
var wallpaper = WallpaperPathRetrieval.GetWallpaperPath();
if (wallpaper != null && File.Exists(wallpaper))
{
var memStream = new MemoryStream(File.ReadAllBytes(wallpaper));
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = memStream;
bitmap.EndInit();
var brush = new ImageBrush(bitmap) { Stretch = Stretch.UniformToFill };
return brush;
}
else
{
var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
var brush = new SolidColorBrush(wallpaperColor);
return brush;
}
}
}
public ResultsViewModel PreviewResults
{
get
{
const string image = "app.png";
const string theme = "http://www.getwox.com/theme/builder";
const string plugin = "http://www.getwox.com/plugin";
List<Result> results = new List<Result>
{
new Result
{
Title = "WoX is a launcher for Windows that simply works.",
SubTitle = "You can call it Windows omni-eXecutor if you want a long name.",
IcoPath = image,
},
new Result
{
Title = "Search for everything—applications, folders, files and more.",
SubTitle = "Use pinyin to search for programs. (yyy / wangyiyun → 网易云音乐)",
IcoPath = image,
},
new Result
{
Title = "Keyword plugin search.",
SubTitle = "search google with g search_term.",
IcoPath = image,
},
new Result
{
Title = "Build custom themes at: ",
SubTitle = theme,
},
new Result
{
Title = "Install plugins from: ",
SubTitle = plugin,
IcoPath = image,
},
new Result
{
Title = $"Open Source: {Infrastructure.Constant.Github}",
SubTitle = "Please star it!",
IcoPath = image,
}
};
var vm = new ResultsViewModel(6);
vm.AddResults(results, "PREVIEW");
return vm;
}
}
public FontFamily SelectedQueryBoxFont
{
get
{
if (Fonts.SystemFontFamilies.Count(o =>
o.FamilyNames.Values != null &&
o.FamilyNames.Values.Contains(Settings.QueryBoxFont)) > 0)
{
var font = new FontFamily(Settings.QueryBoxFont);
return font;
}
else
{
var font = new FontFamily("Segoe UI");
return font;
}
}
set
{
Settings.QueryBoxFont = value.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
public FamilyTypeface SelectedQueryBoxFontFaces
{
get
{
var typeface = SyntaxSugars.CallOrRescueDefault(
() => SelectedQueryBoxFont.ConvertFromInvariantStringsOrNormal(
Settings.QueryBoxFontStyle,
Settings.QueryBoxFontWeight,
Settings.QueryBoxFontStretch
));
return typeface;
}
set
{
Settings.QueryBoxFontStretch = value.Stretch.ToString();
Settings.QueryBoxFontWeight = value.Weight.ToString();
Settings.QueryBoxFontStyle = value.Style.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
public FontFamily SelectedResultFont
{
get
{
if (Fonts.SystemFontFamilies.Count(o =>
o.FamilyNames.Values != null &&
o.FamilyNames.Values.Contains(Settings.ResultFont)) > 0)
{
var font = new FontFamily(Settings.ResultFont);
return font;
}
else
{
var font = new FontFamily("Segoe UI");
return font;
}
}
set
{
Settings.ResultFont = value.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
public FamilyTypeface SelectedResultFontFaces
{
get
{
var typeface = SyntaxSugars.CallOrRescueDefault(
() => SelectedQueryBoxFont.ConvertFromInvariantStringsOrNormal(
Settings.ResultFontStyle,
Settings.ResultFontWeight,
Settings.ResultFontStretch
));
return typeface;
}
set
{
Settings.ResultFontStretch = value.Stretch.ToString();
Settings.ResultFontWeight = value.Weight.ToString();
Settings.ResultFontStyle = value.Style.ToString();
ThemeManager.Instance.ChangeTheme(Settings.Theme);
}
}
#endregion
public SettingWindowViewModel()
{
_storage = new JsonStrorage<Settings>();
Settings = _storage.Load();
}
//todo happlebao save
public void Save()
{
_storage.Save();