diff --git a/TestWindow/App.config b/TestWindow/App.config index de657c2..efae862 100644 --- a/TestWindow/App.config +++ b/TestWindow/App.config @@ -10,12 +10,21 @@ - + True + + + + + + + + + \ No newline at end of file diff --git a/TestWindow/App.xaml.cs b/TestWindow/App.xaml.cs index 5d9791c..69509d6 100644 --- a/TestWindow/App.xaml.cs +++ b/TestWindow/App.xaml.cs @@ -1,4 +1,5 @@ -using FloatingStatusWindowLibrary; +using System; +using FloatingStatusWindowLibrary; using System.Collections.Generic; using System.Windows; using Settings = TestWindow.Properties.Settings; @@ -7,7 +8,7 @@ namespace TestWindow { public partial class App { - private List _windowSourceList; + private List _windowSourceList; protected override void OnStartup(StartupEventArgs e) { @@ -21,11 +22,12 @@ namespace TestWindow Settings.Default.Save(); }); - _windowSourceList = new List + _windowSourceList = new List { - //new WindowSource(), - //new WindowSource(), - new WindowSource() + new WindowSource1(), + new WindowSource2(), + new WindowSource3(), + new WindowSource4() }; } diff --git a/TestWindow/Properties/Settings.Designer.cs b/TestWindow/Properties/Settings.Designer.cs index 6842f21..f7a1507 100644 --- a/TestWindow/Properties/Settings.Designer.cs +++ b/TestWindow/Properties/Settings.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -26,12 +26,12 @@ namespace TestWindow.Properties { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("")] - public string WindowSettings { + public string WindowSettings1 { get { - return ((string)(this["WindowSettings"])); + return ((string)(this["WindowSettings1"])); } set { - this["WindowSettings"] = value; + this["WindowSettings1"] = value; } } @@ -46,5 +46,41 @@ namespace TestWindow.Properties { this["AutoStart"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string WindowSettings2 { + get { + return ((string)(this["WindowSettings2"])); + } + set { + this["WindowSettings2"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string WindowSettings3 { + get { + return ((string)(this["WindowSettings3"])); + } + set { + this["WindowSettings3"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("")] + public string WindowSettings4 { + get { + return ((string)(this["WindowSettings4"])); + } + set { + this["WindowSettings4"] = value; + } + } } } diff --git a/TestWindow/Properties/Settings.settings b/TestWindow/Properties/Settings.settings index 986b0b1..171f5a4 100644 --- a/TestWindow/Properties/Settings.settings +++ b/TestWindow/Properties/Settings.settings @@ -2,11 +2,20 @@ - + True + + + + + + + + + \ No newline at end of file diff --git a/TestWindow/TestWindow.csproj b/TestWindow/TestWindow.csproj index 9aa9299..3f3ca71 100644 --- a/TestWindow/TestWindow.csproj +++ b/TestWindow/TestWindow.csproj @@ -59,7 +59,10 @@ Code - + + + + diff --git a/TestWindow/WindowSource.cs b/TestWindow/WindowSource1.cs similarity index 87% rename from TestWindow/WindowSource.cs rename to TestWindow/WindowSource1.cs index ee9bed3..1effd97 100644 --- a/TestWindow/WindowSource.cs +++ b/TestWindow/WindowSource1.cs @@ -6,13 +6,13 @@ using System.Windows.Threading; namespace TestWindow { - internal class WindowSource : IWindowSource, IDisposable + internal class WindowSource1 : IWindowSource, IDisposable { private readonly FloatingStatusWindow _floatingStatusWindow; private readonly Timer _timer; private readonly Dispatcher _dispatcher; - internal WindowSource() + internal WindowSource1() { _floatingStatusWindow = new FloatingStatusWindow(this); _floatingStatusWindow.SetText("Loading..."); @@ -40,7 +40,7 @@ namespace TestWindow public string Name { - get { return "Test Window"; } + get { return "Test Window 1"; } } public System.Drawing.Icon Icon @@ -52,11 +52,11 @@ namespace TestWindow { get { - return Properties.Settings.Default.WindowSettings; + return Properties.Settings.Default.WindowSettings1; } set { - Properties.Settings.Default.WindowSettings = value; + Properties.Settings.Default.WindowSettings1 = value; Properties.Settings.Default.Save(); } } diff --git a/TestWindow/WindowSource2.cs b/TestWindow/WindowSource2.cs new file mode 100644 index 0000000..c07e848 --- /dev/null +++ b/TestWindow/WindowSource2.cs @@ -0,0 +1,64 @@ +using FloatingStatusWindowLibrary; +using System; +using System.Globalization; +using System.Timers; +using System.Windows.Threading; + +namespace TestWindow +{ + internal class WindowSource2 : IWindowSource, IDisposable + { + private readonly FloatingStatusWindow _floatingStatusWindow; + private readonly Timer _timer; + private readonly Dispatcher _dispatcher; + + internal WindowSource2() + { + _floatingStatusWindow = new FloatingStatusWindow(this); + _floatingStatusWindow.SetText("Loading..."); + + _dispatcher = Dispatcher.CurrentDispatcher; + + _timer = new Timer(1000); + _timer.Elapsed += HandleTimerElapsed; + _timer.Enabled = true; + } + + private void HandleTimerElapsed(object sender, ElapsedEventArgs e) + { + _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(DateTime.Now.ToString(CultureInfo.InvariantCulture))); + } + + public void Dispose() + { + _timer.Enabled = false; + _timer.Dispose(); + + _floatingStatusWindow.Save(); + _floatingStatusWindow.Dispose(); + } + + public string Name + { + get { return "Test Window 2"; } + } + + public System.Drawing.Icon Icon + { + get { return Properties.Resources.ApplicationIcon; } + } + + public string WindowSettings + { + get + { + return Properties.Settings.Default.WindowSettings2; + } + set + { + Properties.Settings.Default.WindowSettings2 = value; + Properties.Settings.Default.Save(); + } + } + } +} diff --git a/TestWindow/WindowSource3.cs b/TestWindow/WindowSource3.cs new file mode 100644 index 0000000..0b158cc --- /dev/null +++ b/TestWindow/WindowSource3.cs @@ -0,0 +1,64 @@ +using FloatingStatusWindowLibrary; +using System; +using System.Globalization; +using System.Timers; +using System.Windows.Threading; + +namespace TestWindow +{ + internal class WindowSource3 : IWindowSource, IDisposable + { + private readonly FloatingStatusWindow _floatingStatusWindow; + private readonly Timer _timer; + private readonly Dispatcher _dispatcher; + + internal WindowSource3() + { + _floatingStatusWindow = new FloatingStatusWindow(this); + _floatingStatusWindow.SetText("Loading..."); + + _dispatcher = Dispatcher.CurrentDispatcher; + + _timer = new Timer(1000); + _timer.Elapsed += HandleTimerElapsed; + _timer.Enabled = true; + } + + private void HandleTimerElapsed(object sender, ElapsedEventArgs e) + { + _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(DateTime.Now.ToString(CultureInfo.InvariantCulture))); + } + + public void Dispose() + { + _timer.Enabled = false; + _timer.Dispose(); + + _floatingStatusWindow.Save(); + _floatingStatusWindow.Dispose(); + } + + public string Name + { + get { return "Test Window 3"; } + } + + public System.Drawing.Icon Icon + { + get { return Properties.Resources.ApplicationIcon; } + } + + public string WindowSettings + { + get + { + return Properties.Settings.Default.WindowSettings3; + } + set + { + Properties.Settings.Default.WindowSettings3 = value; + Properties.Settings.Default.Save(); + } + } + } +} diff --git a/TestWindow/WindowSource4.cs b/TestWindow/WindowSource4.cs new file mode 100644 index 0000000..8ca2faa --- /dev/null +++ b/TestWindow/WindowSource4.cs @@ -0,0 +1,64 @@ +using FloatingStatusWindowLibrary; +using System; +using System.Globalization; +using System.Timers; +using System.Windows.Threading; + +namespace TestWindow +{ + internal class WindowSource4 : IWindowSource, IDisposable + { + private readonly FloatingStatusWindow _floatingStatusWindow; + private readonly Timer _timer; + private readonly Dispatcher _dispatcher; + + internal WindowSource4() + { + _floatingStatusWindow = new FloatingStatusWindow(this); + _floatingStatusWindow.SetText("Loading..."); + + _dispatcher = Dispatcher.CurrentDispatcher; + + _timer = new Timer(1000); + _timer.Elapsed += HandleTimerElapsed; + _timer.Enabled = true; + } + + private void HandleTimerElapsed(object sender, ElapsedEventArgs e) + { + _dispatcher.InvokeAsync(() => _floatingStatusWindow.SetText(DateTime.Now.ToString(CultureInfo.InvariantCulture))); + } + + public void Dispose() + { + _timer.Enabled = false; + _timer.Dispose(); + + _floatingStatusWindow.Save(); + _floatingStatusWindow.Dispose(); + } + + public string Name + { + get { return "Test Window 4"; } + } + + public System.Drawing.Icon Icon + { + get { return Properties.Resources.ApplicationIcon; } + } + + public string WindowSettings + { + get + { + return Properties.Settings.Default.WindowSettings4; + } + set + { + Properties.Settings.Default.WindowSettings4 = value; + Properties.Settings.Default.Save(); + } + } + } +}