mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-01-13 17:22:47 -05:00
Move appearance menu to tray icon
This commit is contained in:
@@ -20,6 +20,16 @@ namespace FloatingStatusWindowLibrary
|
|||||||
var contextMenu = new ContextMenu();
|
var contextMenu = new ContextMenu();
|
||||||
contextMenu.Opened += HandleContextMenuOpened;
|
contextMenu.Opened += HandleContextMenuOpened;
|
||||||
|
|
||||||
|
var menuItem = new MenuItem
|
||||||
|
{
|
||||||
|
Name = "contextMenuChangeAppearance",
|
||||||
|
Header = Properties.Resources.ContextMenuChangeAppearance
|
||||||
|
};
|
||||||
|
menuItem.Click += HandleChangeAppearancemMenuItemClick;
|
||||||
|
contextMenu.Items.Add(menuItem);
|
||||||
|
|
||||||
|
contextMenu.Items.Add(new Separator());
|
||||||
|
|
||||||
_lockMenuItem = new MenuItem
|
_lockMenuItem = new MenuItem
|
||||||
{
|
{
|
||||||
Name = "contextMenuItemLocked",
|
Name = "contextMenuItemLocked",
|
||||||
@@ -31,7 +41,7 @@ namespace FloatingStatusWindowLibrary
|
|||||||
|
|
||||||
contextMenu.Items.Add(new Separator());
|
contextMenu.Items.Add(new Separator());
|
||||||
|
|
||||||
var menuItem = new MenuItem
|
menuItem = new MenuItem
|
||||||
{
|
{
|
||||||
Name = "contextMenuItemExit",
|
Name = "contextMenuItemExit",
|
||||||
Header = Properties.Resources.ContextMenuExit
|
Header = Properties.Resources.ContextMenuExit
|
||||||
@@ -52,6 +62,12 @@ namespace FloatingStatusWindowLibrary
|
|||||||
_mainWindow.Show();
|
_mainWindow.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HandleChangeAppearancemMenuItemClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
var appearanceWindow = new AppearanceWindow(_mainWindow.WindowSettings);
|
||||||
|
appearanceWindow.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleMainWindowClosed(object sender, EventArgs e)
|
private void HandleMainWindowClosed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_taskbarIcon.Dispose();
|
_taskbarIcon.Dispose();
|
||||||
|
|||||||
@@ -15,13 +15,6 @@
|
|||||||
<Label HorizontalAlignment="Stretch" Name="HeaderLabel" Margin="0,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0">
|
<Label HorizontalAlignment="Stretch" Name="HeaderLabel" Margin="0,0,0,0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Padding="0">
|
||||||
Testing
|
Testing
|
||||||
</Label>
|
</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>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<htmlLabelControl:HtmlLabel Name="HtmlLabel" Foreground="White" Margin="0,20,0,0" />
|
<htmlLabelControl:HtmlLabel Name="HtmlLabel" Foreground="White" Margin="0,20,0,0" />
|
||||||
|
|||||||
@@ -73,17 +73,6 @@ namespace FloatingStatusWindowLibrary
|
|||||||
HtmlLabel.Text = "Testing";
|
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)
|
protected override void OnLocationChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLocationChanged(e);
|
base.OnLocationChanged(e);
|
||||||
|
|||||||
@@ -88,20 +88,20 @@ namespace FloatingStatusWindowLibrary.Properties {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Change Appearance....
|
/// Looks up a localized string similar to Change Appearance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ChangeAppearance {
|
public static string ChangeAppearanceWindow {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ChangeAppearance", resourceCulture);
|
return ResourceManager.GetString("ChangeAppearanceWindow", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Change Appearance.
|
/// Looks up a localized string similar to Change Appearance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ChangeAppearanceWindow {
|
public static string ContextMenuChangeAppearance {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("ChangeAppearanceWindow", resourceCulture);
|
return ResourceManager.GetString("ContextMenuChangeAppearance", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,12 +126,12 @@
|
|||||||
<data name="Center" xml:space="preserve">
|
<data name="Center" xml:space="preserve">
|
||||||
<value>Center</value>
|
<value>Center</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="ChangeAppearance" xml:space="preserve">
|
|
||||||
<value>Change Appearance...</value>
|
|
||||||
</data>
|
|
||||||
<data name="ChangeAppearanceWindow" xml:space="preserve">
|
<data name="ChangeAppearanceWindow" xml:space="preserve">
|
||||||
<value>Change Appearance</value>
|
<value>Change Appearance</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ContextMenuChangeAppearance" xml:space="preserve">
|
||||||
|
<value>Change Appearance</value>
|
||||||
|
</data>
|
||||||
<data name="ContextMenuExit" xml:space="preserve">
|
<data name="ContextMenuExit" xml:space="preserve">
|
||||||
<value>Exit</value>
|
<value>Exit</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Windows.Controls;
|
using FloatingStatusWindowLibrary;
|
||||||
using FloatingStatusWindowLibrary;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
|
|||||||
Reference in New Issue
Block a user