mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-19 09:01:32 +01:00
Add/Remove preset button
This commit is contained in:
1 parent
96988cd131
commit
6dfd1f4bbf
4 files changed
+40
-5
No files matched your search
@@ -6,8 +6,10 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestUseVarKeywordEvident/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ABSTRACT_ACCESSORHOLDER_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_ACCESSOR_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForBuiltInTypes/@EntryValue">UseExplicitType</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForOtherTypes/@EntryValue">UseExplicitType</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/CSharpVarKeywordUsage/ForSimpleTypes/@EntryValue">UseExplicitType</s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=MethodPropertyEvent/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb_AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -9,15 +9,21 @@ namespace FileConverter
|
||||
using System.Reflection;
|
||||
using System.Security.Principal;
|
||||
using System.Windows;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
using Microsoft.Win32;
|
||||
|
||||
public class Settings
|
||||
{
|
||||
public List<ConversionPreset> ConversionPresets = new List<ConversionPreset>();
|
||||
using FileConverter.Annotations;
|
||||
|
||||
public class Settings : INotifyPropertyChanged
|
||||
{
|
||||
private const char PresetSeparator = ';';
|
||||
|
||||
private List<ConversionPreset> conversionPresets = new List<ConversionPreset>();
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private static bool IsInAdmininstratorPrivileges
|
||||
{
|
||||
get
|
||||
@@ -26,6 +32,19 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
public List<ConversionPreset> ConversionPresets
|
||||
{
|
||||
get { return this.conversionPresets; }
|
||||
set { this.conversionPresets = value; }
|
||||
}
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChangedEventHandler handler = this.PropertyChanged;
|
||||
handler?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
List<ConversionPreset> conversionPresets = this.ConversionPresets;
|
||||
|
||||
@@ -84,6 +84,9 @@
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
|
||||
<Button Name="AddPresetButton" Grid.Row="2" Content="+" HorizontalAlignment="Left" Width="28" Margin="18,4,0,0" Click="AddPresetButton_Click"/>
|
||||
<Button Name="RemovePresetButton" Grid.Row="2" Content="-" HorizontalAlignment="Left" Width="28" Margin="54,4,0,0" Click="RemovePresetButton_Click"/>
|
||||
|
||||
<Button Name="CloseButton" Grid.Row="2" Content="Close" HorizontalAlignment="Right" Width="100" Margin="0,4,105,0" Click="CloseButton_Click" />
|
||||
<Button Name="SaveButton" Grid.Row="2" Content="Save" HorizontalAlignment="Right" Width="100" Margin="0,4,0,0" Click="SaveButton_Click"/>
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace FileConverter
|
||||
{
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows;
|
||||
using System.ComponentModel;
|
||||
@@ -97,5 +96,17 @@ namespace FileConverter
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void AddPresetButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
application.Settings.ConversionPresets.Add(new ConversionPreset("New preset", OutputType.None, new string[0]));
|
||||
}
|
||||
|
||||
private void RemovePresetButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Application application = Application.Current as Application;
|
||||
application.Settings.ConversionPresets.Remove(this.selectedPreset);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user