Skip to content

Commit 0f0ac7b

Browse files
committed
removed unused code;
code clean ups; Bugfix;
1 parent 41e3934 commit 0f0ac7b

File tree

4 files changed

+12
-45
lines changed

4 files changed

+12
-45
lines changed

QuickNoteWidget/Converter/StringToTextDocumentConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class StringToTextDocumentConverter : IValueConverter
1414
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
1515
{
1616
TextDocument doc = new TextDocument();
17-
doc.Text = (string)value;
17+
doc.Text = (string)value == null ? String.Empty : value.ToString();
1818
return doc;
1919
}
2020

QuickNoteWidget/MainWindowViewModel.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ public class MainWindowViewModel : ViewModelBase
1919
private const string BLACK = "#252525"; // Based on Theme colord "Dark"
2020
private const string GRAY = "#616161"; // slightly lighter than BLACK
2121
private const string LIGHT_GRAY = "#EAEAEA"; // slightly darker than "WhiteSmoke"
22-
private const string NORMAL = "Normal";
23-
private const string ITALIC = "Italic";
24-
private const string STRIKETHROUGH = "Strikethrough";
25-
private const string DEFAULT_FONT = "Arial";
26-
private const string CYAN = "Cyan";
2722
#endregion Constants
2823

2924
#region MVVM Properties
@@ -145,7 +140,6 @@ public string MultiLine
145140

146141

147142
public Settings Settings { get; set; }
148-
public ICommand ClearMultiLineCommand { get; set; }
149143
public ICommand ResetViewCommand { get; set; }
150144

151145

@@ -160,9 +154,6 @@ public MainWindowViewModel()
160154
private void Init()
161155
{
162156
ResetViewCommand = new DelegateCommand(ResetView);
163-
ClearMultiLineCommand = new DelegateCommand(ClearMultiLine);
164-
165-
ClearMultiLine();
166157
Fonts = new ObservableCollection<string>(LoadInstalledFonts());
167158
}
168159

@@ -173,11 +164,9 @@ private IEnumerable<string> LoadInstalledFonts()
173164
yield return font.Name;
174165
}
175166

176-
private void ClearMultiLine() => this.MultiLine = String.Empty;
177-
178167
private void ResetView()
179168
{
180-
var defaultSettings = SettingsLogic.GetDefaultSettings();
169+
Settings defaultSettings = SettingsLogic.GetDefaultSettings();
181170
LoadSettings(SettingsLoadLocations.Default);
182171
}
183172

@@ -242,7 +231,6 @@ public void SaveSettings()
242231
Settings.ShowInTaskbar = this.ShowInTaskbar;
243232
SettingsLogic.SaveSettings(this.Settings);
244233
}
245-
246234
#endregion Settings
247235
}
248236
}

QuickNoteWidget/Settings.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ namespace QuickNoteWidget
44
{
55
public class Settings : BindableBase
66
{
7-
public string SelectedThemeName { get; set; }
8-
public string SelectedAccentName { get; set; }
9-
public bool OnTop { get; set; }
10-
public bool DisplayDetails { get; set; }
11-
public bool ShowInTaskbar { get; set; }
12-
public double TransparencyValue { get; set; }
13-
public string CurrentFont { get; set; }
7+
public string SelectedThemeName { get; set; } = "Light";
8+
public string SelectedAccentName { get; set; } = "Cyan";
9+
public bool OnTop { get; set; } = true;
10+
public bool DisplayDetails { get; set; } = true;
11+
public bool ShowInTaskbar { get; set; } = true;
12+
public double TransparencyValue { get; set; } = 1;
13+
public string CurrentFont { get; set; } = "Arial";
1414
}
1515
}

QuickNoteWidget/SettingsLogic.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ namespace QuickNoteWidget
66
{
77
public static class SettingsLogic
88
{
9-
private const string CYAN = "Cyan";
10-
private const string LIGHT = "Light";
11-
private const string DEFAULT_FONT = "Arial";
12-
139
private static readonly string SettingsPath = $"{AppDomain.CurrentDomain.BaseDirectory}settings.xml";
14-
10+
1511

1612
public static void SaveSettings(Settings settings)
1713
{
@@ -51,24 +47,7 @@ private static Settings DeserializeFromFile()
5147
}
5248

5349

54-
55-
56-
public static Settings GetDefaultSettings() => new Settings()
57-
{
58-
SelectedAccentName = CYAN,
59-
SelectedThemeName = LIGHT,
60-
OnTop = true,
61-
DisplayDetails = true,
62-
ShowInTaskbar = true,
63-
TransparencyValue = 1.0,
64-
CurrentFont = DEFAULT_FONT,
65-
};
66-
67-
68-
69-
private static bool DoesSettingFileExists()
70-
{
71-
return File.Exists(SettingsPath);
72-
}
50+
public static Settings GetDefaultSettings() => new Settings();
51+
private static bool DoesSettingFileExists() => File.Exists(SettingsPath);
7352
}
7453
}

0 commit comments

Comments
 (0)