mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-01-14 09:59:12 -05:00
Start upgrading to .NET 7
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +0,0 @@
|
||||
[submodule "Library/Common.Wpf"]
|
||||
path = Library/Common.Wpf
|
||||
url = https://github.com/ckaczor/Common.Wpf.git
|
||||
|
||||
@@ -1,25 +1,18 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.33530.505
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatingStatusWindow", "Library\FloatingStatusWindow.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FloatingStatusWindow", "Library\FloatingStatusWindow.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWindow", "TestWindow\TestWindow.csproj", "{0C541788-8FFD-47B6-8E6B-653A884CFA55}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestWindow", "TestWindow\TestWindow.csproj", "{0C541788-8FFD-47B6-8E6B-653A884CFA55}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{C4E7C6BF-86B2-433B-B842-31B82811FAC9}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
appveyor.yml = appveyor.yml
|
||||
Library\FloatingStatusWindow.nuspec = Library\FloatingStatusWindow.nuspec
|
||||
azure-pipelines.yml = azure-pipelines.yml
|
||||
LICENSE.md = LICENSE.md
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Wpf", "Library\Common.Wpf\Common.Wpf.csproj", "{0074C983-550E-4094-9E8C-F566FB669297}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Native", "Library\Common.Wpf\Common.Native\Common.Native.csproj", "{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -46,30 +39,6 @@ Global
|
||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x64.Build.0 = Debug|x64
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x86.Build.0 = Debug|x86
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x64.ActiveCfg = Release|x64
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x64.Build.0 = Release|x64
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x86.ActiveCfg = Release|x86
|
||||
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x86.Build.0 = Release|x86
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x64.Build.0 = Debug|x64
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x86.Build.0 = Debug|x86
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x64.ActiveCfg = Release|x64
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x64.Build.0 = Release|x64
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x86.ActiveCfg = Release|x86
|
||||
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
@@ -1,17 +1,27 @@
|
||||
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:properties="clr-namespace:FloatingStatusWindowLibrary.Properties"
|
||||
xmlns:properties="clr-namespace:ChrisKaczor.Wpf.FloatingStatusWindow.Properties"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:FloatingStatusWindowLibrary"
|
||||
xmlns:local="clr-namespace:ChrisKaczor.Wpf.FloatingStatusWindow"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
xmlns:Windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf" x:Class="FloatingStatusWindowLibrary.AppearanceWindow"
|
||||
Title="{x:Static properties:Resources.ChangeAppearanceWindow}" Height="290" Width="450" Binding.SourceUpdated="HandleWindowSourceUpdated"
|
||||
xmlns:windows="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.ControlBox"
|
||||
x:Class="ChrisKaczor.Wpf.FloatingStatusWindow.AppearanceWindow"
|
||||
Title="{x:Static properties:Resources.ChangeAppearanceWindow}"
|
||||
Height="290"
|
||||
Width="450"
|
||||
Binding.SourceUpdated="HandleWindowSourceUpdated"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ResizeMode="NoResize" SizeToContent="Height"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Height"
|
||||
mc:Ignorable="d"
|
||||
d:DataContext="{d:DesignInstance {x:Type local:WindowSettings}}"
|
||||
Closing="HandleWindowClosing" x:ClassModifier="internal" Windows:ControlBox.HasMaximizeButton="False" Windows:ControlBox.HasMinimizeButton="False" Windows:ControlBox.HasSystemMenu="False" WindowStyle="ToolWindow">
|
||||
Closing="HandleWindowClosing"
|
||||
x:ClassModifier="internal"
|
||||
windows:ControlBox.HasMaximizeButton="False"
|
||||
windows:ControlBox.HasMinimizeButton="False"
|
||||
windows:ControlBox.HasSystemMenu="False"
|
||||
WindowStyle="ToolWindow">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -26,15 +36,16 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.FontName}"
|
||||
x:Name="FontNameLabel"
|
||||
Target="{Binding ElementName=FontNameCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox x:Name="FontNameCombo" Grid.Row="0" Grid.Column="1"
|
||||
SelectedValuePath="Source"
|
||||
SelectedValue="{Binding FontName, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<Label Content="{x:Static properties:Resources.FontName}"
|
||||
x:Name="FontNameLabel"
|
||||
Target="{Binding ElementName=FontNameCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox x:Name="FontNameCombo"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
SelectedValuePath="Source"
|
||||
SelectedValue="{Binding FontName, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<ComboBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel />
|
||||
@@ -45,22 +56,26 @@
|
||||
<Border BorderBrush="{x:Null}"
|
||||
MinHeight="20">
|
||||
<TextBlock Text="{Binding}"
|
||||
FontFamily="{Binding}"
|
||||
FontSize="14" Height="Auto"
|
||||
VerticalAlignment="Center" />
|
||||
FontFamily="{Binding}"
|
||||
FontSize="14"
|
||||
Height="Auto"
|
||||
VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.FontSize}"
|
||||
x:Name="FontSizeLabel" Grid.Row="1" Grid.Column="0"
|
||||
Target="{Binding ElementName=FontSizeCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1" Grid.Row="1"
|
||||
x:Name="FontSizeCombo"
|
||||
Text="{Binding FontSize, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEditable="True" Margin="6">
|
||||
<Label Content="{x:Static properties:Resources.FontSize}"
|
||||
x:Name="FontSizeLabel"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Target="{Binding ElementName=FontSizeCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Grid.Row="1"
|
||||
x:Name="FontSizeCombo"
|
||||
Text="{Binding FontSize, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsEditable="True"
|
||||
Margin="6">
|
||||
<ComboBoxItem Content="8" />
|
||||
<ComboBoxItem Content="9" />
|
||||
<ComboBoxItem Content="10" />
|
||||
@@ -78,88 +93,104 @@
|
||||
<ComboBoxItem Content="48" />
|
||||
<ComboBoxItem Content="72" />
|
||||
</ComboBox>
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.ForegroundColor}"
|
||||
Grid.Row="2" Grid.Column="0" x:Name="ForegroundColorLabel"
|
||||
Target="{Binding ElementName=ForegroundColorPicker}"
|
||||
Margin="6" />
|
||||
<xctk:ColorPicker Grid.Column="1" Grid.Row="2"
|
||||
x:Name="ForegroundColorPicker"
|
||||
DisplayColorAndName="True"
|
||||
SelectedColor="{Binding FontColor, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6" />
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.Padding}"
|
||||
Grid.Row="3" Grid.Column="0" x:Name="PaddingLabel" Target="{Binding ElementName=PaddingUpDown}" Margin="6" />
|
||||
<Label Content="{x:Static properties:Resources.ForegroundColor}"
|
||||
Grid.Row="2"
|
||||
Grid.Column="0"
|
||||
x:Name="ForegroundColorLabel"
|
||||
Target="{Binding ElementName=ForegroundColorPicker}"
|
||||
Margin="6" />
|
||||
<xctk:ColorPicker Grid.Column="1"
|
||||
Grid.Row="2"
|
||||
x:Name="ForegroundColorPicker"
|
||||
DisplayColorAndName="True"
|
||||
SelectedColor="{Binding FontColor, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6" />
|
||||
<Label Content="{x:Static properties:Resources.Padding}"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
x:Name="PaddingLabel"
|
||||
Target="{Binding ElementName=PaddingUpDown}"
|
||||
Margin="6" />
|
||||
<xctk:IntegerUpDown Grid.Column="1"
|
||||
Grid.Row="3" x:Name="PaddingUpDown"
|
||||
Minimum="0" Maximum="20"
|
||||
Value="{Binding Padding, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextAlignment="Left" Margin="6" />
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.HorizontalAlignment}"
|
||||
Grid.Row="4" Grid.Column="0" x:Name="HorizontalAlignmentLabel"
|
||||
Target="{Binding ElementName=HorizontalAlignmentCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1" Grid.Row="4"
|
||||
x:Name="HorizontalAlignmentCombo"
|
||||
SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding HorizontalAlignment, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Left}"
|
||||
Tag="{x:Static HorizontalAlignment.Left}" />
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Right}"
|
||||
Tag="{x:Static HorizontalAlignment.Right}" />
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Center}"
|
||||
Tag="{x:Static HorizontalAlignment.Center}" />
|
||||
Grid.Row="3"
|
||||
x:Name="PaddingUpDown"
|
||||
Minimum="0"
|
||||
Maximum="20"
|
||||
Value="{Binding Padding, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
TextAlignment="Left"
|
||||
Margin="6" />
|
||||
<Label Content="{x:Static properties:Resources.HorizontalAlignment}"
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
x:Name="HorizontalAlignmentLabel"
|
||||
Target="{Binding ElementName=HorizontalAlignmentCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Grid.Row="4"
|
||||
x:Name="HorizontalAlignmentCombo"
|
||||
SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding HorizontalAlignment, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Left}"
|
||||
Tag="{x:Static HorizontalAlignment.Left}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Right}"
|
||||
Tag="{x:Static HorizontalAlignment.Right}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Center}"
|
||||
Tag="{x:Static HorizontalAlignment.Center}" />
|
||||
</ComboBox>
|
||||
<Label
|
||||
Content="{x:Static properties:Resources.VerticalAlignment}"
|
||||
Grid.Row="5" Grid.Column="0" x:Name="VerticalAlignmentLabel"
|
||||
Target="{Binding ElementName=VerticalAlignmentCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1" Grid.Row="5"
|
||||
x:Name="VerticalAlignmentCombo"
|
||||
SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding VerticalAlignment, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Top}"
|
||||
Tag="{x:Static VerticalAlignment.Top}" />
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Bottom}"
|
||||
Tag="{x:Static VerticalAlignment.Bottom}" />
|
||||
<ComboBoxItem
|
||||
Content="{x:Static properties:Resources.Center}"
|
||||
Tag="{x:Static VerticalAlignment.Center}" />
|
||||
<Label Content="{x:Static properties:Resources.VerticalAlignment}"
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
x:Name="VerticalAlignmentLabel"
|
||||
Target="{Binding ElementName=VerticalAlignmentCombo}"
|
||||
Margin="6" />
|
||||
<ComboBox Grid.Column="1"
|
||||
Grid.Row="5"
|
||||
x:Name="VerticalAlignmentCombo"
|
||||
SelectedValuePath="Tag"
|
||||
SelectedValue="{Binding VerticalAlignment, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="6">
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Top}"
|
||||
Tag="{x:Static VerticalAlignment.Top}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Bottom}"
|
||||
Tag="{x:Static VerticalAlignment.Bottom}" />
|
||||
<ComboBoxItem Content="{x:Static properties:Resources.Center}"
|
||||
Tag="{x:Static VerticalAlignment.Center}" />
|
||||
</ComboBox>
|
||||
<Grid Grid.Column="1" Grid.Row="6"
|
||||
HorizontalAlignment="Right" x:Name="GridButtons" Width="Auto" Grid.IsSharedSizeScope="True"
|
||||
Height="38" VerticalAlignment="Bottom">
|
||||
<Grid Grid.Column="1"
|
||||
Grid.Row="6"
|
||||
HorizontalAlignment="Right"
|
||||
x:Name="GridButtons"
|
||||
Width="Auto"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
Height="38"
|
||||
VerticalAlignment="Bottom">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="buttons" />
|
||||
SharedSizeGroup="buttons" />
|
||||
<ColumnDefinition Width="Auto"
|
||||
SharedSizeGroup="buttons" />
|
||||
SharedSizeGroup="buttons" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
Content="{x:Static properties:Resources.OK}"
|
||||
<Button Content="{x:Static properties:Resources.OK}"
|
||||
Height="23"
|
||||
HorizontalAlignment="Stretch" Margin="6"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="6"
|
||||
x:Name="OkayButton"
|
||||
VerticalAlignment="Stretch" Width="75"
|
||||
Padding="7,3" IsDefault="True"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="75"
|
||||
Padding="7,3"
|
||||
IsDefault="True"
|
||||
Click="HandleOkayButtonClick" />
|
||||
<Button
|
||||
Content="{x:Static properties:Resources.Cancel}"
|
||||
Grid.Column="1" Height="23"
|
||||
HorizontalAlignment="Stretch" Margin="6"
|
||||
<Button Content="{x:Static properties:Resources.Cancel}"
|
||||
Grid.Column="1"
|
||||
Height="23"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="6"
|
||||
x:Name="CancelButton"
|
||||
VerticalAlignment="Stretch" Width="75"
|
||||
Padding="7,3" IsCancel="True" />
|
||||
VerticalAlignment="Stretch"
|
||||
Width="75"
|
||||
Padding="7,3"
|
||||
IsCancel="True" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
@@ -1,50 +1,46 @@
|
||||
using Common.Wpf.Extensions;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
internal partial class AppearanceWindow
|
||||
{
|
||||
internal partial class AppearanceWindow
|
||||
private WindowSettings _currentSettings;
|
||||
|
||||
private readonly WindowSettings _originalSettings;
|
||||
|
||||
public AppearanceWindow(WindowSettings windowSettings)
|
||||
{
|
||||
private WindowSettings _currentSettings;
|
||||
InitializeComponent();
|
||||
|
||||
private readonly WindowSettings _originalSettings;
|
||||
_currentSettings = windowSettings;
|
||||
|
||||
public AppearanceWindow(WindowSettings windowSettings)
|
||||
{
|
||||
InitializeComponent();
|
||||
_originalSettings = (WindowSettings)_currentSettings.Clone();
|
||||
|
||||
_currentSettings = windowSettings;
|
||||
var allFonts = Fonts.SystemFontFamilies.OrderBy(x => x.Source);
|
||||
|
||||
_originalSettings = (WindowSettings) _currentSettings.Clone();
|
||||
FontNameCombo.ItemsSource = allFonts;
|
||||
|
||||
var allFonts = Fonts.SystemFontFamilies.OrderBy(x => x.Source);
|
||||
|
||||
var filteredFonts = allFonts.Where(f => FontExtensions.IsComposite(f) || (!FontExtensions.IsSymbol(f) && FontExtensions.IsVisible(f)));
|
||||
|
||||
FontNameCombo.ItemsSource = filteredFonts;
|
||||
|
||||
DataContext = _currentSettings;
|
||||
}
|
||||
|
||||
private void HandleOkayButtonClick(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void HandleWindowSourceUpdated(object sender, System.Windows.Data.DataTransferEventArgs e)
|
||||
{
|
||||
_currentSettings.Apply();
|
||||
}
|
||||
|
||||
private void HandleWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (DialogResult == true)
|
||||
return;
|
||||
|
||||
_currentSettings = _originalSettings;
|
||||
_currentSettings.Apply();
|
||||
}
|
||||
DataContext = _currentSettings;
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleOkayButtonClick(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
DialogResult = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void HandleWindowSourceUpdated(object sender, System.Windows.Data.DataTransferEventArgs e)
|
||||
{
|
||||
_currentSettings.Apply();
|
||||
}
|
||||
|
||||
private void HandleWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (DialogResult == true)
|
||||
return;
|
||||
|
||||
_currentSettings = _originalSettings;
|
||||
_currentSettings.Apply();
|
||||
}
|
||||
}
|
||||
Submodule Library/Common.Wpf deleted from 8a82786166
@@ -1,270 +1,258 @@
|
||||
using FloatingStatusWindowLibrary.Properties;
|
||||
using Hardcodet.Wpf.TaskbarNotification;
|
||||
using ChrisKaczor.Wpf.FloatingStatusWindow.Properties;
|
||||
using H.NotifyIcon;
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Point = System.Windows.Point;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
[PublicAPI]
|
||||
public class FloatingStatusWindow : IDisposable
|
||||
{
|
||||
public class FloatingStatusWindow : IDisposable
|
||||
public event EventHandler WindowResized = delegate { };
|
||||
public event EventHandler WindowClosed = delegate { };
|
||||
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly TaskbarIcon _trayIcon;
|
||||
|
||||
private readonly MenuItem _allWindowsMenuItem;
|
||||
private readonly Separator _allWindowsSeparator;
|
||||
|
||||
private readonly MenuItem _lockMenuItem;
|
||||
private readonly MenuItem _autoStartMenuItem;
|
||||
|
||||
private readonly IWindowSource _windowSource;
|
||||
|
||||
public FloatingStatusWindow(IWindowSource windowSource)
|
||||
{
|
||||
public event EventHandler WindowResized = delegate { };
|
||||
public event EventHandler WindowClosed = delegate { };
|
||||
_windowSource = windowSource;
|
||||
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly TaskbarIcon _taskbarIcon;
|
||||
var contextMenu = new ContextMenu();
|
||||
contextMenu.Opened += HandleContextMenuOpened;
|
||||
|
||||
private readonly MenuItem _allWindowsMenuItem;
|
||||
private readonly Separator _allWindowsSeparator;
|
||||
MenuItem menuItem;
|
||||
|
||||
private readonly MenuItem _lockMenuItem;
|
||||
private readonly MenuItem _autoStartMenuItem;
|
||||
|
||||
private readonly IWindowSource _windowSource;
|
||||
|
||||
public FloatingStatusWindow(IWindowSource windowSource)
|
||||
if (_windowSource.HasSettingsMenu)
|
||||
{
|
||||
_windowSource = windowSource;
|
||||
|
||||
var contextMenu = new ContextMenu();
|
||||
contextMenu.Opened += HandleContextMenuOpened;
|
||||
|
||||
MenuItem menuItem;
|
||||
|
||||
if (_windowSource.HasSettingsMenu)
|
||||
{
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuSettings };
|
||||
menuItem.Click += (sender, args) => _windowSource.ShowSettings();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
if (_windowSource.HasRefreshMenu)
|
||||
{
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuRefresh };
|
||||
menuItem.Click += (sender, args) => _windowSource.Refresh();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
_allWindowsMenuItem = new MenuItem { Header = Resources.AllWindowsMenu };
|
||||
contextMenu.Items.Add(_allWindowsMenuItem);
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuLock };
|
||||
menuItem.Click += (sender, args) => WindowManager.SetLockOnAll(true);
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuUnlock };
|
||||
menuItem.Click += (sender, args) => WindowManager.SetLockOnAll(false);
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
_allWindowsMenuItem.Items.Add(new Separator());
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuClose };
|
||||
menuItem.Click += (sender, args) => WindowManager.CloseAll();
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
_allWindowsSeparator = new Separator();
|
||||
contextMenu.Items.Add(_allWindowsSeparator);
|
||||
|
||||
var optionsMenu = new MenuItem { Name = "contextMenuItemOptions", Header = Resources.WindowMenu };
|
||||
contextMenu.Items.Add(optionsMenu);
|
||||
|
||||
_lockMenuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuItemLocked",
|
||||
IsChecked = false,
|
||||
Header = Resources.ContextMenuLocked
|
||||
};
|
||||
_lockMenuItem.Click += HandleLockedMenuItemClicked;
|
||||
optionsMenu.Items.Add(_lockMenuItem);
|
||||
|
||||
if (StartManager.ManageAutoStart)
|
||||
{
|
||||
optionsMenu.Items.Add(new Separator());
|
||||
|
||||
_autoStartMenuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuItemAutoStart",
|
||||
IsChecked = StartManager.AutoStartEnabled,
|
||||
Header = Resources.ContextMenuAutoStart
|
||||
|
||||
};
|
||||
_autoStartMenuItem.Click += (sender, args) => StartManager.AutoStartEnabled = !StartManager.AutoStartEnabled;
|
||||
optionsMenu.Items.Add(_autoStartMenuItem);
|
||||
}
|
||||
|
||||
optionsMenu.Items.Add(new Separator());
|
||||
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuResetPosition",
|
||||
Header = Resources.ContextMenuResetPosition
|
||||
};
|
||||
menuItem.Click += HandleResetPositionMenuItemClick;
|
||||
optionsMenu.Items.Add(menuItem);
|
||||
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuChangeAppearance",
|
||||
Header = Resources.ContextMenuChangeAppearance
|
||||
};
|
||||
menuItem.Click += HandleChangeAppearanceMenuItemClick;
|
||||
optionsMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
|
||||
if (_windowSource.HasAboutMenu)
|
||||
{
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuAbout };
|
||||
menuItem.Click += (sender, args) => _windowSource.ShowAbout();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuItemExit",
|
||||
Header = Resources.ContextMenuExit
|
||||
};
|
||||
menuItem.Click += HandleExitMenuItemClick;
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuSettings };
|
||||
menuItem.Click += (_, _) => _windowSource.ShowSettings();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
_taskbarIcon = new TaskbarIcon
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
if (_windowSource.HasRefreshMenu)
|
||||
{
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuRefresh };
|
||||
menuItem.Click += (_, _) => _windowSource.Refresh();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
_allWindowsMenuItem = new MenuItem { Header = Resources.AllWindowsMenu };
|
||||
contextMenu.Items.Add(_allWindowsMenuItem);
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuLock };
|
||||
menuItem.Click += (_, _) => WindowManager.SetLockOnAll(true);
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuUnlock };
|
||||
menuItem.Click += (_, _) => WindowManager.SetLockOnAll(false);
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
_allWindowsMenuItem.Items.Add(new Separator());
|
||||
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuClose };
|
||||
menuItem.Click += (_, _) => WindowManager.CloseAll();
|
||||
_allWindowsMenuItem.Items.Add(menuItem);
|
||||
|
||||
_allWindowsSeparator = new Separator();
|
||||
contextMenu.Items.Add(_allWindowsSeparator);
|
||||
|
||||
var optionsMenu = new MenuItem { Name = "contextMenuItemOptions", Header = Resources.WindowMenu };
|
||||
contextMenu.Items.Add(optionsMenu);
|
||||
|
||||
_lockMenuItem = new MenuItem
|
||||
{
|
||||
Name = "contextMenuItemLocked",
|
||||
IsChecked = false,
|
||||
Header = Resources.ContextMenuLocked
|
||||
};
|
||||
_lockMenuItem.Click += HandleLockedMenuItemClicked;
|
||||
optionsMenu.Items.Add(_lockMenuItem);
|
||||
|
||||
if (StartManager.ManageAutoStart)
|
||||
{
|
||||
optionsMenu.Items.Add(new Separator());
|
||||
|
||||
_autoStartMenuItem = new MenuItem
|
||||
{
|
||||
ToolTipText = _windowSource.Name,
|
||||
Icon = _windowSource.Icon,
|
||||
ContextMenu = contextMenu
|
||||
Name = "contextMenuItemAutoStart",
|
||||
IsChecked = StartManager.AutoStartEnabled,
|
||||
Header = Resources.ContextMenuAutoStart
|
||||
};
|
||||
|
||||
_mainWindow = new MainWindow(windowSource);
|
||||
_mainWindow.Closed += HandleMainWindowClosed;
|
||||
_mainWindow.SizeChanged += HandleWindowSizeChanged;
|
||||
_mainWindow.LocationChanged += HandleWindowLocationChanged;
|
||||
_mainWindow.LockStateChanged += HandleWindowLockStateChanged;
|
||||
|
||||
_mainWindow.Show();
|
||||
_autoStartMenuItem.Click += (_, _) => StartManager.AutoStartEnabled = !StartManager.AutoStartEnabled;
|
||||
optionsMenu.Items.Add(_autoStartMenuItem);
|
||||
}
|
||||
|
||||
private void HandleResetPositionMenuItemClick(object sender, RoutedEventArgs e)
|
||||
optionsMenu.Items.Add(new Separator());
|
||||
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
_mainWindow.Left = 0;
|
||||
_mainWindow.Top = 0;
|
||||
_mainWindow.Width = 300;
|
||||
_mainWindow.Height = 300;
|
||||
}
|
||||
Name = "contextMenuResetPosition",
|
||||
Header = Resources.ContextMenuResetPosition
|
||||
};
|
||||
menuItem.Click += HandleResetPositionMenuItemClick;
|
||||
optionsMenu.Items.Add(menuItem);
|
||||
|
||||
private void HandleWindowLockStateChanged(object sender, EventArgs e)
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
Save();
|
||||
}
|
||||
Name = "contextMenuChangeAppearance",
|
||||
Header = Resources.ContextMenuChangeAppearance
|
||||
};
|
||||
menuItem.Click += HandleChangeAppearanceMenuItemClick;
|
||||
optionsMenu.Items.Add(menuItem);
|
||||
|
||||
private void HandleWindowLocationChanged(object sender, EventArgs e)
|
||||
contextMenu.Items.Add(new Separator());
|
||||
|
||||
if (_windowSource.HasAboutMenu)
|
||||
{
|
||||
Save();
|
||||
menuItem = new MenuItem { Header = Resources.ContextMenuAbout };
|
||||
menuItem.Click += (_, _) => _windowSource.ShowAbout();
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
contextMenu.Items.Add(new Separator());
|
||||
}
|
||||
|
||||
private void HandleWindowSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
menuItem = new MenuItem
|
||||
{
|
||||
WindowResized(this, new EventArgs());
|
||||
Name = "contextMenuItemExit",
|
||||
Header = Resources.ContextMenuExit
|
||||
};
|
||||
menuItem.Click += HandleExitMenuItemClick;
|
||||
contextMenu.Items.Add(menuItem);
|
||||
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleChangeAppearanceMenuItemClick(object sender, RoutedEventArgs e)
|
||||
_trayIcon = new TaskbarIcon
|
||||
{
|
||||
var appearanceWindow = new AppearanceWindow(_mainWindow.WindowSettings);
|
||||
appearanceWindow.ShowDialog();
|
||||
ToolTipText = _windowSource.Name,
|
||||
Icon = _windowSource.Icon,
|
||||
ContextMenu = contextMenu,
|
||||
Id = _windowSource.Id
|
||||
};
|
||||
|
||||
Save();
|
||||
}
|
||||
_trayIcon.ForceCreate();
|
||||
|
||||
private void HandleMainWindowClosed(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
_mainWindow = new MainWindow(windowSource);
|
||||
_mainWindow.Closed += HandleMainWindowClosed;
|
||||
_mainWindow.SizeChanged += HandleWindowSizeChanged;
|
||||
_mainWindow.LocationChanged += HandleWindowLocationChanged;
|
||||
_mainWindow.LockStateChanged += HandleWindowLockStateChanged;
|
||||
|
||||
WindowClosed(null, new EventArgs());
|
||||
|
||||
_taskbarIcon.Dispose();
|
||||
}
|
||||
|
||||
public ContextMenu ContextMenu
|
||||
{
|
||||
get { return _taskbarIcon.ContextMenu; }
|
||||
}
|
||||
|
||||
private void HandleContextMenuOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_lockMenuItem.IsChecked = _mainWindow.WindowSettings.Locked;
|
||||
|
||||
if (_autoStartMenuItem != null)
|
||||
_autoStartMenuItem.IsChecked = StartManager.AutoStartEnabled;
|
||||
|
||||
var windowCount = WindowManager.GetWindowList().Count;
|
||||
|
||||
_allWindowsMenuItem.Visibility = windowCount <= 1 ? Visibility.Collapsed : Visibility.Visible;
|
||||
_allWindowsSeparator.Visibility = _allWindowsMenuItem.Visibility;
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
_mainWindow.HtmlLabel.Text = text;
|
||||
}
|
||||
|
||||
private void HandleLockedMenuItemClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_mainWindow.WindowSettings.Locked = !_mainWindow.WindowSettings.Locked;
|
||||
_mainWindow.WindowSettings.Apply();
|
||||
}
|
||||
|
||||
private void HandleExitMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Save();
|
||||
|
||||
_mainWindow.Close();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_windowSource.WindowSettings = _mainWindow.WindowSettings.Save();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_taskbarIcon.Dispose();
|
||||
|
||||
_mainWindow.Close();
|
||||
}
|
||||
|
||||
public Point Location
|
||||
{
|
||||
get { return new Point(_mainWindow.Left, _mainWindow.Top); }
|
||||
}
|
||||
|
||||
public Size Size
|
||||
{
|
||||
get { return new Size(_mainWindow.Width, _mainWindow.Height); }
|
||||
}
|
||||
|
||||
public Size ContentSize
|
||||
{
|
||||
get { return new Size(_mainWindow.HtmlLabel.ActualWidth, _mainWindow.HtmlLabel.ActualHeight); }
|
||||
}
|
||||
|
||||
public WindowSettings Settings
|
||||
{
|
||||
get { return _mainWindow.WindowSettings; }
|
||||
}
|
||||
|
||||
public string IconToolTipText
|
||||
{
|
||||
get { return _taskbarIcon.ToolTipText; }
|
||||
set { _taskbarIcon.ToolTipText = value; }
|
||||
}
|
||||
_mainWindow.Show();
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleResetPositionMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_mainWindow.Left = 0;
|
||||
_mainWindow.Top = 0;
|
||||
_mainWindow.Width = 300;
|
||||
_mainWindow.Height = 300;
|
||||
}
|
||||
|
||||
private void HandleWindowLockStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleWindowLocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleWindowSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
WindowResized(this, EventArgs.Empty);
|
||||
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleChangeAppearanceMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var appearanceWindow = new AppearanceWindow(_mainWindow.WindowSettings);
|
||||
appearanceWindow.ShowDialog();
|
||||
|
||||
Save();
|
||||
}
|
||||
|
||||
private void HandleMainWindowClosed(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
|
||||
WindowClosed(null, EventArgs.Empty);
|
||||
|
||||
_trayIcon.Dispose();
|
||||
}
|
||||
|
||||
public ContextMenu ContextMenu => _trayIcon.ContextMenu;
|
||||
|
||||
private void HandleContextMenuOpened(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_lockMenuItem.IsChecked = _mainWindow.WindowSettings.Locked;
|
||||
|
||||
if (_autoStartMenuItem != null)
|
||||
_autoStartMenuItem.IsChecked = StartManager.AutoStartEnabled;
|
||||
|
||||
var windowCount = WindowManager.GetWindowList().Count;
|
||||
|
||||
_allWindowsMenuItem.Visibility = windowCount <= 1 ? Visibility.Collapsed : Visibility.Visible;
|
||||
_allWindowsSeparator.Visibility = _allWindowsMenuItem.Visibility;
|
||||
}
|
||||
|
||||
public void SetText(string text)
|
||||
{
|
||||
_mainWindow.HtmlLabel.Text = text;
|
||||
}
|
||||
|
||||
private void HandleLockedMenuItemClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_mainWindow.WindowSettings.Locked = !_mainWindow.WindowSettings.Locked;
|
||||
_mainWindow.WindowSettings.Apply();
|
||||
}
|
||||
|
||||
private void HandleExitMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Save();
|
||||
|
||||
_mainWindow.Close();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_windowSource.WindowSettings = _mainWindow.WindowSettings.Save();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_trayIcon.Dispose();
|
||||
|
||||
_mainWindow.Close();
|
||||
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
public Point Location => new(_mainWindow.Left, _mainWindow.Top);
|
||||
|
||||
public Size Size => new(_mainWindow.Width, _mainWindow.Height);
|
||||
|
||||
public Size ContentSize => new(_mainWindow.HtmlLabel.ActualWidth, _mainWindow.HtmlLabel.ActualHeight);
|
||||
|
||||
public WindowSettings Settings => _mainWindow.WindowSettings;
|
||||
|
||||
public string IconToolTipText
|
||||
{
|
||||
get => _trayIcon.ToolTipText;
|
||||
set => _trayIcon.ToolTipText = value;
|
||||
}
|
||||
}
|
||||
@@ -1,117 +1,42 @@
|
||||
<?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>{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}</ProjectGuid>
|
||||
<TargetFramework>net7.0-windows</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>FloatingStatusWindowLibrary</RootNamespace>
|
||||
<AssemblyName>FloatingStatusWindowLibrary</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>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
<RootNamespace>ChrisKaczor.Wpf.FloatingStatusWindow</RootNamespace>
|
||||
<AssemblyName>ChrisKaczor.Wpf.FloatingStatusWindow</AssemblyName>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<UseWPF>true</UseWPF>
|
||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Title>FloatingStatusWindow</Title>
|
||||
<Authors>Chris Kaczor</Authors>
|
||||
<Company>Chris Kaczor</Company>
|
||||
<Description>Library to create a "floating" window that blends in with the Windows desktop and allows displaying status text.</Description>
|
||||
<PackageProjectUrl>https://github.com/ckaczor/FloatingStatusWindow</PackageProjectUrl>
|
||||
<PackageTags>wpf</PackageTags>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppearanceWindow.xaml.cs">
|
||||
<DependentUpon>AppearanceWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="FloatingStatusWindow.cs" />
|
||||
<Compile Include="IWindowSource.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<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="StartManager.cs" />
|
||||
<Compile Include="WindowManager.cs" />
|
||||
<Compile Include="WindowSettings.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<AppDesigner Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Application.StartWithWindows" Version="1.0.5" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Controls.HtmlTextBlock" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Windows.ControlBox" Version="1.0.3" />
|
||||
<PackageReference Include="ChrisKaczor.Wpf.Windows.SnappingWindow" Version="1.0.4" />
|
||||
<PackageReference Include="Extended.Wpf.Toolkit" Version="4.5.0" />
|
||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.108" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="AppearanceWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="Common.Wpf\Common.Native\Common.Native.csproj">
|
||||
<Project>{ed1c07a1-54f5-4796-8b06-2a0bb1960d84}</Project>
|
||||
<Name>Common.Native</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="Common.Wpf\Common.Wpf.csproj">
|
||||
<Project>{0074c983-550e-4094-9e8c-f566fb669297}</Project>
|
||||
<Name>Common.Wpf</Name>
|
||||
</ProjectReference>
|
||||
<EmbeddedResource Update="Properties\Resources.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Extended.Wpf.Toolkit">
|
||||
<Version>3.2.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Hardcodet.NotifyIcon.Wpf">
|
||||
<Version>1.0.8</Version>
|
||||
</PackageReference>
|
||||
</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,15 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>FloatingStatusWindow</id>
|
||||
<version>$version$</version>
|
||||
<authors>Chris Kaczor</authors>
|
||||
<description>Library to create a "floating" window that blends in with the Windows desktop and allows displaying status text.</description>
|
||||
<projectUrl>https://github.com/ckaczor/FloatingStatusWindow</projectUrl>
|
||||
<licenseUrl>https://raw.githubusercontent.com/ckaczor/FloatingStatusWindow/master/LICENSE.md</licenseUrl>
|
||||
<tags>wpf</tags>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="bin\$configuration$\**\*" target="lib\net45" />
|
||||
</files>
|
||||
</package>
|
||||
@@ -1,19 +1,20 @@
|
||||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
public interface IWindowSource
|
||||
{
|
||||
public interface IWindowSource
|
||||
{
|
||||
string Name { get; }
|
||||
string WindowSettings { get; set; }
|
||||
Icon Icon { get; }
|
||||
Guid Id { get; }
|
||||
string Name { get; }
|
||||
string WindowSettings { get; set; }
|
||||
Icon Icon { get; }
|
||||
|
||||
bool HasSettingsMenu { get; }
|
||||
bool HasRefreshMenu { get; }
|
||||
bool HasAboutMenu { get; }
|
||||
bool HasSettingsMenu { get; }
|
||||
bool HasRefreshMenu { get; }
|
||||
bool HasAboutMenu { get; }
|
||||
|
||||
void ShowSettings();
|
||||
void Refresh();
|
||||
void ShowAbout();
|
||||
}
|
||||
}
|
||||
void ShowSettings();
|
||||
void Refresh();
|
||||
void ShowAbout();
|
||||
}
|
||||
@@ -1,20 +1,21 @@
|
||||
<windows:SnappingWindow x:Class="FloatingStatusWindowLibrary.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:htmlLabelControl="clr-namespace:Common.Wpf.HtmlLabelControl;assembly=Common.Wpf"
|
||||
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
|
||||
windows:ControlBox.HasMaximizeButton="False"
|
||||
windows:ControlBox.HasMinimizeButton="False"
|
||||
windows:ControlBox.HasSystemMenu="False"
|
||||
Title="FloatingStatusWindow"
|
||||
Height="250"
|
||||
Width="400"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
ResizeMode="CanResize"
|
||||
Background="Transparent"
|
||||
ShowInTaskbar="False"
|
||||
x:ClassModifier="internal">
|
||||
<snappingWindow:SnappingWindow x:Class="ChrisKaczor.Wpf.FloatingStatusWindow.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:snappingWindow="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.SnappingWindow"
|
||||
xmlns:controlBox="clr-namespace:ChrisKaczor.Wpf.Windows;assembly=ChrisKaczor.Wpf.Windows.ControlBox"
|
||||
xmlns:controls="clr-namespace:ChrisKaczor.Wpf.Controls;assembly=ChrisKaczor.Wpf.Controls.HtmlTextBlock"
|
||||
controlBox:ControlBox.HasMaximizeButton="False"
|
||||
controlBox:ControlBox.HasMinimizeButton="False"
|
||||
controlBox:ControlBox.HasSystemMenu="False"
|
||||
Title="FloatingStatusWindow"
|
||||
Height="250"
|
||||
Width="400"
|
||||
WindowStyle="None"
|
||||
AllowsTransparency="True"
|
||||
ResizeMode="CanResize"
|
||||
Background="Transparent"
|
||||
ShowInTaskbar="False"
|
||||
x:ClassModifier="internal">
|
||||
|
||||
<Border Name="BorderFull"
|
||||
BorderThickness="4,0,4,4"
|
||||
@@ -41,13 +42,17 @@
|
||||
Content=""
|
||||
FontFamily="Segoe UI Symbol"
|
||||
FontSize="12"
|
||||
Padding="0"></Button>
|
||||
Padding="0">
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
<htmlLabelControl:HtmlLabel Name="HtmlLabel"
|
||||
<Grid Name="ContentGrid">
|
||||
<controls:HtmlTextBlock Name="HtmlLabel"
|
||||
Foreground="White"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,24,0,0" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</windows:SnappingWindow>
|
||||
|
||||
</snappingWindow:SnappingWindow>
|
||||
@@ -1,4 +1,4 @@
|
||||
using Common.Wpf.Windows;
|
||||
using ChrisKaczor.Wpf.Windows;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
@@ -7,132 +7,125 @@ using System.Windows.Media;
|
||||
using System.Windows.Shell;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
internal partial class MainWindow
|
||||
{
|
||||
internal partial class MainWindow
|
||||
public event EventHandler LockStateChanged = delegate { };
|
||||
|
||||
private const int WindowCaptionHeight = 24;
|
||||
|
||||
private readonly WindowChrome _windowChrome;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
public WindowSettings WindowSettings { get; set; }
|
||||
|
||||
private bool _locked;
|
||||
|
||||
public bool Locked
|
||||
{
|
||||
public event EventHandler LockStateChanged = delegate { };
|
||||
|
||||
private const int WindowCaptionHeight = 24;
|
||||
|
||||
private readonly WindowChrome _windowChrome;
|
||||
private readonly Dispatcher _dispatcher;
|
||||
|
||||
private WindowSettings _windowSettings;
|
||||
public WindowSettings WindowSettings
|
||||
get => _locked;
|
||||
set
|
||||
{
|
||||
get { return _windowSettings; }
|
||||
set { _windowSettings = value; }
|
||||
}
|
||||
_locked = value;
|
||||
|
||||
private bool _locked;
|
||||
public bool Locked
|
||||
{
|
||||
get { return _locked; }
|
||||
set
|
||||
{
|
||||
_locked = value;
|
||||
_windowChrome.CaptionHeight = (_locked ? 0 : WindowCaptionHeight);
|
||||
|
||||
_windowChrome.CaptionHeight = (_locked ? 0 : WindowCaptionHeight);
|
||||
HtmlLabel.Margin = new Thickness(0, (_locked ? 0 : WindowCaptionHeight), 0, 0);
|
||||
|
||||
HtmlLabel.Margin = new Thickness(0, (_locked ? 0 : WindowCaptionHeight), 0, 0);
|
||||
// Show the header border if the window is unlocked
|
||||
HeaderBorder.Visibility = (_locked ? Visibility.Collapsed : Visibility.Visible);
|
||||
|
||||
// Show the header border if the window is unlocked
|
||||
HeaderBorder.Visibility = (_locked ? Visibility.Collapsed : Visibility.Visible);
|
||||
// Show and enable the window border if the window is unlocked
|
||||
BorderFull.BorderBrush = (_locked ? Brushes.Transparent : SystemColors.ActiveCaptionBrush);
|
||||
BorderFull.IsEnabled = !_locked;
|
||||
|
||||
// Show and enable the window border if the window is unlocked
|
||||
BorderFull.BorderBrush = (_locked ? Brushes.Transparent : SystemColors.ActiveCaptionBrush);
|
||||
BorderFull.IsEnabled = !_locked;
|
||||
|
||||
LockStateChanged(null, new EventArgs());
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow(IWindowSource windowSource)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||
|
||||
// Create and set the window chrome
|
||||
_windowChrome = new WindowChrome { CaptionHeight = WindowCaptionHeight };
|
||||
WindowChrome.SetWindowChrome(this, _windowChrome);
|
||||
|
||||
// Load the window settings
|
||||
_windowSettings = WindowSettings.Load(windowSource.WindowSettings);
|
||||
_windowSettings.Name = windowSource.Name;
|
||||
_windowSettings.SetWindow(this);
|
||||
|
||||
// Set the background of the border
|
||||
HeaderBorder.Background = SystemColors.ActiveCaptionBrush;
|
||||
|
||||
// Configure the header label
|
||||
HeaderLabel.Foreground = SystemColors.InactiveCaptionTextBrush;
|
||||
HeaderLabel.Content = _windowSettings.Name;
|
||||
|
||||
// Get the thickness so we can size the visual border
|
||||
var resizeThickness = _windowChrome.ResizeBorderThickness;
|
||||
|
||||
// Set the color of the border
|
||||
BorderFull.BorderBrush = SystemColors.ActiveCaptionBrush;
|
||||
BorderFull.BorderThickness = new Thickness(resizeThickness.Left, 0, resizeThickness.Right, resizeThickness.Bottom);
|
||||
|
||||
// Apply the stored settings
|
||||
_windowSettings.Apply();
|
||||
}
|
||||
|
||||
protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
if (msg == WindowManager.SetLockMessage)
|
||||
{
|
||||
var lockState = (wParam == (IntPtr) 1);
|
||||
|
||||
_dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
WindowSettings.Locked = lockState;
|
||||
Locked = lockState;
|
||||
});
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (msg == WindowManager.CloseMessage)
|
||||
{
|
||||
_dispatcher.InvokeAsync(Close);
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
return base.WndProc(hwnd, msg, wParam, lParam, ref handled);
|
||||
}
|
||||
|
||||
protected override void OnLocationChanged(EventArgs e)
|
||||
{
|
||||
base.OnLocationChanged(e);
|
||||
|
||||
_windowSettings.Location = new Point(Left, Top);
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
|
||||
_windowSettings.Size = new Size(Width, Height);
|
||||
}
|
||||
|
||||
protected override List<WindowInformation> OtherWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
var windowHandle = new WindowInteropHelper(this).Handle;
|
||||
|
||||
return WindowManager.GetWindowList(windowHandle);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleChangeAppearanceClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var appearanceWindow = new AppearanceWindow(WindowSettings);
|
||||
appearanceWindow.ShowDialog();
|
||||
LockStateChanged(null, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow(IWindowSource windowSource)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_dispatcher = Dispatcher.CurrentDispatcher;
|
||||
|
||||
// Create and set the window chrome
|
||||
_windowChrome = new WindowChrome { CaptionHeight = WindowCaptionHeight };
|
||||
WindowChrome.SetWindowChrome(this, _windowChrome);
|
||||
|
||||
// Load the window settings
|
||||
WindowSettings = WindowSettings.Load(windowSource.WindowSettings);
|
||||
WindowSettings.Name = windowSource.Name;
|
||||
WindowSettings.SetWindow(this);
|
||||
|
||||
// Set the background of the border
|
||||
HeaderBorder.Background = SystemColors.ActiveCaptionBrush;
|
||||
|
||||
// Configure the header label
|
||||
HeaderLabel.Foreground = SystemColors.InactiveCaptionTextBrush;
|
||||
HeaderLabel.Content = WindowSettings.Name;
|
||||
|
||||
// Get the thickness so we can size the visual border
|
||||
var resizeThickness = _windowChrome.ResizeBorderThickness;
|
||||
|
||||
// Set the color of the border
|
||||
BorderFull.BorderBrush = SystemColors.ActiveCaptionBrush;
|
||||
BorderFull.BorderThickness = new Thickness(resizeThickness.Left, 0, resizeThickness.Right, resizeThickness.Bottom);
|
||||
|
||||
// Apply the stored settings
|
||||
WindowSettings.Apply();
|
||||
}
|
||||
|
||||
protected override IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
|
||||
{
|
||||
if (msg == WindowManager.SetLockMessage)
|
||||
{
|
||||
var lockState = (wParam == 1);
|
||||
|
||||
_dispatcher.InvokeAsync(() =>
|
||||
{
|
||||
WindowSettings.Locked = lockState;
|
||||
Locked = lockState;
|
||||
});
|
||||
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
if (msg != WindowManager.CloseMessage)
|
||||
return base.WndProc(hwnd, msg, wParam, lParam, ref handled);
|
||||
|
||||
_dispatcher.InvokeAsync(Close);
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
protected override void OnLocationChanged(EventArgs e)
|
||||
{
|
||||
base.OnLocationChanged(e);
|
||||
|
||||
WindowSettings.Location = new Point(Left, Top);
|
||||
}
|
||||
|
||||
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
|
||||
{
|
||||
base.OnRenderSizeChanged(sizeInfo);
|
||||
|
||||
WindowSettings.Size = new Size(Width, Height);
|
||||
}
|
||||
|
||||
protected override List<WindowInformation> OtherWindows
|
||||
{
|
||||
get
|
||||
{
|
||||
var windowHandle = new WindowInteropHelper(this).Handle;
|
||||
|
||||
return WindowManager.GetWindowList(windowHandle);
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleChangeAppearanceClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var appearanceWindow = new AppearanceWindow(WindowSettings);
|
||||
appearanceWindow.ShowDialog();
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Windows;
|
||||
|
||||
[assembly: AssemblyTitle("FloatingStatusWindowLibrary")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Chris Kaczor")]
|
||||
[assembly: AssemblyProduct("FloatingStatusWindowLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © Chris Kaczor 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: SupportedOSPlatform("windows")]
|
||||
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("2.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("2.0.0.0")]
|
||||
|
||||
6
Library/Properties/Resources.Designer.cs
generated
6
Library/Properties/Resources.Designer.cs
generated
@@ -8,7 +8,7 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FloatingStatusWindowLibrary.Properties {
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace FloatingStatusWindowLibrary.Properties {
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
public class Resources {
|
||||
@@ -39,7 +39,7 @@ namespace FloatingStatusWindowLibrary.Properties {
|
||||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FloatingStatusWindowLibrary.Properties.Resources", typeof(Resources).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChrisKaczor.Wpf.FloatingStatusWindow.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
|
||||
@@ -1,34 +1,31 @@
|
||||
using Common.Wpf.Extensions;
|
||||
using ChrisKaczor.Wpf.Application;
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
public static class StartManager
|
||||
{
|
||||
public static class StartManager
|
||||
public delegate void AutoStartChangedEventHandler(bool autoStart);
|
||||
|
||||
public static event AutoStartChangedEventHandler AutoStartChanged = delegate { };
|
||||
|
||||
public static bool ManageAutoStart { get; set; }
|
||||
|
||||
private static bool _autoStartEnabled;
|
||||
|
||||
public static bool AutoStartEnabled
|
||||
{
|
||||
public delegate void AutoStartChangedEventHandler(bool autoStart);
|
||||
|
||||
public static event AutoStartChangedEventHandler AutoStartChanged = delegate { };
|
||||
|
||||
public static bool ManageAutoStart { get; set; }
|
||||
|
||||
private static bool _autoStartEnabled;
|
||||
public static bool AutoStartEnabled
|
||||
get => ManageAutoStart && _autoStartEnabled;
|
||||
set
|
||||
{
|
||||
get
|
||||
{
|
||||
return ManageAutoStart && _autoStartEnabled;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!ManageAutoStart)
|
||||
throw new InvalidOperationException("Cannot set AutoStartEnabled when ManageAutoStart is False");
|
||||
if (!ManageAutoStart)
|
||||
throw new InvalidOperationException("Cannot set AutoStartEnabled when ManageAutoStart is False");
|
||||
|
||||
_autoStartEnabled = value;
|
||||
_autoStartEnabled = value;
|
||||
|
||||
Application.Current.SetStartWithWindows(_autoStartEnabled);
|
||||
AutoStartChanged(_autoStartEnabled);
|
||||
}
|
||||
System.Windows.Application.Current.SetStartWithWindows(_autoStartEnabled);
|
||||
AutoStartChanged(_autoStartEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,104 @@
|
||||
using Common.Native;
|
||||
using Common.Wpf.Windows;
|
||||
using ChrisKaczor.Wpf.Windows;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
public static partial class WindowManager
|
||||
{
|
||||
public static class WindowManager
|
||||
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
||||
|
||||
[LibraryImport("user32.dll")]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static partial void EnumWindows(EnumWindowsProc lpEnumFunc, IntPtr lParam);
|
||||
|
||||
[LibraryImport("user32.dll", SetLastError = true, StringMarshalling = StringMarshalling.Utf16, EntryPoint = "RegisterWindowMessageW")]
|
||||
private static partial uint RegisterWindowMessage(string lpString);
|
||||
|
||||
[DllImport("user32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
private static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount);
|
||||
|
||||
[LibraryImport("user32.dll", SetLastError = true, EntryPoint = "GetWindowTextLengthW")]
|
||||
private static partial int GetWindowTextLength(IntPtr hWnd);
|
||||
|
||||
[LibraryImport("user32.dll", EntryPoint = "SendMessageW")]
|
||||
private static partial void SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
private const string WindowMessageSetLock = "FloatingStatusWindowLibrary_SetLock";
|
||||
private const string WindowMessageClose = "FloatingStatusWindowLibrary_Close";
|
||||
|
||||
public static uint SetLockMessage { get; set; }
|
||||
public static uint CloseMessage { get; set; }
|
||||
|
||||
static WindowManager()
|
||||
{
|
||||
private const string WindowMessageSetLock = "FloatingStatusWindowLibrary_SetLock";
|
||||
private const string WindowMessageClose = "FloatingStatusWindowLibrary_Close";
|
||||
SetLockMessage = RegisterWindowMessage(WindowMessageSetLock);
|
||||
CloseMessage = RegisterWindowMessage(WindowMessageClose);
|
||||
}
|
||||
|
||||
public static uint SetLockMessage { get; set; }
|
||||
public static uint CloseMessage { get; set; }
|
||||
private static readonly object WindowLocker = new();
|
||||
|
||||
static WindowManager()
|
||||
private static List<WindowInformation> _windowList;
|
||||
private static IntPtr _excludeHandle;
|
||||
|
||||
public static List<WindowInformation> GetWindowList()
|
||||
{
|
||||
lock (WindowLocker)
|
||||
{
|
||||
SetLockMessage = Functions.User32.RegisterWindowMessage(WindowMessageSetLock);
|
||||
CloseMessage = Functions.User32.RegisterWindowMessage(WindowMessageClose);
|
||||
}
|
||||
_windowList = new List<WindowInformation>();
|
||||
_excludeHandle = IntPtr.Zero;
|
||||
|
||||
private static readonly object WindowLocker = new object();
|
||||
EnumWindows(EnumWindowProc, IntPtr.Zero);
|
||||
|
||||
private static List<WindowInformation> _windowList;
|
||||
private static IntPtr _excludeHandle;
|
||||
|
||||
public static List<WindowInformation> GetWindowList()
|
||||
{
|
||||
lock (WindowLocker)
|
||||
{
|
||||
_windowList = new List<WindowInformation>();
|
||||
_excludeHandle = IntPtr.Zero;
|
||||
|
||||
Functions.User32.EnumWindows(EnumWindowProc, IntPtr.Zero);
|
||||
|
||||
return _windowList;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<WindowInformation> GetWindowList(IntPtr excludeHandle)
|
||||
{
|
||||
lock (WindowLocker)
|
||||
{
|
||||
_windowList = new List<WindowInformation>();
|
||||
_excludeHandle = excludeHandle;
|
||||
|
||||
Functions.User32.EnumWindows(EnumWindowProc, IntPtr.Zero);
|
||||
|
||||
return _windowList;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool EnumWindowProc(IntPtr hWnd, IntPtr lParam)
|
||||
{
|
||||
var windowText = Functions.Window.GetText(hWnd);
|
||||
|
||||
if (windowText == "FloatingStatusWindow" && hWnd != _excludeHandle)
|
||||
_windowList.Add(new WindowInformation(hWnd));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SetLockOnAll(bool locked)
|
||||
{
|
||||
var lockState = locked ? (IntPtr) 1 : (IntPtr) 0;
|
||||
|
||||
foreach (var w in GetWindowList())
|
||||
Functions.User32.SendMessage(w.Handle, SetLockMessage, lockState, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void CloseAll()
|
||||
{
|
||||
foreach (var w in GetWindowList())
|
||||
Functions.User32.SendMessage(w.Handle, CloseMessage, IntPtr.Zero, IntPtr.Zero);
|
||||
return _windowList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<WindowInformation> GetWindowList(IntPtr excludeHandle)
|
||||
{
|
||||
lock (WindowLocker)
|
||||
{
|
||||
_windowList = new List<WindowInformation>();
|
||||
_excludeHandle = excludeHandle;
|
||||
|
||||
EnumWindows(EnumWindowProc, IntPtr.Zero);
|
||||
|
||||
return _windowList;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetText(IntPtr hWnd)
|
||||
{
|
||||
// Allocate correct string length first
|
||||
var length = GetWindowTextLength(hWnd);
|
||||
var sb = new StringBuilder(length + 1);
|
||||
_ = GetWindowText(hWnd, sb, sb.Capacity);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private static bool EnumWindowProc(IntPtr hWnd, IntPtr lParam)
|
||||
{
|
||||
var windowText = GetText(hWnd);
|
||||
|
||||
if (windowText == "FloatingStatusWindow" && hWnd != _excludeHandle)
|
||||
_windowList.Add(new WindowInformation(hWnd));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void SetLockOnAll(bool locked)
|
||||
{
|
||||
var lockState = locked ? 1 : 0;
|
||||
|
||||
foreach (var w in GetWindowList())
|
||||
SendMessage(w.Handle, SetLockMessage, lockState, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static void CloseAll()
|
||||
{
|
||||
foreach (var w in GetWindowList())
|
||||
SendMessage(w.Handle, CloseMessage, IntPtr.Zero, IntPtr.Zero);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +1,119 @@
|
||||
using System.Drawing;
|
||||
using System.Drawing.Text;
|
||||
using System.Linq;
|
||||
using Common.Wpf.HtmlLabelControl;
|
||||
using ChrisKaczor.Wpf.Controls;
|
||||
using JetBrains.Annotations;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Xml.Serialization;
|
||||
using Color = System.Windows.Media.Color;
|
||||
using FontFamily = System.Windows.Media.FontFamily;
|
||||
using Point = System.Windows.Point;
|
||||
using Size = System.Windows.Size;
|
||||
using SystemFonts = System.Windows.SystemFonts;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
namespace ChrisKaczor.Wpf.FloatingStatusWindow;
|
||||
|
||||
[PublicAPI]
|
||||
public class WindowSettings : ICloneable
|
||||
{
|
||||
public class WindowSettings : ICloneable
|
||||
private const string DefaultFontName = "Consolas";
|
||||
private const int DefaultFontSize = 14;
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool Visible { get; set; }
|
||||
public Point Location { get; set; }
|
||||
public Size Size { get; set; }
|
||||
public int Padding { get; set; }
|
||||
public HorizontalAlignment HorizontalAlignment { get; set; }
|
||||
public VerticalAlignment VerticalAlignment { get; set; }
|
||||
public bool Locked { get; set; }
|
||||
public string FontName { get; set; }
|
||||
public double FontSize { get; set; }
|
||||
public Color FontColor { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
private MainWindow Window { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
private HtmlTextBlock HtmlLabel { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
private Grid ContentGrid { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public System.Drawing.Font Font => new(FontName, (float)FontSize);
|
||||
|
||||
internal void SetWindow(MainWindow floatingWindow)
|
||||
{
|
||||
private const string DefaultFontName = "Consolas";
|
||||
private const int DefaultFontSize = 14;
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool Visible { get; set; }
|
||||
public Point Location { get; set; }
|
||||
public Size Size { get; set; }
|
||||
public int Padding { get; set; }
|
||||
public HorizontalAlignment HorizontalAlignment { get; set; }
|
||||
public VerticalAlignment VerticalAlignment { get; set; }
|
||||
public bool Locked { get; set; }
|
||||
public string FontName { get; set; }
|
||||
public double FontSize { get; set; }
|
||||
public Color FontColor { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
private MainWindow Window { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
private HtmlLabel HtmlLabel { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public Font Font
|
||||
{
|
||||
get { return new Font(FontName, (float) FontSize); }
|
||||
}
|
||||
|
||||
internal void SetWindow(MainWindow floatingWindow)
|
||||
{
|
||||
Window = floatingWindow;
|
||||
HtmlLabel = floatingWindow.HtmlLabel;
|
||||
}
|
||||
|
||||
private WindowSettings()
|
||||
{
|
||||
var allFonts = new InstalledFontCollection();
|
||||
var fontExists = allFonts.Families.Any(f => f.Name == DefaultFontName);
|
||||
|
||||
FontName = fontExists ? DefaultFontName : SystemFonts.MessageFontFamily.Source;
|
||||
FontColor = (System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5 ? Colors.Silver : Colors.Black);
|
||||
FontSize = fontExists ? DefaultFontSize : SystemFonts.MessageFontSize;
|
||||
Padding = 5;
|
||||
HorizontalAlignment = HorizontalAlignment.Left;
|
||||
VerticalAlignment = VerticalAlignment.Bottom;
|
||||
Locked = false;
|
||||
}
|
||||
|
||||
internal void Apply()
|
||||
{
|
||||
// Configure the text label
|
||||
HtmlLabel.FontFamily = new FontFamily(FontName);
|
||||
HtmlLabel.FontSize = FontSize;
|
||||
HtmlLabel.Foreground = new SolidColorBrush(FontColor);
|
||||
HtmlLabel.Padding = new Thickness(Padding);
|
||||
HtmlLabel.HorizontalContentAlignment = HorizontalAlignment;
|
||||
HtmlLabel.VerticalContentAlignment = VerticalAlignment;
|
||||
|
||||
// Put the window in its last position
|
||||
Window.Left = Location.X;
|
||||
Window.Top = Location.Y;
|
||||
|
||||
// Set the last size if we have a valid size
|
||||
if (!Size.Width.Equals(0) && !Size.Height.Equals(0))
|
||||
{
|
||||
Window.Width = Size.Width;
|
||||
Window.Height = Size.Height;
|
||||
}
|
||||
|
||||
Window.Locked = Locked;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
internal static WindowSettings Load(string settings)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settings))
|
||||
return new WindowSettings();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(WindowSettings));
|
||||
TextReader textReader = new StringReader(settings);
|
||||
var windowSettings = (WindowSettings) serializer.Deserialize(textReader);
|
||||
textReader.Close();
|
||||
|
||||
return windowSettings;
|
||||
}
|
||||
|
||||
internal string Save()
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(WindowSettings));
|
||||
TextWriter textWriter = new StringWriter(builder);
|
||||
serializer.Serialize(textWriter, this);
|
||||
textWriter.Close();
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
Window = floatingWindow;
|
||||
HtmlLabel = floatingWindow.HtmlLabel;
|
||||
ContentGrid = floatingWindow.ContentGrid;
|
||||
}
|
||||
}
|
||||
|
||||
private WindowSettings()
|
||||
{
|
||||
var allFonts = new System.Drawing.Text.InstalledFontCollection();
|
||||
var fontExists = allFonts.Families.Any(f => f.Name == DefaultFontName);
|
||||
|
||||
FontName = fontExists ? DefaultFontName : SystemFonts.MessageFontFamily.Source;
|
||||
FontColor = (System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5 ? Colors.Silver : Colors.Black);
|
||||
FontSize = fontExists ? DefaultFontSize : SystemFonts.MessageFontSize;
|
||||
Padding = 5;
|
||||
HorizontalAlignment = HorizontalAlignment.Left;
|
||||
VerticalAlignment = VerticalAlignment.Bottom;
|
||||
Locked = false;
|
||||
}
|
||||
|
||||
internal void Apply()
|
||||
{
|
||||
// Configure the text label
|
||||
HtmlLabel.FontFamily = new FontFamily(FontName);
|
||||
HtmlLabel.FontSize = FontSize;
|
||||
HtmlLabel.Foreground = new SolidColorBrush(FontColor);
|
||||
HtmlLabel.Padding = new Thickness(Padding);
|
||||
|
||||
ContentGrid.HorizontalAlignment = HorizontalAlignment;
|
||||
ContentGrid.VerticalAlignment = VerticalAlignment;
|
||||
|
||||
// Put the window in its last position
|
||||
Window.Left = Location.X;
|
||||
Window.Top = Location.Y;
|
||||
|
||||
// Set the last size if we have a valid size
|
||||
if (!Size.Width.Equals(0) && !Size.Height.Equals(0))
|
||||
{
|
||||
Window.Width = Size.Width;
|
||||
Window.Height = Size.Height;
|
||||
}
|
||||
|
||||
Window.Locked = Locked;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
}
|
||||
|
||||
internal static WindowSettings Load(string settings)
|
||||
{
|
||||
if (string.IsNullOrEmpty(settings))
|
||||
return new WindowSettings();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(WindowSettings));
|
||||
TextReader textReader = new StringReader(settings);
|
||||
var windowSettings = (WindowSettings)serializer.Deserialize(textReader);
|
||||
textReader.Close();
|
||||
|
||||
return windowSettings;
|
||||
}
|
||||
|
||||
internal string Save()
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(WindowSettings));
|
||||
TextWriter textWriter = new StringWriter(builder);
|
||||
serializer.Serialize(textWriter, this);
|
||||
textWriter.Close();
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
28
appveyor.yml
28
appveyor.yml
@@ -1,28 +0,0 @@
|
||||
version: 1.0.0.{build}
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
skip_tags: true
|
||||
image: Visual Studio 2017
|
||||
configuration: Release
|
||||
assembly_info:
|
||||
patch: true
|
||||
file: 'Library\Properties\AssemblyInfo.cs'
|
||||
assembly_version: '{version}'
|
||||
assembly_file_version: '{version}'
|
||||
build:
|
||||
project: FloatingStatusWindow.sln
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: nuget pack Library\FloatingStatusWindow.nuspec -Version %appveyor_build_version% -Properties Configuration=Release -OutputDirectory Library\bin\Release\
|
||||
artifacts:
|
||||
- path: Library\bin\$(configuration)\FloatingStatusWindow.*.nupkg
|
||||
name: NuGet
|
||||
deploy:
|
||||
- provider: Environment
|
||||
name: GitHub
|
||||
- provider: Environment
|
||||
name: NuGet
|
||||
install:
|
||||
- cmd: git submodule update --init --recursive
|
||||
before_build:
|
||||
- cmd: msbuild /t:restore
|
||||
63
azure-pipelines.yml
Normal file
63
azure-pipelines.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
name: 2.0.0.$(Rev:r)
|
||||
|
||||
pr: none
|
||||
|
||||
trigger:
|
||||
batch: 'true'
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
|
||||
pool:
|
||||
vmImage: 'windows-latest'
|
||||
|
||||
variables:
|
||||
buildConfiguration: 'Release'
|
||||
|
||||
steps:
|
||||
- task: GetRevision@1
|
||||
displayName: 'Get Revision'
|
||||
inputs:
|
||||
VariableName: Revision
|
||||
|
||||
- task: Assembly-Info-NetCore@3
|
||||
displayName: 'Set Assembly Info'
|
||||
inputs:
|
||||
Path: '$(Build.SourcesDirectory)'
|
||||
FileNames: 'Library/*.csproj'
|
||||
InsertAttributes: true
|
||||
FileEncoding: 'utf-8'
|
||||
WriteBOM: true
|
||||
FailOnWarning: true
|
||||
Authors: 'Chris Kaczor'
|
||||
Copyright: 'Copyright $(date:YYYY) Chris Kaczor'
|
||||
FileVersion: '2.0.0.$(Revision)'
|
||||
PackageVersion: '2.0.0.$(Revision)'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'dotnet build'
|
||||
inputs:
|
||||
command: 'build'
|
||||
arguments: '--configuration $(buildConfiguration)'
|
||||
projects: 'FloatingStatusWindow.csproj'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: "dotnet pack"
|
||||
inputs:
|
||||
command: 'pack'
|
||||
arguments: '--configuration $(buildConfiguration)'
|
||||
packagesToPack: 'FloatingStatusWindow.csproj'
|
||||
nobuild: true
|
||||
versioningScheme: 'byBuildNumber'
|
||||
|
||||
- task: NuGetCommand@2
|
||||
displayName: 'nuget push'
|
||||
inputs:
|
||||
command: 'push'
|
||||
feedsToUse: 'select'
|
||||
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
|
||||
nuGetFeedType: external
|
||||
publishFeedCredentials: 'NuGet'
|
||||
publishVstsFeed: 'Packages'
|
||||
versioningScheme: 'byBuildNumber'
|
||||
allowPackageConflicts: true
|
||||
Reference in New Issue
Block a user