Add options for settings and refresh menus

This commit is contained in:
2017-01-27 15:38:09 -05:00
parent 7bdb80b395
commit 97cd3ce9dd
8 changed files with 132 additions and 2 deletions

View File

@@ -31,10 +31,30 @@ namespace FloatingStatusWindowLibrary
var contextMenu = new ContextMenu(); var contextMenu = new ContextMenu();
contextMenu.Opened += HandleContextMenuOpened; 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 }; _allWindowsMenuItem = new MenuItem { Header = Resources.AllWindowsMenu };
contextMenu.Items.Add(_allWindowsMenuItem); contextMenu.Items.Add(_allWindowsMenuItem);
var menuItem = new MenuItem { Header = Resources.ContextMenuLock }; menuItem = new MenuItem { Header = Resources.ContextMenuLock };
menuItem.Click += (sender, args) => WindowManager.SetLockOnAll(true); menuItem.Click += (sender, args) => WindowManager.SetLockOnAll(true);
_allWindowsMenuItem.Items.Add(menuItem); _allWindowsMenuItem.Items.Add(menuItem);

View File

@@ -7,5 +7,11 @@ namespace FloatingStatusWindowLibrary
string Name { get; } string Name { get; }
string WindowSettings { get; set; } string WindowSettings { get; set; }
Icon Icon { get; } Icon Icon { get; }
bool HasSettingsMenu { get; }
bool HasRefreshMenu { get; }
void ShowSettings();
void Refresh();
} }
} }

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by a tool. // This code was generated by a tool.
// Runtime Version:4.0.30319.34014 // Runtime Version:4.0.30319.42000
// //
// Changes to this file may cause incorrect behavior and will be lost if // Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. // the code is regenerated.
@@ -159,6 +159,24 @@ namespace FloatingStatusWindowLibrary.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Refresh.
/// </summary>
public static string ContextMenuRefresh {
get {
return ResourceManager.GetString("ContextMenuRefresh", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Settings....
/// </summary>
public static string ContextMenuSettings {
get {
return ResourceManager.GetString("ContextMenuSettings", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Unlock. /// Looks up a localized string similar to Unlock.
/// </summary> /// </summary>

View File

@@ -150,6 +150,12 @@
<data name="ContextMenuLocked" xml:space="preserve"> <data name="ContextMenuLocked" xml:space="preserve">
<value>Locked</value> <value>Locked</value>
</data> </data>
<data name="ContextMenuRefresh" xml:space="preserve">
<value>Refresh</value>
</data>
<data name="ContextMenuSettings" xml:space="preserve">
<value>Settings...</value>
</data>
<data name="ContextMenuUnlock" xml:space="preserve"> <data name="ContextMenuUnlock" xml:space="preserve">
<value>Unlock</value> <value>Unlock</value>
</data> </data>

View File

@@ -48,6 +48,26 @@ namespace TestWindow
get { return Properties.Resources.ApplicationIcon; } get { return Properties.Resources.ApplicationIcon; }
} }
public bool HasSettingsMenu
{
get { return true; }
}
public void ShowSettings()
{
}
public bool HasRefreshMenu
{
get { return true; }
}
public void Refresh()
{
}
public string WindowSettings public string WindowSettings
{ {
get get

View File

@@ -48,6 +48,26 @@ namespace TestWindow
get { return Properties.Resources.ApplicationIcon; } get { return Properties.Resources.ApplicationIcon; }
} }
public bool HasSettingsMenu
{
get { return true; }
}
public void ShowSettings()
{
}
public bool HasRefreshMenu
{
get { return true; }
}
public void Refresh()
{
}
public string WindowSettings public string WindowSettings
{ {
get get

View File

@@ -48,6 +48,26 @@ namespace TestWindow
get { return Properties.Resources.ApplicationIcon; } get { return Properties.Resources.ApplicationIcon; }
} }
public bool HasSettingsMenu
{
get { return true; }
}
public void ShowSettings()
{
}
public bool HasRefreshMenu
{
get { return true; }
}
public void Refresh()
{
}
public string WindowSettings public string WindowSettings
{ {
get get

View File

@@ -48,6 +48,26 @@ namespace TestWindow
get { return Properties.Resources.ApplicationIcon; } get { return Properties.Resources.ApplicationIcon; }
} }
public bool HasSettingsMenu
{
get { return true; }
}
public void ShowSettings()
{
}
public bool HasRefreshMenu
{
get { return true; }
}
public void Refresh()
{
}
public string WindowSettings public string WindowSettings
{ {
get get