mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-01-15 17:23:10 -05:00
Start upgrading to .NET 7
This commit is contained in:
@@ -1,42 +1,41 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Windows;
|
||||
using Settings = TestWindow.Properties.Settings;
|
||||
|
||||
namespace TestWindow
|
||||
namespace TestWindow;
|
||||
|
||||
public partial class App
|
||||
{
|
||||
public partial class App
|
||||
private List<IDisposable> _windowSourceList;
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
private List<IDisposable> _windowSourceList;
|
||||
base.OnStartup(e);
|
||||
|
||||
protected override void OnStartup(StartupEventArgs e)
|
||||
StartManager.ManageAutoStart = true;
|
||||
StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart;
|
||||
StartManager.AutoStartChanged += (value =>
|
||||
{
|
||||
base.OnStartup(e);
|
||||
Settings.Default.AutoStart = value;
|
||||
Settings.Default.Save();
|
||||
});
|
||||
|
||||
StartManager.ManageAutoStart = true;
|
||||
StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart;
|
||||
StartManager.AutoStartChanged += (value =>
|
||||
{
|
||||
Settings.Default.AutoStart = value;
|
||||
Settings.Default.Save();
|
||||
});
|
||||
|
||||
_windowSourceList = new List<IDisposable>
|
||||
{
|
||||
new WindowSource1(),
|
||||
new WindowSource2(),
|
||||
new WindowSource3(),
|
||||
new WindowSource4()
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
_windowSourceList = new List<IDisposable>
|
||||
{
|
||||
_windowSourceList.ForEach(ws => ws.Dispose());
|
||||
|
||||
base.OnExit(e);
|
||||
}
|
||||
new WindowSource1(),
|
||||
new WindowSource2(),
|
||||
new WindowSource3(),
|
||||
new WindowSource4()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
_windowSourceList.ForEach(ws => ws.Dispose());
|
||||
|
||||
base.OnExit(e);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Windows;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
@@ -16,6 +17,9 @@ using System.Windows;
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: SupportedOSPlatform("windows7.0")]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
namespace TestWindow.Properties {
|
||||
|
||||
|
||||
// This class allows you to handle specific events on the settings class:
|
||||
// The SettingChanging event is raised before a setting's value is changed.
|
||||
// The PropertyChanged event is raised after a setting's value is changed.
|
||||
// The SettingsLoaded event is raised after the setting values are loaded.
|
||||
// The SettingsSaving event is raised before the setting values are saved.
|
||||
internal sealed partial class Settings {
|
||||
|
||||
public Settings() {
|
||||
// // To add event handlers for saving and changing settings, uncomment the lines below:
|
||||
//
|
||||
// this.SettingChanging += this.SettingChangingEventHandler;
|
||||
//
|
||||
// this.SettingsSaving += this.SettingsSavingEventHandler;
|
||||
//
|
||||
}
|
||||
|
||||
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
|
||||
// Add code to handle the SettingChangingEvent event here.
|
||||
}
|
||||
|
||||
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
|
||||
// Add code to handle the SettingsSaving event here.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,111 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0C541788-8FFD-47B6-8E6B-653A884CFA55}</ProjectGuid>
|
||||
<TargetFramework>net70-windows</TargetFramework>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestWindow</RootNamespace>
|
||||
<AssemblyName>TestWindow</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Settings.cs" />
|
||||
<Compile Include="WindowSource2.cs" />
|
||||
<Compile Include="WindowSource4.cs" />
|
||||
<Compile Include="WindowSource3.cs" />
|
||||
<Compile Include="WindowSource1.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<ProjectReference Include="..\Library\FloatingStatusWindow.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Library\FloatingStatusWindow.csproj">
|
||||
<Project>{f023a16c-2f13-4a87-a8b7-22c43c4a58a4}</Project>
|
||||
<Name>FloatingStatusWindowLibrary</Name>
|
||||
</ProjectReference>
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Application.StartWithWindows" Version="1.0.5" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\Application.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,92 +1,88 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TestWindow
|
||||
namespace TestWindow;
|
||||
|
||||
internal class WindowSource1 : IWindowSource, IDisposable
|
||||
{
|
||||
internal class WindowSource1 : IWindowSource, IDisposable
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
internal WindowSource1()
|
||||
{
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||
_floatingStatusWindow.SetText("Loading...");
|
||||
|
||||
internal WindowSource1()
|
||||
_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 Guid Id => Guid.Parse("0329D04D-B89B-4FEC-AFD0-4CB972E47FC8");
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Test Window 1"; }
|
||||
}
|
||||
|
||||
public System.Drawing.Icon Icon
|
||||
{
|
||||
get { return Properties.Resources.ApplicationIcon; }
|
||||
}
|
||||
|
||||
public bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get { return Properties.Settings.Default.WindowSettings1; }
|
||||
set
|
||||
{
|
||||
_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 1"; }
|
||||
}
|
||||
|
||||
public System.Drawing.Icon Icon
|
||||
{
|
||||
get { return Properties.Resources.ApplicationIcon; }
|
||||
}
|
||||
|
||||
public bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Settings.Default.WindowSettings1;
|
||||
}
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.WindowSettings1 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
Properties.Settings.Default.WindowSettings1 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +1,88 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TestWindow
|
||||
namespace TestWindow;
|
||||
|
||||
internal class WindowSource2 : IWindowSource, IDisposable
|
||||
{
|
||||
internal class WindowSource2 : IWindowSource, IDisposable
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
internal WindowSource2()
|
||||
{
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||
_floatingStatusWindow.SetText("Loading...");
|
||||
|
||||
internal WindowSource2()
|
||||
_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 Guid Id => Guid.Parse("F42F92BC-D397-497A-8E01-E71D084BEDB6");
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Test Window 2"; }
|
||||
}
|
||||
|
||||
public System.Drawing.Icon Icon
|
||||
{
|
||||
get { return Properties.Resources.ApplicationIcon; }
|
||||
}
|
||||
|
||||
public bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get { return Properties.Settings.Default.WindowSettings2; }
|
||||
set
|
||||
{
|
||||
_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 bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Settings.Default.WindowSettings2;
|
||||
}
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.WindowSettings2 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
Properties.Settings.Default.WindowSettings2 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +1,88 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TestWindow
|
||||
namespace TestWindow;
|
||||
|
||||
internal class WindowSource3 : IWindowSource, IDisposable
|
||||
{
|
||||
internal class WindowSource3 : IWindowSource, IDisposable
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
internal WindowSource3()
|
||||
{
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||
_floatingStatusWindow.SetText("Loading...");
|
||||
|
||||
internal WindowSource3()
|
||||
_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 Guid Id => Guid.Parse("CF7466DF-8980-452B-B2FA-290B26204BF2");
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Test Window 3"; }
|
||||
}
|
||||
|
||||
public System.Drawing.Icon Icon
|
||||
{
|
||||
get { return Properties.Resources.ApplicationIcon; }
|
||||
}
|
||||
|
||||
public bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get { return Properties.Settings.Default.WindowSettings3; }
|
||||
set
|
||||
{
|
||||
_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 bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Settings.Default.WindowSettings3;
|
||||
}
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.WindowSettings3 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
Properties.Settings.Default.WindowSettings3 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +1,88 @@
|
||||
using FloatingStatusWindowLibrary;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Timers;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace TestWindow
|
||||
namespace TestWindow;
|
||||
|
||||
internal class WindowSource4 : IWindowSource, IDisposable
|
||||
{
|
||||
internal class WindowSource4 : IWindowSource, IDisposable
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
internal WindowSource4()
|
||||
{
|
||||
private readonly FloatingStatusWindow _floatingStatusWindow;
|
||||
private readonly Timer _timer;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
_floatingStatusWindow = new FloatingStatusWindow(this);
|
||||
_floatingStatusWindow.SetText("Loading...");
|
||||
|
||||
internal WindowSource4()
|
||||
_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 Guid Id => Guid.Parse("0DD89F7E-3AD4-4226-8CBD-B75C8EBEEF32");
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return "Test Window 4"; }
|
||||
}
|
||||
|
||||
public System.Drawing.Icon Icon
|
||||
{
|
||||
get { return Properties.Resources.ApplicationIcon; }
|
||||
}
|
||||
|
||||
public bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get { return Properties.Settings.Default.WindowSettings4; }
|
||||
set
|
||||
{
|
||||
_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 bool HasSettingsMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public bool HasAboutMenu => true;
|
||||
|
||||
public void ShowAbout()
|
||||
{
|
||||
_floatingStatusWindow.SetText(Assembly.GetEntryAssembly().GetName().Version.ToString());
|
||||
}
|
||||
|
||||
public void ShowSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool HasRefreshMenu
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string WindowSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return Properties.Settings.Default.WindowSettings4;
|
||||
}
|
||||
set
|
||||
{
|
||||
Properties.Settings.Default.WindowSettings4 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
Properties.Settings.Default.WindowSettings4 = value;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user