-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from BeloMaximka/experimental-settings
add experimental settings
- Loading branch information
Showing
15 changed files
with
203 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Data; | ||
|
||
namespace MystatDesktopWpf.Converters | ||
{ | ||
public class StringToResource : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return App.Current.FindResource(value as string); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
MystatDesktopWpf/SubSettings/ExperimentalFeaturesSubSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using MystatDesktopWpf.Services; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MystatDesktopWpf.SubSettings | ||
{ | ||
public class ExperimentalFeaturesSubSettings : ISettingsProperty | ||
{ | ||
public event Action? OnPropertyChanged; | ||
|
||
private bool bypassUploadRestrictions = false; | ||
|
||
public bool BypassUploadRestrictions | ||
{ | ||
get => bypassUploadRestrictions; | ||
set | ||
{ | ||
bypassUploadRestrictions = value; | ||
PropertyChanged(); | ||
} | ||
} | ||
|
||
public void PropertyChanged() | ||
{ | ||
OnPropertyChanged?.Invoke(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
MystatDesktopWpf/UserControls/SettingsSections/ExperimentalSettings.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<UserControl x:Class="MystatDesktopWpf.UserControls.SettingsSections.ExperimentalSettings" | ||
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:local="clr-namespace:MystatDesktopWpf.UserControls.SettingsSections" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<materialDesign:Card Padding="8"> | ||
<StackPanel Margin="8 0 0 0"> | ||
<TextBlock Text="{DynamicResource m_ExperimentalSettings}" HorizontalAlignment="Left" Style="{DynamicResource MaterialDesignBody1TextBlock}"/> | ||
<StackPanel Orientation="Horizontal" Margin="0 8"> | ||
<ToggleButton x:Name="BypassUploadToggle" Unchecked="ToggleButton_Unchecked" Checked='ToggleButton_Checked' VerticalAlignment="Top" /> | ||
<StackPanel Orientation="Vertical" Margin="8 0 0 0"> | ||
<TextBlock Text="{DynamicResource m_BypassUploadRestrictions}"/> | ||
<TextBlock Text="{DynamicResource m_BypassUploadRestrictionsHelpText}" FontSize="10" Margin="0 4 0 0"/> | ||
</StackPanel> | ||
</StackPanel> | ||
</StackPanel> | ||
</materialDesign:Card> | ||
</UserControl> |
44 changes: 44 additions & 0 deletions
44
MystatDesktopWpf/UserControls/SettingsSections/ExperimentalSettings.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using MystatDesktopWpf.Domain; | ||
using MystatDesktopWpf.Services; | ||
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.Controls.Primitives; | ||
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 MystatDesktopWpf.UserControls.SettingsSections | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ExperimentalSettings.xaml | ||
/// </summary> | ||
public partial class ExperimentalSettings : UserControl | ||
{ | ||
public ExperimentalSettings() | ||
{ | ||
InitializeComponent(); | ||
BypassUploadToggle.IsChecked = SettingsService.Settings.Experimental.BypassUploadRestrictions; | ||
} | ||
|
||
private void ToggleButton_Checked(object sender, RoutedEventArgs e) | ||
{ | ||
MystatAPISingleton.Client.BypassUploadRestrictions = true; | ||
SettingsService.Settings.Experimental.BypassUploadRestrictions = true; | ||
} | ||
|
||
private void ToggleButton_Unchecked(object sender, RoutedEventArgs e) | ||
{ | ||
MystatAPISingleton.Client.BypassUploadRestrictions = false; | ||
SettingsService.Settings.Experimental.BypassUploadRestrictions = false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters