Initial commit

This commit is contained in:
2014-04-30 17:37:45 -04:00
commit d9173c4787
63 changed files with 14276 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

156
.gitignore vendored Normal file
View File

@@ -0,0 +1,156 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# Enable "build/" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets
!packages/*/build/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store

View File

@@ -0,0 +1,68 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30110.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatingStatusWindowLibrary", "FloatingStatusWindowLibrary\FloatingStatusWindowLibrary.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestWindow", "TestWindow\TestWindow.csproj", "{0C541788-8FFD-47B6-8E6B-653A884CFA55}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Wpf", "..\Common.Wpf\Common.Wpf.csproj", "{0074C983-550E-4094-9E8C-F566FB669297}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Native", "..\Common.Native\Common.Native.csproj", "{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x64.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x86.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|Any CPU.Build.0 = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x64.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x86.ActiveCfg = Release|Any CPU
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Debug|x64.ActiveCfg = Debug|Any CPU
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Debug|x86.ActiveCfg = Debug|Any CPU
{0C541788-8FFD-47B6-8E6B-653A884CFA55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{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
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>

View File

@@ -0,0 +1,165 @@
<Window x:Class="FloatingStatusWindowLibrary.AppearanceWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{x:Static properties:Resources.ChangeAppearanceWindow}" Height="290" Width="450" Binding.SourceUpdated="HandleWindowSourceUpdated"
xmlns:properties="clr-namespace:FloatingStatusWindowLibrary.Properties"
WindowStartupLocation="CenterScreen"
ResizeMode="NoResize" MinWidth="450" MinHeight="290"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FloatingStatusWindowLibrary"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:WindowSettings}"
WindowStyle="ToolWindow" Closing="HandleWindowClosing" x:ClassModifier="internal">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Label
Content="{x:Static properties:Resources.FontName}"
Name="FontNameLabel"
Target="{Binding ElementName=FontNameCombo}"
Margin="6" />
<ComboBox x:Name="FontNameCombo" Grid.Row="0" Grid.Column="1"
SelectedValuePath="Source"
SelectedValue="{Binding Path=FontName,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
Margin="6">
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
<ComboBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="{x:Null}"
MinHeight="20">
<TextBlock Text="{Binding}"
FontFamily="{Binding}"
FontSize="14" Height="Auto"
VerticalAlignment="Center" />
</Border>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Label
Content="{x:Static properties:Resources.FontSize}"
Name="FontSizeLabel" Grid.Row="1" Grid.Column="0"
Target="{Binding ElementName=FontSizeCombo}"
Margin="6" />
<ComboBox Grid.Column="1" Grid.Row="1"
Name="FontSizeCombo"
Text="{Binding Path=FontSize,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
IsEditable="True" Margin="6">
<ComboBoxItem Content="8" />
<ComboBoxItem Content="9" />
<ComboBoxItem Content="10" />
<ComboBoxItem Content="11" />
<ComboBoxItem Content="12" />
<ComboBoxItem Content="14" />
<ComboBoxItem Content="16" />
<ComboBoxItem Content="18" />
<ComboBoxItem Content="20" />
<ComboBoxItem Content="22" />
<ComboBoxItem Content="24" />
<ComboBoxItem Content="26" />
<ComboBoxItem Content="28" />
<ComboBoxItem Content="36" />
<ComboBoxItem Content="48" />
<ComboBoxItem Content="72" />
</ComboBox>
<Label
Content="{x:Static properties:Resources.ForegroundColor}"
Grid.Row="2" Grid.Column="0" Name="ForegroundColorLabel"
Target="{Binding ElementName=ForegroundColorPicker}"
Margin="6" />
<xctk:ColorPicker Grid.Column="1" Grid.Row="2"
Name="ForegroundColorPicker"
DisplayColorAndName="True"
SelectedColor="{Binding Path=FontColor,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
ShowAdvancedButton="False" Margin="6" />
<Label
Content="{x:Static properties:Resources.Padding}"
Grid.Row="3" Grid.Column="0" Name="PaddingLabel" Target="{Binding ElementName=PaddingUpDown}" Margin="6" />
<xctk:IntegerUpDown Grid.Column="1"
Grid.Row="3" Name="PaddingUpDown"
Minimum="0" Maximum="20"
Value="{Binding Path=Padding,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
TextAlignment="Left" Margin="6" />
<Label
Content="{x:Static properties:Resources.HorizontalAlignment}"
Grid.Row="4" Grid.Column="0" Name="HorizontalAlignmentLabel"
Target="{Binding ElementName=HorizontalAlignmentCombo}"
Margin="6" />
<ComboBox Grid.Column="1" Grid.Row="4"
Name="HorizontalAlignmentCombo"
SelectedValuePath="Tag"
SelectedValue="{Binding Path=HorizontalAlignment,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
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" Name="VerticalAlignmentLabel"
Target="{Binding ElementName=VerticalAlignmentCombo}"
Margin="6" />
<ComboBox Grid.Column="1" Grid.Row="5"
Name="VerticalAlignmentCombo"
SelectedValuePath="Tag"
SelectedValue="{Binding Path=VerticalAlignment,UpdateSourceTrigger=PropertyChanged,NotifyOnSourceUpdated=True}"
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" Name="GridButtons" Width="Auto" Grid.IsSharedSizeScope="True"
Height="38" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"
SharedSizeGroup="buttons" />
<ColumnDefinition Width="Auto"
SharedSizeGroup="buttons" />
</Grid.ColumnDefinitions>
<Button
Content="{x:Static properties:Resources.OK}"
Height="23"
HorizontalAlignment="Stretch" Margin="6"
Name="OkayButton"
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"
Name="CancelButton"
VerticalAlignment="Stretch" Width="75"
Padding="7,3" IsCancel="True" />
</Grid>
</Grid>
</Window>

View File

@@ -0,0 +1,50 @@
using Common.Wpf.Extensions;
using System.Linq;
using System.Windows.Media;
namespace FloatingStatusWindowLibrary
{
internal partial class AppearanceWindow
{
private WindowSettings _currentSettings;
private readonly WindowSettings _originalSettings;
public AppearanceWindow(WindowSettings windowSettings)
{
InitializeComponent();
_currentSettings = windowSettings;
_originalSettings = (WindowSettings) _currentSettings.Clone();
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();
}
}
}

View File

@@ -0,0 +1,98 @@
using Hardcodet.Wpf.TaskbarNotification;
using System;
using System.Windows;
using System.Windows.Controls;
namespace FloatingStatusWindowLibrary
{
public class FloatingStatusWindow : IDisposable
{
private readonly MainWindow _mainWindow;
private readonly TaskbarIcon _taskbarIcon;
private readonly MenuItem _lockMenuItem;
private readonly IWindowSource _windowSource;
public FloatingStatusWindow(IWindowSource windowSource)
{
_windowSource = windowSource;
var contextMenu = new ContextMenu();
contextMenu.Opened += HandleContextMenuOpened;
_lockMenuItem = new MenuItem
{
Name = "contextMenuItemLocked",
IsChecked = false,
Header = Properties.Resources.ContextMenuLocked
};
_lockMenuItem.Click += HandleLockedMenuItemClicked;
contextMenu.Items.Add(_lockMenuItem);
contextMenu.Items.Add(new Separator());
var menuItem = new MenuItem
{
Name = "contextMenuItemExit",
Header = Properties.Resources.ContextMenuExit
};
menuItem.Click += HandleExitMenuItemClick;
contextMenu.Items.Add(menuItem);
_taskbarIcon = new TaskbarIcon
{
ToolTipText = _windowSource.Name,
Icon = _windowSource.Icon,
ContextMenu = contextMenu
};
_mainWindow = new MainWindow(windowSource);
_mainWindow.Closed += HandleMainWindowClosed;
_mainWindow.Show();
}
private void HandleMainWindowClosed(object sender, EventArgs e)
{
_taskbarIcon.Dispose();
}
public ContextMenu ContextMenu
{
get { return _taskbarIcon.ContextMenu; }
}
private void HandleContextMenuOpened(object sender, RoutedEventArgs e)
{
_lockMenuItem.IsChecked = _mainWindow.WindowSettings.Locked;
}
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)
{
_mainWindow.Close();
}
public void Save()
{
_windowSource.WindowSettings = _mainWindow.WindowSettings.Save();
}
public void Dispose()
{
_taskbarIcon.Dispose();
_mainWindow.Close();
}
}
}

View File

@@ -0,0 +1,114 @@
<?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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}</ProjectGuid>
<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 />
</PropertyGroup>
<ItemGroup>
<Reference Include="Hardcodet.Wpf.TaskbarNotification">
<HintPath>..\packages\Hardcodet.NotifyIcon.Wpf.1.0.5\lib\net45\Hardcodet.Wpf.TaskbarNotification.dll</HintPath>
</Reference>
<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" />
<Reference Include="Xceed.Wpf.Toolkit, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Extended.Wpf.Toolkit.2.1.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
</Reference>
</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="WindowSettings.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\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>
</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>
</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>

View File

@@ -0,0 +1,12 @@
using System.Drawing;
namespace FloatingStatusWindowLibrary
{
public interface IWindowSource
{
string Name { get; }
string WindowSettings { get; set; }
Icon Icon { get; }
}
}

View File

@@ -0,0 +1,31 @@
<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:p="clr-namespace:FloatingStatusWindowLibrary.Properties"
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">
<Border Name="BorderFull" BorderThickness="4,0,4,4" Background="Transparent" Margin="0">
<Grid Background="Transparent">
<Border Name="HeaderBorder" Height="24" VerticalAlignment="Top">
<Grid>
<Label HorizontalAlignment="Stretch" Name="HeaderLabel" Margin="0,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0">
Testing
</Label>
<Button Name="SettingsButton" Height="18" Width="18" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0, 0, 5, 0" WindowChrome.IsHitTestVisibleInChrome="True" Click="HandleSettingsButtonClick">
<Button.ContextMenu>
<ContextMenu>
<MenuItem Name="MenuChangeAppearance" Header="{x:Static p:Resources.ChangeAppearance}" Click="HandleChangeAppearanceMenuClick" />
</ContextMenu>
</Button.ContextMenu>
</Button>
</Grid>
</Border>
<htmlLabelControl:HtmlLabel Name="HtmlLabel" Foreground="White" Margin="0,20,0,0" />
</Grid>
</Border>
</windows:SnappingWindow>

View File

@@ -0,0 +1,133 @@
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Shell;
using Common.Native;
namespace FloatingStatusWindowLibrary
{
internal partial class MainWindow
{
private const int WindowCaptionHeight = 24;
private readonly WindowChrome _windowChrome;
private WindowSettings _windowSettings;
public WindowSettings WindowSettings
{
get { return _windowSettings; }
set { _windowSettings = value; }
}
private bool _locked;
public bool Locked
{
get { return _locked; }
set
{
_locked = value;
_windowChrome.CaptionHeight = (_locked ? 0 : WindowCaptionHeight);
// Show the header border if the window is unlocked
HeaderBorder.Visibility = (_locked ? Visibility.Hidden : Visibility.Visible);
// Show and enable the window border if the window is unlocked
BorderFull.BorderBrush = (_locked ? Brushes.Transparent : SystemColors.ActiveCaptionBrush);
BorderFull.IsEnabled = !_locked;
}
}
public MainWindow(IWindowSource windowSource)
{
InitializeComponent();
// 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();
HtmlLabel.Text = "Testing";
}
private void HandleChangeAppearanceMenuClick(object sender, RoutedEventArgs e)
{
var appearanceWindow = new AppearanceWindow(_windowSettings);
appearanceWindow.ShowDialog();
}
private void HandleSettingsButtonClick(object sender, RoutedEventArgs e)
{
SettingsButton.ContextMenu.IsOpen = true;
}
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);
}
private List<Rect> _windowList;
private IntPtr _windowHandle;
protected override List<Rect> OtherWindows
{
get
{
_windowList = new List<Rect>();
_windowHandle = new WindowInteropHelper(this).Handle;
Functions.User32.EnumWindows(EnumWindowProc, IntPtr.Zero);
return _windowList;
}
}
private bool EnumWindowProc(IntPtr hWnd, IntPtr lParam)
{
var windowText = Functions.Window.GetText(hWnd);
if (windowText == "FloatingStatusWindow" && hWnd != _windowHandle)
{
var windowPlacement = new Structures.WindowPlacement();
Functions.User32.GetWindowPlacement(hWnd, ref windowPlacement);
var p = windowPlacement.NormalPosition;
_windowList.Add(new Rect(p.X, p.Y, p.Width, p.Height));
}
return true;
}
}
}

View File

@@ -0,0 +1,19 @@
using System.Reflection;
using System.Runtime.InteropServices;
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: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,216 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace FloatingStatusWindowLibrary.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// 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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
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);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Bottom.
/// </summary>
public static string Bottom {
get {
return ResourceManager.GetString("Bottom", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
public static string Cancel {
get {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Center.
/// </summary>
public static string Center {
get {
return ResourceManager.GetString("Center", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Change Appearance....
/// </summary>
public static string ChangeAppearance {
get {
return ResourceManager.GetString("ChangeAppearance", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Change Appearance.
/// </summary>
public static string ChangeAppearanceWindow {
get {
return ResourceManager.GetString("ChangeAppearanceWindow", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exit.
/// </summary>
public static string ContextMenuExit {
get {
return ResourceManager.GetString("ContextMenuExit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Locked.
/// </summary>
public static string ContextMenuLocked {
get {
return ResourceManager.GetString("ContextMenuLocked", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Font _name:.
/// </summary>
public static string FontName {
get {
return ResourceManager.GetString("FontName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Font _size:.
/// </summary>
public static string FontSize {
get {
return ResourceManager.GetString("FontSize", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Foreground color:.
/// </summary>
public static string ForegroundColor {
get {
return ResourceManager.GetString("ForegroundColor", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Horizontal alignment:.
/// </summary>
public static string HorizontalAlignment {
get {
return ResourceManager.GetString("HorizontalAlignment", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Left.
/// </summary>
public static string Left {
get {
return ResourceManager.GetString("Left", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
public static string OK {
get {
return ResourceManager.GetString("OK", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Padding:.
/// </summary>
public static string Padding {
get {
return ResourceManager.GetString("Padding", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Right.
/// </summary>
public static string Right {
get {
return ResourceManager.GetString("Right", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Top.
/// </summary>
public static string Top {
get {
return ResourceManager.GetString("Top", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Vertical alignment:.
/// </summary>
public static string VerticalAlignment {
get {
return ResourceManager.GetString("VerticalAlignment", resourceCulture);
}
}
}
}

View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Bottom" xml:space="preserve">
<value>Bottom</value>
</data>
<data name="Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="Center" xml:space="preserve">
<value>Center</value>
</data>
<data name="ChangeAppearance" xml:space="preserve">
<value>Change Appearance...</value>
</data>
<data name="ChangeAppearanceWindow" xml:space="preserve">
<value>Change Appearance</value>
</data>
<data name="ContextMenuExit" xml:space="preserve">
<value>Exit</value>
</data>
<data name="ContextMenuLocked" xml:space="preserve">
<value>Locked</value>
</data>
<data name="FontName" xml:space="preserve">
<value>Font _name:</value>
</data>
<data name="FontSize" xml:space="preserve">
<value>Font _size:</value>
</data>
<data name="ForegroundColor" xml:space="preserve">
<value>_Foreground color:</value>
</data>
<data name="HorizontalAlignment" xml:space="preserve">
<value>_Horizontal alignment:</value>
</data>
<data name="Left" xml:space="preserve">
<value>Left</value>
</data>
<data name="OK" xml:space="preserve">
<value>OK</value>
</data>
<data name="Padding" xml:space="preserve">
<value>_Padding:</value>
</data>
<data name="Right" xml:space="preserve">
<value>Right</value>
</data>
<data name="Top" xml:space="preserve">
<value>Top</value>
</data>
<data name="VerticalAlignment" xml:space="preserve">
<value>_Vertical alignment:</value>
</data>
</root>

View File

@@ -0,0 +1,103 @@
using Common.Wpf.HtmlLabelControl;
using System;
using System.Configuration;
using System.IO;
using System.Text;
using System.Windows;
using System.Windows.Media;
using System.Xml.Serialization;
namespace FloatingStatusWindowLibrary
{
public class WindowSettings : ICloneable
{
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; }
internal void SetWindow(MainWindow floatingWindow)
{
Window = floatingWindow;
HtmlLabel = floatingWindow.HtmlLabel;
}
private WindowSettings()
{
FontName = SystemFonts.MessageFontFamily.Source;
FontColor = (System.Drawing.SystemColors.Desktop.GetBrightness() < 0.5 ? Colors.White : Colors.Black);
FontSize = SystemFonts.MessageFontSize;
Padding = 10;
HorizontalAlignment = HorizontalAlignment.Left;
VerticalAlignment = VerticalAlignment.Top;
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();
}
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Extended.Wpf.Toolkit" version="2.1.0" targetFramework="net45" />
<package id="Hardcodet.NotifyIcon.Wpf" version="1.0.5" targetFramework="net45" />
</packages>

18
TestWindow/App.config Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TestWindow.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<TestWindow.Properties.Settings>
<setting name="WindowSettings" serializeAs="String">
<value />
</setting>
</TestWindow.Properties.Settings>
</userSettings>
</configuration>

7
TestWindow/App.xaml Normal file
View File

@@ -0,0 +1,7 @@
<Application x:Class="TestWindow.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ShutdownMode="OnLastWindowClose">
<Application.Resources>
</Application.Resources>
</Application>

24
TestWindow/App.xaml.cs Normal file
View File

@@ -0,0 +1,24 @@
using System.Collections.Generic;
using System.Windows;
namespace TestWindow
{
public partial class App
{
private List<WindowSource> _windowSourceList;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
_windowSourceList = new List<WindowSource> { new WindowSource(), new WindowSource(), new WindowSource() };
}
protected override void OnExit(ExitEventArgs e)
{
_windowSourceList.ForEach(ws => ws.Dispose());
base.OnExit(e);
}
}
}

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TestWindow")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestWindow")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestWindow.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// 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", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestWindow.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon ApplicationIcon {
get {
object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Application.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,38 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34014
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace TestWindow.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string WindowSettings {
get {
return ((string)(this["WindowSettings"]));
}
set {
this["WindowSettings"] = value;
}
}
}
}

View File

@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="TestWindow.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="WindowSettings" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

28
TestWindow/Settings.cs Normal file
View File

@@ -0,0 +1,28 @@
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.
}
}
}

View File

@@ -0,0 +1,108 @@
<?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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0C541788-8FFD-47B6-8E6B-653A884CFA55}</ProjectGuid>
<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>
</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="WindowSource.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" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary.csproj">
<Project>{f023a16c-2f13-4a87-a8b7-22c43c4a58a4}</Project>
<Name>FloatingStatusWindowLibrary</Name>
</ProjectReference>
</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>

View File

@@ -0,0 +1,65 @@
using System.Windows.Controls;
using FloatingStatusWindowLibrary;
using System;
using System.Globalization;
using System.Timers;
using System.Windows.Threading;
namespace TestWindow
{
internal class WindowSource : IWindowSource, IDisposable
{
private readonly FloatingStatusWindow _floatingStatusWindow;
private readonly Timer _timer;
private readonly Dispatcher _dispatcher;
internal WindowSource()
{
_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"; }
}
public System.Drawing.Icon Icon
{
get { return Properties.Resources.ApplicationIcon; }
}
public string WindowSettings
{
get
{
return Properties.Settings.Default.WindowSettings;
}
set
{
Properties.Settings.Default.WindowSettings = value;
Properties.Settings.Default.Save();
}
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,3 @@
param($installPath, $toolsPath, $package, $project)
$project.DTE.ItemOperations.Navigate('http://wpftoolkit.codeplex.com/')

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
Hardcodet NotifyIcon for WPF 1.0.5
**********************************
This is an implementation of a NotifyIcon (aka system tray icon or taskbar icon) for the WPF platform. It does not just rely on the Windows Forms NotifyIcon component, but is a purely independent control which leverages several features of the WPF framework in order to display rich tooltips, popups, context menus, and balloon messages. It can be used directly in code or embedded in any XAML file.
This package contains only binaries. For source code and samples, please visit the project page:
http://www.hardcodet.net/projects/wpf-notifyicon

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<repositories>
<repository path="..\FloatingStatusWindowLibrary\packages.config" />
</repositories>