mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
commit
b51e5d2583
7 changed files with 44 additions and 12 deletions
|
|
@ -6,8 +6,6 @@ using NHotkey.Wpf;
|
||||||
using Flow.Launcher.Core.Resource;
|
using Flow.Launcher.Core.Resource;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using Flow.Launcher.ViewModel;
|
using Flow.Launcher.ViewModel;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Threading;
|
|
||||||
|
|
||||||
namespace Flow.Launcher.Helper
|
namespace Flow.Launcher.Helper
|
||||||
{
|
{
|
||||||
|
|
@ -27,7 +25,8 @@ namespace Flow.Launcher.Helper
|
||||||
|
|
||||||
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
|
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
|
||||||
{
|
{
|
||||||
mainViewModel.ToggleFlowLauncher();
|
if (!mainViewModel.GameModeStatus)
|
||||||
|
mainViewModel.ToggleFlowLauncher();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
private static void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
|
||||||
|
|
@ -75,7 +74,7 @@ namespace Flow.Launcher.Helper
|
||||||
{
|
{
|
||||||
SetHotkey(hotkey.Hotkey, (s, e) =>
|
SetHotkey(hotkey.Hotkey, (s, e) =>
|
||||||
{
|
{
|
||||||
if (mainViewModel.ShouldIgnoreHotkeys())
|
if (mainViewModel.ShouldIgnoreHotkeys() || mainViewModel.GameModeStatus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mainViewModel.MainWindowVisibility = Visibility.Visible;
|
mainViewModel.MainWindowVisibility = Visibility.Visible;
|
||||||
|
|
|
||||||
BIN
Flow.Launcher/Images/gamemode.ico
Normal file
BIN
Flow.Launcher/Images/gamemode.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
|
|
@ -15,6 +15,7 @@
|
||||||
<system:String x:Key="iconTrayAbout">About</system:String>
|
<system:String x:Key="iconTrayAbout">About</system:String>
|
||||||
<system:String x:Key="iconTrayExit">Exit</system:String>
|
<system:String x:Key="iconTrayExit">Exit</system:String>
|
||||||
<system:String x:Key="closeWindow">Close</system:String>
|
<system:String x:Key="closeWindow">Close</system:String>
|
||||||
|
<system:String x:Key="GameMode">Game Mode</system:String>
|
||||||
|
|
||||||
<!-- Setting General -->
|
<!-- Setting General -->
|
||||||
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
|
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,9 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
var menu = contextMenu;
|
var menu = contextMenu;
|
||||||
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen");
|
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen");
|
||||||
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
|
||||||
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
||||||
|
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeNotifyIcon()
|
private void InitializeNotifyIcon()
|
||||||
|
|
@ -187,6 +188,10 @@ namespace Flow.Launcher
|
||||||
{
|
{
|
||||||
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen")
|
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen")
|
||||||
};
|
};
|
||||||
|
var gamemode = new MenuItem
|
||||||
|
{
|
||||||
|
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
|
||||||
|
};
|
||||||
var settings = new MenuItem
|
var settings = new MenuItem
|
||||||
{
|
{
|
||||||
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
|
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
|
||||||
|
|
@ -197,10 +202,12 @@ namespace Flow.Launcher
|
||||||
};
|
};
|
||||||
|
|
||||||
open.Click += (o, e) => Visibility = Visibility.Visible;
|
open.Click += (o, e) => Visibility = Visibility.Visible;
|
||||||
|
gamemode.Click += (o, e) => ToggleGameMode();
|
||||||
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
||||||
exit.Click += (o, e) => Close();
|
exit.Click += (o, e) => Close();
|
||||||
contextMenu.Items.Add(header);
|
contextMenu.Items.Add(header);
|
||||||
contextMenu.Items.Add(open);
|
contextMenu.Items.Add(open);
|
||||||
|
contextMenu.Items.Add(gamemode);
|
||||||
contextMenu.Items.Add(settings);
|
contextMenu.Items.Add(settings);
|
||||||
contextMenu.Items.Add(exit);
|
contextMenu.Items.Add(exit);
|
||||||
|
|
||||||
|
|
@ -220,6 +227,19 @@ namespace Flow.Launcher
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ToggleGameMode()
|
||||||
|
{
|
||||||
|
if (_viewModel.GameModeStatus)
|
||||||
|
{
|
||||||
|
_notifyIcon.Icon = Properties.Resources.app;
|
||||||
|
_viewModel.GameModeStatus = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_notifyIcon.Icon = Properties.Resources.gamemode;
|
||||||
|
_viewModel.GameModeStatus = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
private void InitProgressbarAnimation()
|
private void InitProgressbarAnimation()
|
||||||
{
|
{
|
||||||
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150,
|
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150,
|
||||||
|
|
|
||||||
8
Flow.Launcher/Properties/Resources.Designer.cs
generated
8
Flow.Launcher/Properties/Resources.Designer.cs
generated
|
|
@ -69,5 +69,13 @@ namespace Flow.Launcher.Properties {
|
||||||
return ((System.Drawing.Icon)(obj));
|
return ((System.Drawing.Icon)(obj));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal static System.Drawing.Icon gamemode
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
object obj = ResourceManager.GetObject("gamemode", resourceCulture);
|
||||||
|
return ((System.Drawing.Icon)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,13 +112,16 @@
|
||||||
<value>2.0</value>
|
<value>2.0</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="reader">
|
<resheader name="reader">
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
<data name="app" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="app" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="gamemode" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Images\gamemode.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
|
|
@ -20,9 +20,6 @@ using Flow.Launcher.Infrastructure.Logger;
|
||||||
using Microsoft.VisualStudio.Threading;
|
using Microsoft.VisualStudio.Threading;
|
||||||
using System.Threading.Channels;
|
using System.Threading.Channels;
|
||||||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||||
using System.Windows.Threading;
|
|
||||||
using NHotkey;
|
|
||||||
using Windows.Web.Syndication;
|
|
||||||
|
|
||||||
|
|
||||||
namespace Flow.Launcher.ViewModel
|
namespace Flow.Launcher.ViewModel
|
||||||
|
|
@ -301,9 +298,13 @@ namespace Flow.Launcher.ViewModel
|
||||||
#region ViewModel Properties
|
#region ViewModel Properties
|
||||||
|
|
||||||
public ResultsViewModel Results { get; private set; }
|
public ResultsViewModel Results { get; private set; }
|
||||||
|
|
||||||
public ResultsViewModel ContextMenu { get; private set; }
|
public ResultsViewModel ContextMenu { get; private set; }
|
||||||
|
|
||||||
public ResultsViewModel History { get; private set; }
|
public ResultsViewModel History { get; private set; }
|
||||||
|
|
||||||
|
public bool GameModeStatus { get; set; }
|
||||||
|
|
||||||
private string _queryText;
|
private string _queryText;
|
||||||
|
|
||||||
public string QueryText
|
public string QueryText
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue