mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge remote-tracking branch 'origin' into explorerMerge
This commit is contained in:
commit
5f9703ee88
35 changed files with 1378 additions and 27743 deletions
|
|
@ -115,7 +115,11 @@ namespace Flow.Launcher.Core.Resource
|
|||
if (languageToSet != AvailableLanguages.Chinese && languageToSet != AvailableLanguages.Chinese_TW)
|
||||
return false;
|
||||
|
||||
if (MessageBox.Show("Do you want to turn on search with Pinyin?", string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
|
||||
// No other languages should show the following text so just make it hard-coded
|
||||
// "Do you want to search with pinyin?"
|
||||
string text = languageToSet == AvailableLanguages.Chinese ? "是否启用拼音搜索?" : "是否啓用拼音搜索?" ;
|
||||
|
||||
if (MessageBox.Show(text, string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -221,4 +225,4 @@ namespace Flow.Launcher.Core.Resource
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
|
|
@ -21,6 +21,7 @@ namespace Flow.Launcher.Infrastructure
|
|||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
|
||||
public const string Issue = "https://github.com/Flow-Launcher/Flow.Launcher/issues/new";
|
||||
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
|
||||
public static readonly string Dev = "Dev";
|
||||
public const string Documentation = "https://flowlauncher.com/docs/#/usage-tips";
|
||||
|
||||
public static readonly int ThumbnailSize = 64;
|
||||
|
|
|
|||
|
|
@ -64,16 +64,5 @@
|
|||
<PackageReference Include="ToolGood.Words.Pinyin" Version="3.0.1.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="pinyindb\pinyin_gwoyeu_mapping.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="pinyindb\pinyin_mapping.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="pinyindb\unicode_to_hanyu_pinyin.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
@ -15,7 +15,7 @@ namespace Flow.Launcher.Infrastructure
|
|||
|
||||
private List<int> originalIndexs = new List<int>();
|
||||
private List<int> translatedIndexs = new List<int>();
|
||||
private int translaedLength = 0;
|
||||
private int translatedLength = 0;
|
||||
|
||||
public string key { get; private set; }
|
||||
|
||||
|
|
@ -32,13 +32,13 @@ namespace Flow.Launcher.Infrastructure
|
|||
originalIndexs.Add(originalIndex);
|
||||
translatedIndexs.Add(translatedIndex);
|
||||
translatedIndexs.Add(translatedIndex + length);
|
||||
translaedLength += length - 1;
|
||||
translatedLength += length - 1;
|
||||
}
|
||||
|
||||
public int MapToOriginalIndex(int translatedIndex)
|
||||
{
|
||||
if (translatedIndex > translatedIndexs.Last())
|
||||
return translatedIndex - translaedLength - 1;
|
||||
return translatedIndex - translatedLength - 1;
|
||||
|
||||
int lowerBound = 0;
|
||||
int upperBound = originalIndexs.Count - 1;
|
||||
|
|
@ -83,7 +83,7 @@ namespace Flow.Launcher.Infrastructure
|
|||
translatedIndex < translatedIndexs[upperBound * 2])
|
||||
{
|
||||
int indexDef = 0;
|
||||
|
||||
|
||||
for (int j = 0; j < upperBound; j++)
|
||||
{
|
||||
indexDef += translatedIndexs[j * 2 + 1] - translatedIndexs[j * 2];
|
||||
|
|
@ -102,9 +102,24 @@ namespace Flow.Launcher.Infrastructure
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Translate a language to English letters using a given rule.
|
||||
/// </summary>
|
||||
public interface IAlphabet
|
||||
{
|
||||
/// <summary>
|
||||
/// Translate a string to English letters, using a given rule.
|
||||
/// </summary>
|
||||
/// <param name="stringToTranslate">String to translate.</param>
|
||||
/// <returns></returns>
|
||||
public (string translation, TranslationMapping map) Translate(string stringToTranslate);
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a string can be translated to English letter with this Alphabet.
|
||||
/// </summary>
|
||||
/// <param name="stringToTranslate">String to translate.</param>
|
||||
/// <returns></returns>
|
||||
public bool CanBeTranslated(string stringToTranslate);
|
||||
}
|
||||
|
||||
public class PinyinAlphabet : IAlphabet
|
||||
|
|
@ -119,63 +134,70 @@ namespace Flow.Launcher.Infrastructure
|
|||
_settings = settings ?? throw new ArgumentNullException(nameof(settings));
|
||||
}
|
||||
|
||||
public bool CanBeTranslated(string stringToTranslate)
|
||||
{
|
||||
return WordsHelper.HasChinese(stringToTranslate);
|
||||
}
|
||||
|
||||
public (string translation, TranslationMapping map) Translate(string content)
|
||||
{
|
||||
if (_settings.ShouldUsePinyin)
|
||||
{
|
||||
if (!_pinyinCache.ContainsKey(content))
|
||||
{
|
||||
if (WordsHelper.HasChinese(content))
|
||||
{
|
||||
var resultList = WordsHelper.GetPinyinList(content);
|
||||
|
||||
StringBuilder resultBuilder = new StringBuilder();
|
||||
TranslationMapping map = new TranslationMapping();
|
||||
|
||||
bool pre = false;
|
||||
|
||||
for (int i = 0; i < resultList.Length; i++)
|
||||
{
|
||||
if (content[i] >= 0x3400 && content[i] <= 0x9FD5)
|
||||
{
|
||||
map.AddNewIndex(i, resultBuilder.Length, resultList[i].Length + 1);
|
||||
resultBuilder.Append(' ');
|
||||
resultBuilder.Append(resultList[i]);
|
||||
pre = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pre)
|
||||
{
|
||||
pre = false;
|
||||
resultBuilder.Append(' ');
|
||||
}
|
||||
|
||||
resultBuilder.Append(resultList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
map.endConstruct();
|
||||
|
||||
var key = resultBuilder.ToString();
|
||||
map.setKey(key);
|
||||
|
||||
return _pinyinCache[content] = (key, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (content, null);
|
||||
}
|
||||
return BuildCacheFromContent(content);
|
||||
}
|
||||
else
|
||||
{
|
||||
return _pinyinCache[content];
|
||||
}
|
||||
}
|
||||
return (content, null);
|
||||
}
|
||||
|
||||
private (string translation, TranslationMapping map) BuildCacheFromContent(string content)
|
||||
{
|
||||
if (WordsHelper.HasChinese(content))
|
||||
{
|
||||
var resultList = WordsHelper.GetPinyinList(content);
|
||||
|
||||
StringBuilder resultBuilder = new StringBuilder();
|
||||
TranslationMapping map = new TranslationMapping();
|
||||
|
||||
bool pre = false;
|
||||
|
||||
for (int i = 0; i < resultList.Length; i++)
|
||||
{
|
||||
if (content[i] >= 0x3400 && content[i] <= 0x9FD5)
|
||||
{
|
||||
map.AddNewIndex(i, resultBuilder.Length, resultList[i].Length + 1);
|
||||
resultBuilder.Append(' ');
|
||||
resultBuilder.Append(resultList[i]);
|
||||
pre = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pre)
|
||||
{
|
||||
pre = false;
|
||||
resultBuilder.Append(' ');
|
||||
}
|
||||
|
||||
resultBuilder.Append(resultList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
map.endConstruct();
|
||||
|
||||
var key = resultBuilder.ToString();
|
||||
map.setKey(key);
|
||||
|
||||
return _pinyinCache[content] = (key, map);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (content, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Flow.Launcher.Plugin.SharedModels;
|
||||
using Flow.Launcher.Plugin.SharedModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
@ -60,8 +60,13 @@ namespace Flow.Launcher.Infrastructure
|
|||
return new MatchResult(false, UserSettingSearchPrecision);
|
||||
|
||||
query = query.Trim();
|
||||
TranslationMapping translationMapping;
|
||||
(stringToCompare, translationMapping) = _alphabet?.Translate(stringToCompare) ?? (stringToCompare, null);
|
||||
TranslationMapping translationMapping = null;
|
||||
if (_alphabet is not null && !_alphabet.CanBeTranslated(query))
|
||||
{
|
||||
// We assume that if a query can be translated (containing characters of a language, like Chinese)
|
||||
// it actually means user doesn't want it to be translated to English letters.
|
||||
(stringToCompare, translationMapping) = _alphabet.Translate(stringToCompare);
|
||||
}
|
||||
|
||||
var currentAcronymQueryIndex = 0;
|
||||
var acronymMatchData = new List<int>();
|
||||
|
|
|
|||
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
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
|
|
|||
19
Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs
Normal file
19
Flow.Launcher/Converters/DateTimeFormatToNowConverter.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace Flow.Launcher.Converters
|
||||
{
|
||||
public class DateTimeFormatToNowConverter : IValueConverter
|
||||
{
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return value is not string format ? null : DateTime.Now.ToString(format);
|
||||
}
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,9 +38,8 @@
|
|||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Visibility="Visible">
|
||||
Press key
|
||||
</TextBlock>
|
||||
Text="{DynamicResource flowlauncherPressHotkey}"
|
||||
Visibility="Visible" />
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
|
|
@ -49,8 +48,8 @@
|
|||
Margin="0,0,18,0"
|
||||
VerticalContentAlignment="Center"
|
||||
input:InputMethod.IsInputMethodEnabled="False"
|
||||
LostFocus="tbHotkey_LostFocus"
|
||||
PreviewKeyDown="TbHotkey_OnPreviewKeyDown"
|
||||
TabIndex="100"
|
||||
LostFocus="tbHotkey_LostFocus"/>
|
||||
TabIndex="100" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
@ -9,6 +9,7 @@ using Flow.Launcher.Helper;
|
|||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Threading;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -113,7 +114,7 @@ namespace Flow.Launcher
|
|||
private void tbHotkey_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
tbMsg.Text = tbMsgTextOriginal;
|
||||
tbMsg.Foreground = tbMsgForegroundColorOriginal;
|
||||
tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<system:String x:Key="PositionResetToolTip">Reset search window position</system:String>
|
||||
|
||||
<!-- Setting General -->
|
||||
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>
|
||||
<system:String x:Key="flowlauncher_settings">Settings</system:String>
|
||||
<system:String x:Key="general">General</system:String>
|
||||
<system:String x:Key="portableMode">Portable Mode</system:String>
|
||||
<system:String x:Key="portableModeToolTIp">Store all settings and user data in one folder (Useful when used with removable drives or cloud services).</system:String>
|
||||
|
|
@ -64,8 +64,8 @@
|
|||
<system:String x:Key="hideNotifyIconToolTip">When the icon is hidden from the tray, the Settings menu can be opened by right-clicking on the search window.</system:String>
|
||||
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
|
||||
<system:String x:Key="querySearchPrecisionToolTip">Changes minimum match score required for results.</system:String>
|
||||
<system:String x:Key="ShouldUsePinyin">Should Use Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese</system:String>
|
||||
<system:String x:Key="ShouldUsePinyin">Search with Pinyin</system:String>
|
||||
<system:String x:Key="ShouldUsePinyinToolTip">Allows using Pinyin to search. Pinyin is the standard system of romanized spelling for translating Chinese.</system:String>
|
||||
<system:String x:Key="shadowEffectNotAllowed">Shadow effect is not allowed while current theme has blur effect enabled</system:String>
|
||||
|
||||
<!-- Setting Plugin -->
|
||||
|
|
@ -105,9 +105,9 @@
|
|||
<system:String x:Key="installbtn">Install</system:String>
|
||||
<system:String x:Key="uninstallbtn">Uninstall</system:String>
|
||||
<system:String x:Key="updatebtn">Update</system:String>
|
||||
<system:String x:Key="LabelInstalledToolTip">Plug-in already installed</system:String>
|
||||
<system:String x:Key="LabelInstalledToolTip">Plugin already installed</system:String>
|
||||
<system:String x:Key="LabelNew">New Version</system:String>
|
||||
<system:String x:Key="LabelNewToolTip">This plug-in has been updated within the last 7 days</system:String>
|
||||
<system:String x:Key="LabelNewToolTip">This plugin has been updated within the last 7 days</system:String>
|
||||
<system:String x:Key="LabelUpdateToolTip">New Update is Available</system:String>
|
||||
|
||||
|
||||
|
|
@ -146,9 +146,10 @@
|
|||
<system:String x:Key="showOpenResultHotkeyToolTip">Show result selection hotkey with results.</system:String>
|
||||
<system:String x:Key="customQueryHotkey">Custom Query Hotkey</system:String>
|
||||
<system:String x:Key="customQueryShortcut">Custom Query Shortcut</system:String>
|
||||
<system:String x:Key="builtinShortcuts">Built-in Shortcuts</system:String>
|
||||
<system:String x:Key="customQuery">Query</system:String>
|
||||
<system:String x:Key="customShortcut">Shortcut</system:String>
|
||||
<system:String x:Key="customShortcutExpansion">Expanded</system:String>
|
||||
<system:String x:Key="customShortcutExpansion">Expansion</system:String>
|
||||
<system:String x:Key="builtinShortcutDescription">Description</system:String>
|
||||
<system:String x:Key="delete">Delete</system:String>
|
||||
<system:String x:Key="edit">Edit</system:String>
|
||||
|
|
@ -163,6 +164,7 @@
|
|||
<system:String x:Key="windowWidthSizeToolTip">You can also quickly adjust this by using Ctrl+[ and Ctrl+].</system:String>
|
||||
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
|
||||
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
|
||||
<system:String x:Key="flowlauncherPressHotkey">Press Key</system:String>
|
||||
|
||||
<!-- Setting Proxy -->
|
||||
<system:String x:Key="proxy">HTTP Proxy</system:String>
|
||||
|
|
@ -186,6 +188,7 @@
|
|||
<system:String x:Key="github">Github</system:String>
|
||||
<system:String x:Key="docs">Docs</system:String>
|
||||
<system:String x:Key="version">Version</system:String>
|
||||
<system:String x:Key="icons">Icons</system:String>
|
||||
<system:String x:Key="about_activate_times">You have activated Flow Launcher {0} times</system:String>
|
||||
<system:String x:Key="checkUpdates">Check for Updates</system:String>
|
||||
<system:String x:Key="newVersionTips">New version {0} is available, would you like to restart Flow Launcher to use the update?</system:String>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:svgc="http://sharpvectors.codeplex.com/svgc/"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
xmlns:vm="clr-namespace:Flow.Launcher.ViewModel"
|
||||
Name="FlowMainWindow"
|
||||
Title="Flow Launcher"
|
||||
|
|
@ -80,30 +81,26 @@
|
|||
Command="{Binding LoadContextMenuCommand}" />
|
||||
<KeyBinding Key="Left"
|
||||
Command="{Binding EscCommand}" />
|
||||
<KeyBinding
|
||||
Key="H"
|
||||
<KeyBinding Key="H"
|
||||
Command="{Binding LoadHistoryCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
|
||||
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
|
||||
<KeyBinding
|
||||
Key="OemCloseBrackets"
|
||||
<KeyBinding Key="Right"
|
||||
Command="{Binding LoadContextMenuCommand}" />
|
||||
<KeyBinding Key="Left"
|
||||
Command="{Binding EscCommand}" />
|
||||
<KeyBinding Key="OemCloseBrackets"
|
||||
Command="{Binding IncreaseWidthCommand}"
|
||||
Modifiers="Control" />
|
||||
<KeyBinding
|
||||
Key="OemOpenBrackets"
|
||||
<KeyBinding Key="OemOpenBrackets"
|
||||
Command="{Binding DecreaseWidthCommand}"
|
||||
Modifiers="Control" />
|
||||
<KeyBinding
|
||||
Key="OemPlus"
|
||||
<KeyBinding Key="OemPlus"
|
||||
Command="{Binding IncreaseMaxResultCommand}"
|
||||
Modifiers="Control" />
|
||||
<KeyBinding
|
||||
Key="OemMinus"
|
||||
<KeyBinding Key="OemMinus"
|
||||
Command="{Binding DecreaseMaxResultCommand}"
|
||||
Modifiers="Control" />
|
||||
<KeyBinding
|
||||
Key="H"
|
||||
<KeyBinding Key="H"
|
||||
Command="{Binding LoadHistoryCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding Key="Enter"
|
||||
|
|
@ -195,32 +192,55 @@
|
|||
<TextBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Command="ApplicationCommands.Cut"
|
||||
Header="{DynamicResource cut}" />
|
||||
Header="{DynamicResource cut}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="ApplicationCommands.Copy"
|
||||
Header="{DynamicResource copy}" />
|
||||
Header="{DynamicResource copy}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="ApplicationCommands.Paste"
|
||||
Header="{DynamicResource paste}" />
|
||||
Header="{DynamicResource paste}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator Margin="0"
|
||||
Padding="0,4,0,4"
|
||||
Background="{DynamicResource ContextSeparator}" />
|
||||
<MenuItem Click="OnContextMenusForSettingsClick"
|
||||
Header="{DynamicResource flowlauncher_settings}" />
|
||||
Header="{DynamicResource flowlauncher_settings}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Command="{Binding EscCommand}"
|
||||
Header="{DynamicResource closeWindow}" />
|
||||
Header="{DynamicResource closeWindow}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TextBox.ContextMenu>
|
||||
</TextBox>
|
||||
|
||||
<StackPanel x:Name="ClockPanel"
|
||||
Style="{DynamicResource ClockPanel}"
|
||||
IsHitTestVisible="False">
|
||||
IsHitTestVisible="False"
|
||||
Style="{DynamicResource ClockPanel}">
|
||||
<TextBlock
|
||||
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
x:Name="ClockBox"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}" />
|
||||
<TextBlock Style="{DynamicResource ClockBox}"
|
||||
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}"
|
||||
Text="{Binding ClockText}"/>
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
|
||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||
|
|
@ -300,7 +320,8 @@
|
|||
<ContentControl>
|
||||
<flowlauncher:ResultListBox x:Name="ResultListBox"
|
||||
DataContext="{Binding Results}"
|
||||
PreviewMouseLeftButtonUp="OnPreviewMouseButtonDown" />
|
||||
LeftClickResultCommand="{Binding LeftClickResultCommand}"
|
||||
RightClickResultCommand="{Binding RightClickResultCommand}" />
|
||||
</ContentControl>
|
||||
</Border>
|
||||
<Border Style="{DynamicResource WindowRadius}">
|
||||
|
|
@ -317,7 +338,8 @@
|
|||
<ContentControl>
|
||||
<flowlauncher:ResultListBox x:Name="ContextMenu"
|
||||
DataContext="{Binding ContextMenu}"
|
||||
PreviewMouseDown="OnPreviewMouseButtonDown" />
|
||||
LeftClickResultCommand="{Binding LeftClickResultCommand}"
|
||||
RightClickResultCommand="{Binding RightClickResultCommand}" />
|
||||
</ContentControl>
|
||||
</Border>
|
||||
<Border Style="{DynamicResource WindowRadius}">
|
||||
|
|
@ -334,7 +356,8 @@
|
|||
<ContentControl>
|
||||
<flowlauncher:ResultListBox x:Name="History"
|
||||
DataContext="{Binding History}"
|
||||
PreviewMouseDown="OnPreviewMouseButtonDown" />
|
||||
LeftClickResultCommand="{Binding LeftClickResultCommand}"
|
||||
RightClickResultCommand="{Binding RightClickResultCommand}" />
|
||||
</ContentControl>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
|
@ -27,6 +27,13 @@ using Microsoft.AspNetCore.Http;
|
|||
using System.IO;
|
||||
using System.Windows.Threading;
|
||||
using System.Windows.Data;
|
||||
using ModernWpf.Controls;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms.Design.Behavior;
|
||||
using System.Security.Cryptography;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Microsoft.VisualBasic.Devices;
|
||||
using Microsoft.FSharp.Data.UnitSystems.SI.UnitNames;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -102,7 +109,6 @@ namespace Flow.Launcher
|
|||
// since the default main window visibility is visible
|
||||
// so we need set focus during startup
|
||||
QueryTextBox.Focus();
|
||||
|
||||
_viewModel.PropertyChanged += (o, e) =>
|
||||
{
|
||||
switch (e.PropertyName)
|
||||
|
|
@ -224,11 +230,12 @@ namespace Flow.Launcher
|
|||
private void UpdateNotifyIconText()
|
||||
{
|
||||
var menu = contextMenu;
|
||||
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
|
||||
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
|
||||
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
|
||||
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
||||
((MenuItem)menu.Items[5]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
||||
((MenuItem)menu.Items[0]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
|
||||
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
|
||||
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
|
||||
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
|
||||
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
|
||||
|
||||
}
|
||||
|
||||
private void InitializeNotifyIcon()
|
||||
|
|
@ -239,32 +246,38 @@ namespace Flow.Launcher
|
|||
Icon = Properties.Resources.app,
|
||||
Visible = !_settings.HideNotifyIcon
|
||||
};
|
||||
|
||||
contextMenu = new ContextMenu();
|
||||
|
||||
var header = new MenuItem
|
||||
{
|
||||
Header = "Flow Launcher",
|
||||
IsEnabled = false
|
||||
};
|
||||
var openIcon = new FontIcon { Glyph = "\ue71e" };
|
||||
var open = new MenuItem
|
||||
{
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" +_settings.Hotkey + ")"
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")",
|
||||
Icon = openIcon
|
||||
};
|
||||
var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" };
|
||||
var gamemode = new MenuItem
|
||||
{
|
||||
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
|
||||
Header = InternationalizationManager.Instance.GetTranslation("GameMode"),
|
||||
Icon = gamemodeIcon
|
||||
};
|
||||
var positionresetIcon = new FontIcon { Glyph = "\ue73f" };
|
||||
var positionreset = new MenuItem
|
||||
{
|
||||
Header = InternationalizationManager.Instance.GetTranslation("PositionReset")
|
||||
Header = InternationalizationManager.Instance.GetTranslation("PositionReset"),
|
||||
Icon = positionresetIcon
|
||||
};
|
||||
var settingsIcon = new FontIcon { Glyph = "\ue713" };
|
||||
var settings = new MenuItem
|
||||
{
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"),
|
||||
Icon = settingsIcon
|
||||
};
|
||||
var exitIcon = new FontIcon { Glyph = "\ue7e8" };
|
||||
var exit = new MenuItem
|
||||
{
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit")
|
||||
Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"),
|
||||
Icon = exitIcon
|
||||
};
|
||||
|
||||
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
|
||||
|
|
@ -272,10 +285,11 @@ namespace Flow.Launcher
|
|||
positionreset.Click += (o, e) => PositionReset();
|
||||
settings.Click += (o, e) => App.API.OpenSettingDialog();
|
||||
exit.Click += (o, e) => Close();
|
||||
contextMenu.Items.Add(header);
|
||||
contextMenu.Items.Add(open);
|
||||
|
||||
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
|
||||
positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");
|
||||
|
||||
contextMenu.Items.Add(open);
|
||||
contextMenu.Items.Add(gamemode);
|
||||
contextMenu.Items.Add(positionreset);
|
||||
contextMenu.Items.Add(settings);
|
||||
|
|
@ -352,11 +366,14 @@ namespace Flow.Launcher
|
|||
|
||||
_animating = true;
|
||||
UpdatePosition();
|
||||
Storyboard sb = new Storyboard();
|
||||
|
||||
Storyboard windowsb = new Storyboard();
|
||||
Storyboard clocksb = new Storyboard();
|
||||
Storyboard iconsb = new Storyboard();
|
||||
CircleEase easing = new CircleEase(); // or whatever easing class you want
|
||||
CircleEase easing = new CircleEase();
|
||||
easing.EasingMode = EasingMode.EaseInOut;
|
||||
var da = new DoubleAnimation
|
||||
|
||||
var WindowOpacity = new DoubleAnimation
|
||||
{
|
||||
From = 0,
|
||||
To = 1,
|
||||
|
|
@ -364,33 +381,76 @@ namespace Flow.Launcher
|
|||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
var da2 = new DoubleAnimation
|
||||
var WindowMotion = new DoubleAnimation
|
||||
{
|
||||
From = Top + 10,
|
||||
To = Top,
|
||||
Duration = TimeSpan.FromSeconds(0.25),
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
var da3 = new DoubleAnimation
|
||||
{
|
||||
var IconMotion = new DoubleAnimation
|
||||
{
|
||||
From = 12,
|
||||
To = 0,
|
||||
EasingFunction = easing,
|
||||
Duration = TimeSpan.FromSeconds(0.36),
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
Storyboard.SetTarget(da, this);
|
||||
Storyboard.SetTargetProperty(da, new PropertyPath(Window.OpacityProperty));
|
||||
Storyboard.SetTargetProperty(da2, new PropertyPath(Window.TopProperty));
|
||||
Storyboard.SetTargetProperty(da3, new PropertyPath(TopProperty));
|
||||
sb.Children.Add(da);
|
||||
sb.Children.Add(da2);
|
||||
iconsb.Children.Add(da3);
|
||||
sb.Completed += (_, _) => _animating = false;
|
||||
};
|
||||
|
||||
var ClockOpacity = new DoubleAnimation
|
||||
{
|
||||
From = 0,
|
||||
To = 1,
|
||||
EasingFunction = easing,
|
||||
Duration = TimeSpan.FromSeconds(0.36),
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
double TargetIconOpacity = SearchIcon.Opacity; // Animation Target Opacity from Style
|
||||
var IconOpacity = new DoubleAnimation
|
||||
{
|
||||
From = 0,
|
||||
To = TargetIconOpacity,
|
||||
EasingFunction = easing,
|
||||
Duration = TimeSpan.FromSeconds(0.36),
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
double right = ClockPanel.Margin.Right;
|
||||
var thicknessAnimation = new ThicknessAnimation
|
||||
{
|
||||
From = new Thickness(0, 12, right, 0),
|
||||
To = new Thickness(0, 0, right, 0),
|
||||
EasingFunction = easing,
|
||||
Duration = TimeSpan.FromSeconds(0.36),
|
||||
FillBehavior = FillBehavior.Stop
|
||||
};
|
||||
|
||||
Storyboard.SetTargetProperty(ClockOpacity, new PropertyPath(OpacityProperty));
|
||||
Storyboard.SetTargetName(thicknessAnimation, "ClockPanel");
|
||||
Storyboard.SetTargetProperty(thicknessAnimation, new PropertyPath(MarginProperty));
|
||||
Storyboard.SetTarget(WindowOpacity, this);
|
||||
Storyboard.SetTargetProperty(WindowOpacity, new PropertyPath(Window.OpacityProperty));
|
||||
Storyboard.SetTargetProperty(WindowMotion, new PropertyPath(Window.TopProperty));
|
||||
Storyboard.SetTargetProperty(IconMotion, new PropertyPath(TopProperty));
|
||||
Storyboard.SetTargetProperty(IconOpacity, new PropertyPath(OpacityProperty));
|
||||
|
||||
clocksb.Children.Add(thicknessAnimation);
|
||||
clocksb.Children.Add(ClockOpacity);
|
||||
windowsb.Children.Add(WindowOpacity);
|
||||
windowsb.Children.Add(WindowMotion);
|
||||
iconsb.Children.Add(IconMotion);
|
||||
iconsb.Children.Add(IconOpacity);
|
||||
|
||||
windowsb.Completed += (_, _) => _animating = false;
|
||||
_settings.WindowLeft = Left;
|
||||
_settings.WindowTop = Top;
|
||||
|
||||
if (QueryTextBox.Text.Length == 0)
|
||||
{
|
||||
clocksb.Begin(ClockPanel);
|
||||
}
|
||||
iconsb.Begin(SearchIcon);
|
||||
sb.Begin(FlowMainWindow);
|
||||
windowsb.Begin(FlowMainWindow);
|
||||
}
|
||||
|
||||
private void OnMouseDown(object sender, MouseButtonEventArgs e)
|
||||
|
|
@ -398,28 +458,6 @@ namespace Flow.Launcher
|
|||
if (e.ChangedButton == MouseButton.Left) DragMove();
|
||||
}
|
||||
|
||||
private void OnPreviewMouseButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (sender != null && e.OriginalSource != null)
|
||||
{
|
||||
var r = (ResultListBox)sender;
|
||||
var d = (DependencyObject)e.OriginalSource;
|
||||
var item = ItemsControl.ContainerFromElement(r, d) as ListBoxItem;
|
||||
var result = (ResultViewModel)item?.DataContext;
|
||||
if (result != null)
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
{
|
||||
_viewModel.OpenResultCommand.Execute(null);
|
||||
}
|
||||
else if (e.ChangedButton == MouseButton.Right)
|
||||
{
|
||||
_viewModel.LoadContextMenuCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPreviewDragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
|
|
|||
|
|
@ -1407,7 +1407,8 @@
|
|||
Padding="{TemplateBinding Padding}"
|
||||
BorderBrush="{DynamicResource ButtonInsideBorder}"
|
||||
BorderThickness="{DynamicResource CustomButtonInsideBorderThickness}"
|
||||
CornerRadius="4">
|
||||
CornerRadius="4"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
|
|
@ -2727,73 +2728,491 @@
|
|||
</Style>
|
||||
<!--#endregion-->
|
||||
|
||||
<Style TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
|
||||
<system:Double x:Key="MenuBarHeight">40</system:Double>
|
||||
<Thickness x:Key="MenuFlyoutScrollerMargin">4,4,4,4</Thickness>
|
||||
<Thickness x:Key="MenuFlyoutItemRevealBorderThickness">1</Thickness>
|
||||
<Thickness x:Key="ToggleMenuFlyoutItemRevealBorderThickness">1</Thickness>
|
||||
<Thickness x:Key="MenuFlyoutSubItemRevealBorderThickness">1</Thickness>
|
||||
|
||||
<ui:SharedSizeGroupConverter x:Key="SharedSizeGroupConverter" />
|
||||
|
||||
<Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type FrameworkElement}, ResourceId=MenuScrollViewer}" TargetType="ScrollViewer">
|
||||
<Setter Property="HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
||||
<Setter Property="PanningMode" Value="VerticalOnly" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DefaultMenuItemSeparatorStyle" TargetType="Separator">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuFlyoutSeparatorBackground}" />
|
||||
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutSeparatorThemePadding}" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="true" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type MenuItem}">
|
||||
<Border
|
||||
Name="bdr"
|
||||
Padding="24,6,24,6"
|
||||
Background="Transparent">
|
||||
<TextBlock
|
||||
Name="Menu"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Header}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsVisible" Value="True">
|
||||
<Setter TargetName="bdr" Property="Background" Value="{DynamicResource CustomContextBackground}" />
|
||||
<Setter TargetName="Menu" Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bdr" Property="Background" Value="{DynamicResource CustomContextHover}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="Menu" Property="Foreground" Value="{DynamicResource CustomContextDisabled}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
<ControlTemplate TargetType="Separator">
|
||||
<Rectangle
|
||||
Height="{DynamicResource MenuFlyoutSeparatorThemeHeight}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Fill="{TemplateBinding Background}" />
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type ContextMenu}">
|
||||
<Style
|
||||
x:Key="{x:Static MenuItem.SeparatorStyleKey}"
|
||||
BasedOn="{StaticResource DefaultMenuItemSeparatorStyle}"
|
||||
TargetType="Separator" />
|
||||
|
||||
<ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}" TargetType="{x:Type MenuItem}">
|
||||
<Grid
|
||||
x:Name="ContentRoot"
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Border
|
||||
x:Name="Background"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" />
|
||||
|
||||
<ContentPresenter
|
||||
Margin="12,0,12,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
ContentSource="Header"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Background" Property="Background" Value="{DynamicResource MenuBarItemBackgroundPointerOver}" />
|
||||
<Setter TargetName="Background" Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrushPointerOver}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Background" Property="Background" Value="{DynamicResource MenuBarItemBackgroundPressed}" />
|
||||
<Setter TargetName="Background" Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrushPressed}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
|
||||
<Grid
|
||||
x:Name="ContentRoot"
|
||||
Background="{TemplateBinding Background}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Border
|
||||
x:Name="Background"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" />
|
||||
|
||||
<ContentPresenter
|
||||
Margin="12,0,12,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
ContentSource="Header"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
|
||||
<ui:MenuPopup
|
||||
x:Name="PART_Popup"
|
||||
AllowsTransparency="true"
|
||||
Focusable="false"
|
||||
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Placement="Bottom"
|
||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
|
||||
<ui:ThemeShadowChrome CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" IsShadowEnabled="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
|
||||
<Border
|
||||
x:Name="SubMenuRoot"
|
||||
Background="{DynamicResource MenuFlyoutPresenterBackground}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}">
|
||||
<Grid>
|
||||
<ScrollViewer
|
||||
x:Name="SubMenuScrollViewer"
|
||||
MinWidth="{DynamicResource FlyoutThemeMinWidth}"
|
||||
Margin="{DynamicResource MenuFlyoutPresenterThemePadding}"
|
||||
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
|
||||
TypeInTargetAssembly={x:Type FrameworkElement}}}">
|
||||
<ItemsPresenter
|
||||
Grid.IsSharedSizeScope="true"
|
||||
KeyboardNavigation.DirectionalNavigation="Cycle"
|
||||
KeyboardNavigation.TabNavigation="Cycle"
|
||||
RenderOptions.ClearTypeHint="Enabled"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
<Border
|
||||
x:Name="SubMenuBorder"
|
||||
BorderBrush="{DynamicResource MenuFlyoutPresenterBorderBrush}"
|
||||
BorderThickness="{DynamicResource MenuFlyoutPresenterBorderThemeThickness}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ui:ThemeShadowChrome>
|
||||
</ui:MenuPopup>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
|
||||
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
|
||||
</Trigger>
|
||||
<Trigger SourceName="PART_Popup" Property="IsSuspendingAnimation" Value="true">
|
||||
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Background" Property="Background" Value="{DynamicResource MenuBarItemBackgroundPointerOver}" />
|
||||
<Setter TargetName="Background" Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrushPointerOver}" />
|
||||
</Trigger>
|
||||
<!-- Selected -->
|
||||
<Trigger Property="IsSubmenuOpen" Value="True">
|
||||
<Setter TargetName="Background" Property="Background" Value="{DynamicResource MenuBarItemBackgroundSelected}" />
|
||||
<Setter TargetName="Background" Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrushSelected}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="Background" Property="Background" Value="{DynamicResource MenuBarItemBackgroundPressed}" />
|
||||
<Setter TargetName="Background" Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrushPressed}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- DefaultMenuFlyoutSubItemStyle -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}" TargetType="{x:Type MenuItem}">
|
||||
<ControlTemplate.Resources>
|
||||
<StreamGeometry x:Key="CheckMark">F1 M 17.939453 5.439453 L 7.5 15.888672 L 2.060547 10.439453 L 2.939453 9.560547 L 7.5 14.111328 L 17.060547 4.560547 Z</StreamGeometry>
|
||||
</ControlTemplate.Resources>
|
||||
<Border
|
||||
x:Name="LayoutRoot"
|
||||
Height="Auto"
|
||||
Margin="5,2,5,2"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"
|
||||
SnapsToDevicePixels="true"
|
||||
TextElement.Foreground="{DynamicResource Color05B}"
|
||||
UseLayoutRounding="True">
|
||||
<Grid x:Name="AnimationRoot">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="{TemplateBinding Visibility, Converter={StaticResource SharedSizeGroupConverter}, ConverterParameter=MenuItemCheckColumnGroup}" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="{TemplateBinding Visibility, Converter={StaticResource SharedSizeGroupConverter}, ConverterParameter=MenuItemIconColumnGroup}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:FontIconFallback
|
||||
x:Name="CheckGlyph"
|
||||
Margin="0,0,16,0"
|
||||
Data="{StaticResource CheckMark}"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource ToggleMenuFlyoutItemCheckGlyphForeground}"
|
||||
Opacity="0"
|
||||
Visibility="Collapsed" />
|
||||
<Viewbox
|
||||
x:Name="IconRoot"
|
||||
Grid.Column="1"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="0,1,12,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Stretch"
|
||||
TextBlock.FontFamily="/Resources/#Segoe Fluent Icons">
|
||||
<ContentPresenter
|
||||
x:Name="IconContent"
|
||||
ContentSource="Icon"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Viewbox>
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
ContentSource="Header"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{DynamicResource Color05B}" />
|
||||
<TextBlock
|
||||
x:Name="KeyboardAcceleratorTextBlock"
|
||||
Grid.Column="3"
|
||||
Margin="24,4,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForeground}"
|
||||
Style="{StaticResource CaptionTextBlockStyle}"
|
||||
Text="{TemplateBinding InputGestureText}"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsVisible" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter TargetName="IconRoot" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="InputGestureText" Value="">
|
||||
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="CheckGlyph" Property="Opacity" Value="1" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsCheckable" Value="True">
|
||||
<Setter TargetName="CheckGlyph" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource CustomContextHover}" />
|
||||
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPointerOver}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource CustomContextClick}" />
|
||||
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundPressed}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutItemBackgroundDisabled}" />
|
||||
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutItemForegroundDisabled}" />
|
||||
<Setter TargetName="KeyboardAcceleratorTextBlock" Property="Foreground" Value="{DynamicResource MenuFlyoutItemKeyboardAcceleratorTextForegroundDisabled}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<!-- DefaultMenuFlyoutItemStyle -->
|
||||
<ControlTemplate x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}" TargetType="{x:Type MenuItem}">
|
||||
<ControlTemplate.Resources>
|
||||
<StreamGeometry x:Key="ChevronRight">M 5.029297 19.091797 L 14.111328 10 L 5.029297 0.908203 L 5.908203 0.029297 L 15.888672 10 L 5.908203 19.970703 Z</StreamGeometry>
|
||||
</ControlTemplate.Resources>
|
||||
<Border
|
||||
x:Name="LayoutRoot"
|
||||
Margin="{DynamicResource MenuFlyoutItemMargin}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Grid x:Name="AnimationRoot">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemCheckColumnGroup" />
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="MenuItemIconColumnGroup" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Viewbox
|
||||
x:Name="IconRoot"
|
||||
Grid.Column="1"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="0,0,12,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center">
|
||||
<ContentPresenter
|
||||
x:Name="IconContent"
|
||||
ContentSource="Icon"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Viewbox>
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Grid.Column="2"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
ContentSource="Header"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}" />
|
||||
<ui:FontIconFallback
|
||||
x:Name="SubItemChevron"
|
||||
Grid.Column="3"
|
||||
Margin="{DynamicResource MenuFlyoutItemChevronMargin}"
|
||||
Data="{StaticResource ChevronRight}"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource MenuFlyoutSubItemChevron}">
|
||||
<UIElement.RenderTransform>
|
||||
<TranslateTransform Y="1" />
|
||||
</UIElement.RenderTransform>
|
||||
</ui:FontIconFallback>
|
||||
<Popup
|
||||
x:Name="PART_Popup"
|
||||
AllowsTransparency="true"
|
||||
Focusable="false"
|
||||
IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Placement="Right"
|
||||
PlacementTarget="{Binding ElementName=LayoutRoot}"
|
||||
PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}">
|
||||
<Popup.PlacementRectangle>
|
||||
<MultiBinding>
|
||||
<MultiBinding.Converter>
|
||||
<ui:PlacementRectangleConverter Margin="4,-1" />
|
||||
</MultiBinding.Converter>
|
||||
<Binding ElementName="LayoutRoot" Path="ActualWidth" />
|
||||
<Binding ElementName="LayoutRoot" Path="ActualHeight" />
|
||||
</MultiBinding>
|
||||
</Popup.PlacementRectangle>
|
||||
<ui:ThemeShadowChrome CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" IsShadowEnabled="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
|
||||
<Border
|
||||
x:Name="SubMenuRoot"
|
||||
Background="{DynamicResource MenuFlyoutPresenterBackground}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}">
|
||||
<Grid>
|
||||
<ScrollViewer
|
||||
x:Name="SubMenuScrollViewer"
|
||||
MinWidth="{DynamicResource FlyoutThemeMinWidth}"
|
||||
Margin="{DynamicResource MenuFlyoutPresenterThemePadding}"
|
||||
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
|
||||
TypeInTargetAssembly={x:Type FrameworkElement}}}">
|
||||
<ItemsPresenter
|
||||
Grid.IsSharedSizeScope="true"
|
||||
KeyboardNavigation.DirectionalNavigation="Cycle"
|
||||
KeyboardNavigation.TabNavigation="Cycle"
|
||||
RenderOptions.ClearTypeHint="Enabled"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
<Border
|
||||
x:Name="SubMenuBorder"
|
||||
BorderBrush="{DynamicResource MenuFlyoutPresenterBorderBrush}"
|
||||
BorderThickness="{DynamicResource MenuFlyoutPresenterBorderThemeThickness}"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ui:ThemeShadowChrome>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsVisible" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSuspendingPopupAnimation" Value="true">
|
||||
<Setter TargetName="PART_Popup" Property="PopupAnimation" Value="None" />
|
||||
</Trigger>
|
||||
<Trigger Property="Icon" Value="{x:Null}">
|
||||
<Setter TargetName="IconRoot" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsHighlighted" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutSubItemBackgroundPointerOver}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutSubItemForegroundPointerOver}" />
|
||||
<Setter TargetName="SubItemChevron" Property="Foreground" Value="{DynamicResource MenuFlyoutSubItemChevronPointerOver}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutSubItemBackgroundPressed}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutSubItemForegroundPressed}" />
|
||||
<Setter TargetName="SubItemChevron" Property="Foreground" Value="{DynamicResource MenuFlyoutSubItemChevronPressed}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSubmenuOpen" Value="True">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutSubItemBackgroundSubMenuOpened}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutSubItemForegroundSubMenuOpened}" />
|
||||
<Setter TargetName="SubItemChevron" Property="Foreground" Value="{DynamicResource MenuFlyoutSubItemChevronSubMenuOpened}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="LayoutRoot" Property="Background" Value="{DynamicResource MenuFlyoutSubItemBackgroundDisabled}" />
|
||||
<Setter TargetName="ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MenuFlyoutSubItemForegroundDisabled}" />
|
||||
<Setter TargetName="SubItemChevron" Property="Foreground" Value="{DynamicResource MenuFlyoutSubItemChevronDisabled}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
<Style x:Key="DefaultMenuItemStyle" TargetType="{x:Type MenuItem}">
|
||||
<Setter Property="OverridesDefaultStyle" Value="True" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Setter Property="Background" Value="{DynamicResource MenuFlyoutItemBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutItemForeground}" />
|
||||
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutItemThemePaddingNarrow}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="ScrollViewer.PanningMode" Value="Both" />
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
|
||||
<Setter Property="ui:FocusVisualHelper.UseSystemFocusVisuals" Value="{DynamicResource UseSystemFocusVisuals}" />
|
||||
<Setter Property="ui:ControlHelper.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuItemTemplateKey}}" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Role" Value="TopLevelHeader">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuBarItemBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource MenuBarItemBorderThickness}" />
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelHeaderTemplateKey}}" />
|
||||
<Setter Property="IsTabStop" Value="True" />
|
||||
<Setter Property="Height" Value="{StaticResource MenuBarHeight}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="TopLevelItem">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuBarItemBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource MenuBarItemBorderBrush}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource MenuBarItemBorderThickness}" />
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=TopLevelItemTemplateKey}}" />
|
||||
<Setter Property="IsTabStop" Value="True" />
|
||||
<Setter Property="Height" Value="{StaticResource MenuBarHeight}" />
|
||||
</Trigger>
|
||||
<Trigger Property="Role" Value="SubmenuHeader">
|
||||
<Setter Property="Background" Value="{DynamicResource MenuFlyoutSubItemBackground}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource MenuFlyoutSubItemForeground}" />
|
||||
<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey TypeInTargetAssembly={x:Type MenuItem}, ResourceId=SubmenuHeaderTemplateKey}}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsCheckable" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="ui:FocusVisualHelper.UseSystemFocusVisuals" Value="True" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultMenuItemStyle}" TargetType="{x:Type MenuItem}" />
|
||||
|
||||
|
||||
|
||||
<Style TargetType="{x:Type ContextMenu}">
|
||||
<Setter Property="Background" Value="{DynamicResource CustomContextBackground}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource CustomContextBorder}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource MenuFlyoutPresenterBorderThemeThickness}" />
|
||||
<Setter Property="Padding" Value="{DynamicResource MenuFlyoutPresenterThemePadding}" />
|
||||
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
|
||||
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
|
||||
<Setter Property="FontStyle" Value="Normal" />
|
||||
<Setter Property="FontWeight" Value="Normal" />
|
||||
<Setter Property="Grid.IsSharedSizeScope" Value="true" />
|
||||
<Setter Property="HasDropShadow" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
|
||||
<!--<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />-->
|
||||
<!--<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />-->
|
||||
<!--<Setter Property="ScrollViewer.PanningMode" Value="VerticalOnly" />-->
|
||||
<Setter Property="Stylus.IsFlicksEnabled" Value="False" />
|
||||
<Setter Property="MaxWidth" Value="{DynamicResource FlyoutThemeMaxWidth}" />
|
||||
<Setter Property="MinHeight" Value="{DynamicResource MenuFlyoutThemeMinHeight}" />
|
||||
<Setter Property="ui:ControlHelper.CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ContextMenu}">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Margin="5,4,5,12"
|
||||
Padding="0,4,0,4"
|
||||
Background="{DynamicResource CustomContextBackground}"
|
||||
BorderBrush="{DynamicResource CustomContextBorder}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8"
|
||||
UseLayoutRounding="True">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="12"
|
||||
Direction="-90"
|
||||
Opacity=".15"
|
||||
ShadowDepth="6"
|
||||
Color="Black" />
|
||||
</Border.Effect>
|
||||
<StackPanel
|
||||
x:Name="Panel"
|
||||
ClipToBounds="True"
|
||||
IsItemsHost="True"
|
||||
Orientation="Vertical" />
|
||||
</Border>
|
||||
<ui:ThemeShadowChrome
|
||||
x:Name="Shdw"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}"
|
||||
IsShadowEnabled="{TemplateBinding HasDropShadow}"
|
||||
SnapsToDevicePixels="True">
|
||||
<Border
|
||||
x:Name="Border"
|
||||
Padding="0,4,0,4"
|
||||
Background="{DynamicResource CustomContextBackground}"
|
||||
BorderBrush="{DynamicResource CustomContextBorder}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="8">
|
||||
<Grid>
|
||||
<ScrollViewer
|
||||
x:Name="ContextMenuScrollViewer"
|
||||
MinWidth="{DynamicResource FlyoutThemeMinWidth}"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer,
|
||||
TypeInTargetAssembly={x:Type FrameworkElement}}}">
|
||||
<ItemsPresenter
|
||||
KeyboardNavigation.DirectionalNavigation="Cycle"
|
||||
RenderOptions.ClearTypeHint="Enabled"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</ScrollViewer>
|
||||
<Border
|
||||
x:Name="ContextMenuBorder"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0"
|
||||
CornerRadius="{TemplateBinding ui:ControlHelper.CornerRadius}" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</ui:ThemeShadowChrome>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsVisible" Value="true">
|
||||
<Setter TargetName="Border" Property="Background" Value="{DynamicResource CustomContextBackground}" />
|
||||
|
|
@ -2808,4 +3227,7 @@
|
|||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<ui:TextContextMenu x:Key="TextControlContextMenu" x:Shared="False" />
|
||||
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -65,7 +65,8 @@
|
|||
|
||||
<SolidColorBrush x:Key="CustomContextBorder" Color="#1b1b1b" />
|
||||
<SolidColorBrush x:Key="CustomContextBackground" Color="#2b2b2b" />
|
||||
<SolidColorBrush x:Key="CustomContextHover" Color="#3c3c3c" />
|
||||
<SolidColorBrush x:Key="CustomContextHover" Color="#3a3a3a" />
|
||||
<SolidColorBrush x:Key="CustomContextClick" Color="#353535" />
|
||||
<SolidColorBrush x:Key="CustomContextDisabled" Color="#868686" />
|
||||
<SolidColorBrush x:Key="ContextSeparator" Color="#3c3c3c" />
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@
|
|||
|
||||
<SolidColorBrush x:Key="CustomContextBorder" Color="#dadada" />
|
||||
<SolidColorBrush x:Key="CustomContextBackground" Color="#f2f2f2" />
|
||||
<SolidColorBrush x:Key="CustomContextHover" Color="#DBDBDB" />
|
||||
<SolidColorBrush x:Key="CustomContextHover" Color="#e4e4e4" />
|
||||
<SolidColorBrush x:Key="CustomContextClick" Color="#ececec" />
|
||||
<SolidColorBrush x:Key="CustomContextDisabled" Color="#868686" />
|
||||
<SolidColorBrush x:Key="ContextSeparator" Color="#dadada" />
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@
|
|||
Visibility="{Binding Visbility}"
|
||||
mc:Ignorable="d"
|
||||
PreviewMouseMove="ResultList_MouseMove"
|
||||
PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown">
|
||||
PreviewMouseLeftButtonDown="ResultList_PreviewMouseLeftButtonDown"
|
||||
PreviewMouseLeftButtonUp="ResultListBox_OnPreviewMouseUp"
|
||||
PreviewMouseRightButtonDown="ResultListBox_OnPreviewMouseRightButtonDown">
|
||||
<!-- IsSynchronizedWithCurrentItem: http://stackoverflow.com/a/7833798/2833083 -->
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
|
|
@ -137,10 +139,11 @@
|
|||
x:Name="Title"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
IsHitTestVisible="False"
|
||||
Style="{DynamicResource ItemTitleStyle}"
|
||||
Text="{Binding Result.Title}"
|
||||
ToolTip="{Binding ShowTitleToolTip}">
|
||||
ToolTip="{Binding ShowTitleToolTip}"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
IsEnabled="False">
|
||||
<vm:ResultsViewModel.FormattedText>
|
||||
<MultiBinding Converter="{StaticResource HighlightTextConverter}">
|
||||
<Binding Path="Result.Title" />
|
||||
|
|
@ -151,11 +154,11 @@
|
|||
<TextBlock
|
||||
x:Name="SubTitle"
|
||||
Grid.Row="1"
|
||||
IsHitTestVisible="False"
|
||||
IsEnabled="False"
|
||||
ToolTipService.ShowOnDisabled="True"
|
||||
Style="{DynamicResource ItemSubTitleStyle}"
|
||||
Text="{Binding Result.SubTitle}"
|
||||
ToolTip="{Binding ShowSubTitleToolTip}" />
|
||||
|
||||
ToolTip="{Binding ShowSubTitleToolTip}"/>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,36 @@ namespace Flow.Launcher
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty RightClickResultCommandProperty =
|
||||
DependencyProperty.Register("RightClickResultCommand", typeof(ICommand), typeof(ResultListBox), new UIPropertyMetadata(null));
|
||||
|
||||
public ICommand RightClickResultCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ICommand)GetValue(RightClickResultCommandProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(RightClickResultCommandProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty LeftClickResultCommandProperty =
|
||||
DependencyProperty.Register("LeftClickResultCommand", typeof(ICommand), typeof(ResultListBox), new UIPropertyMetadata(null));
|
||||
|
||||
public ICommand LeftClickResultCommand
|
||||
{
|
||||
get
|
||||
{
|
||||
return (ICommand)GetValue(LeftClickResultCommandProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(LeftClickResultCommandProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (e.AddedItems.Count > 0 && e.AddedItems[0] != null)
|
||||
|
|
@ -98,10 +128,24 @@ namespace Flow.Launcher
|
|||
path
|
||||
});
|
||||
DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
|
||||
|
||||
|
||||
App.API.ChangeQuery(query, true);
|
||||
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
private void ResultListBox_OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (Mouse.DirectlyOver is not FrameworkElement { DataContext: ResultViewModel result })
|
||||
return;
|
||||
|
||||
RightClickResultCommand?.Execute(result.Result);
|
||||
}
|
||||
private void ResultListBox_OnPreviewMouseUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (Mouse.DirectlyOver is not FrameworkElement { DataContext: ResultViewModel result })
|
||||
return;
|
||||
|
||||
LeftClickResultCommand?.Execute(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
Title="{DynamicResource flowlauncher_settings}"
|
||||
Width="{Binding SettingWindowWidth, Mode=TwoWay}"
|
||||
Height="{Binding SettingWindowHeight, Mode=TwoWay}"
|
||||
MinWidth="900"
|
||||
MinWidth="940"
|
||||
MinHeight="600"
|
||||
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}"
|
||||
Closed="OnClosed"
|
||||
|
|
@ -39,6 +39,7 @@
|
|||
</Window.CommandBindings>
|
||||
|
||||
<Window.Resources>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<converters:BorderClipConverter x:Key="BorderClipConverter" />
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
|
||||
<converters:TextConverter x:Key="TextConverter" />
|
||||
|
|
@ -98,6 +99,7 @@
|
|||
<Style x:Key="SettingTitleLabel" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SettingSubTitleLabel" TargetType="{x:Type TextBlock}">
|
||||
|
|
@ -202,51 +204,45 @@
|
|||
<!--#endregion-->
|
||||
</Style>
|
||||
<Style x:Key="NavTabItem" TargetType="{x:Type TabItem}">
|
||||
<Setter Property="DockPanel.Dock" Value="Top" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabItem}">
|
||||
<Border>
|
||||
<Grid>
|
||||
<Grid>
|
||||
<Border
|
||||
x:Name="border"
|
||||
Height="40"
|
||||
Margin="14,4,8,4"
|
||||
Padding="0,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource Color01B}"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Border
|
||||
x:Name="Spacer"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Margin="14,4,8,4"
|
||||
Padding="0,0,0,0"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0">
|
||||
<Border
|
||||
x:Name="border"
|
||||
Height="40"
|
||||
Background="{DynamicResource Color01B}"
|
||||
CornerRadius="5">
|
||||
<Grid>
|
||||
<Canvas>
|
||||
<Rectangle
|
||||
x:Name="Bullet"
|
||||
Canvas.Left="0"
|
||||
Width="4"
|
||||
Height="18"
|
||||
Margin="0,11,0,11"
|
||||
Fill="{DynamicResource ToggleSwitchFillOn}"
|
||||
RadiusX="2"
|
||||
RadiusY="2"
|
||||
Visibility="Hidden" />
|
||||
<ContentPresenter
|
||||
x:Name="ContentSite"
|
||||
Margin="12,11,0,11"
|
||||
HorizontalAlignment="LEFT"
|
||||
VerticalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
TextBlock.Foreground="#000" />
|
||||
</Canvas>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Rectangle
|
||||
x:Name="Bullet"
|
||||
Grid.Column="0"
|
||||
Width="4"
|
||||
Height="18"
|
||||
Margin="0,11,0,11"
|
||||
Fill="{DynamicResource ToggleSwitchFillOn}"
|
||||
RadiusX="2"
|
||||
RadiusY="2"
|
||||
Visibility="Hidden" />
|
||||
<ContentPresenter
|
||||
x:Name="ContentSite"
|
||||
Grid.Column="1"
|
||||
Margin="12,11,18,11"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
ContentSource="Header"
|
||||
TextBlock.Foreground="#000" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="border" Property="Background" Value="{DynamicResource Color06B}" />
|
||||
|
|
@ -419,29 +415,61 @@
|
|||
</Style>
|
||||
<!-- For Tab Header responsive Width -->
|
||||
<Style x:Key="NavTabControl" TargetType="{x:Type TabControl}">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Top" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="Transparent" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TabControl}">
|
||||
<Grid>
|
||||
<Grid
|
||||
x:Name="templateRoot"
|
||||
ClipToBounds="true"
|
||||
KeyboardNavigation.TabNavigation="Local"
|
||||
SnapsToDevicePixels="true">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2.2*" />
|
||||
<ColumnDefinition Width="7.8*" />
|
||||
<ColumnDefinition
|
||||
x:Name="ColumnDefinition0"
|
||||
Width="Auto"
|
||||
MinWidth="230" />
|
||||
<ColumnDefinition x:Name="ColumnDefinition1" Width="7.5*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TabPanel
|
||||
<!-- here is the edit -->
|
||||
<DockPanel
|
||||
x:Name="headerPanel"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,0"
|
||||
Margin="2,2,2,0"
|
||||
Panel.ZIndex="1"
|
||||
Background="{DynamicResource Color01B}"
|
||||
IsItemsHost="True" />
|
||||
Background="Transparent"
|
||||
IsItemsHost="true"
|
||||
KeyboardNavigation.TabIndex="1"
|
||||
LastChildFill="False" />
|
||||
<Border
|
||||
x:Name="contentPanel"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="0"
|
||||
CornerRadius="0">
|
||||
<ContentPresenter Grid.Column="1" ContentSource="SelectedContent" />
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
KeyboardNavigation.DirectionalNavigation="Contained"
|
||||
KeyboardNavigation.TabIndex="2"
|
||||
KeyboardNavigation.TabNavigation="Local">
|
||||
<ContentPresenter
|
||||
x:Name="PART_SelectedContentHost"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
ContentSource="SelectedContent"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter TargetName="templateRoot" Property="TextElement.Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
|
@ -570,7 +598,7 @@
|
|||
SelectedIndex="1"
|
||||
Style="{DynamicResource NavTabControl}"
|
||||
TabStripPlacement="Left">
|
||||
<TabItem Style="{DynamicResource logo}">
|
||||
<TabItem DockPanel.Dock="Top" Style="{DynamicResource logo}">
|
||||
<TabItem.Header>
|
||||
<Grid Margin="0,18,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
|
|
@ -592,7 +620,7 @@
|
|||
</Grid>
|
||||
</TabItem.Header>
|
||||
</TabItem>
|
||||
<TabItem Style="{DynamicResource NavTabItem}">
|
||||
<TabItem DockPanel.Dock="Top" Style="{DynamicResource NavTabItem}">
|
||||
<!-- LEFT TAB WIDTH -->
|
||||
<TabItem.Header>
|
||||
<Grid>
|
||||
|
|
@ -1048,7 +1076,7 @@
|
|||
Background="{DynamicResource Color01B}"
|
||||
ItemContainerStyle="{StaticResource PluginList}"
|
||||
ItemsSource="{Binding PluginViewModels}"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
SelectedItem="{Binding SelectedPlugin}"
|
||||
SnapsToDevicePixels="True"
|
||||
|
|
@ -1058,7 +1086,7 @@
|
|||
VirtualizingStackPanel.VirtualizationMode="Recycling">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<VirtualizingStackPanel Margin="0,0,0,0" />
|
||||
<VirtualizingStackPanel Margin="0,0,0,10" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
|
|
@ -1788,13 +1816,25 @@
|
|||
</Grid.RowDefinitions>
|
||||
<Border Grid.Row="0">
|
||||
<TextBox
|
||||
x:Name="QueryTextBox"
|
||||
IsReadOnly="True"
|
||||
Style="{DynamicResource QueryBoxStyle}"
|
||||
Text="{DynamicResource hiThere}" />
|
||||
</Border>
|
||||
<StackPanel x:Name="ClockPanel" Style="{DynamicResource ClockPanel}">
|
||||
<TextBlock x:Name="DateBox" Style="{DynamicResource DateBox}" />
|
||||
<TextBlock x:Name="ClockBox" Style="{DynamicResource ClockBox}" />
|
||||
<StackPanel
|
||||
x:Name="ClockPanel"
|
||||
IsHitTestVisible="False"
|
||||
Style="{DynamicResource ClockPanel}">
|
||||
<TextBlock
|
||||
x:Name="ClockBox"
|
||||
Style="{DynamicResource ClockBox}"
|
||||
Text="{Binding ClockText}"
|
||||
Visibility="{Binding Settings.UseClock, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<TextBlock
|
||||
x:Name="DateBox"
|
||||
Style="{DynamicResource DateBox}"
|
||||
Text="{Binding DateText}"
|
||||
Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
</StackPanel>
|
||||
<Canvas Style="{DynamicResource SearchIconPosition}">
|
||||
<Path
|
||||
|
|
@ -1849,7 +1889,7 @@
|
|||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="100"
|
||||
Width="Auto"
|
||||
Margin="0,0,8,2"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
|
|
@ -1857,7 +1897,7 @@
|
|||
TextAlignment="Right" />
|
||||
<Slider
|
||||
Name="WindowWidthValue"
|
||||
Width="300"
|
||||
Width="250"
|
||||
Margin="0,0,18,0"
|
||||
VerticalAlignment="Center"
|
||||
IsMoveToPointEnabled="True"
|
||||
|
|
@ -2135,6 +2175,12 @@
|
|||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="0,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color04B}"
|
||||
Text="{Binding ClockText}" />
|
||||
<ComboBox
|
||||
x:Name="TimeFormat"
|
||||
Grid.Column="2"
|
||||
|
|
@ -2143,14 +2189,12 @@
|
|||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding TimeFormatList}"
|
||||
SelectedValue="{Binding Settings.TimeFormat}"
|
||||
SelectionChanged="PreviewClockAndDate" />
|
||||
SelectedItem="{Binding TimeFormat}" />
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding UseClock, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}"
|
||||
Toggled="PreviewClockAndDate" />
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
|
|
@ -2173,6 +2217,12 @@
|
|||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="0,0,10,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color04B}"
|
||||
Text="{Binding DateText}" />
|
||||
<ComboBox
|
||||
x:Name="DateFormat"
|
||||
Grid.Column="2"
|
||||
|
|
@ -2181,14 +2231,12 @@
|
|||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
ItemsSource="{Binding DateFormatList}"
|
||||
SelectedValue="{Binding Settings.DateFormat}"
|
||||
SelectionChanged="PreviewClockAndDate" />
|
||||
SelectedItem="{Binding DateFormat}" />
|
||||
<ui:ToggleSwitch
|
||||
IsOn="{Binding UseDate, Mode=TwoWay}"
|
||||
OffContent="{DynamicResource disable}"
|
||||
OnContent="{DynamicResource enable}"
|
||||
Style="{DynamicResource SideToggleSwitch}"
|
||||
Toggled="PreviewClockAndDate" />
|
||||
Style="{DynamicResource SideToggleSwitch}" />
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
|
|
@ -2324,23 +2372,7 @@
|
|||
VirtualizingStackPanel.IsVirtualizing="True"
|
||||
VirtualizingStackPanel.ScrollUnit="Pixel">
|
||||
<Border>
|
||||
<Grid Margin="5,18,18,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="43" />
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition Height="146" />
|
||||
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Margin="5,18,18,10">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,5,0,2"
|
||||
|
|
@ -2350,7 +2382,7 @@
|
|||
TextAlignment="left" />
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<Border Margin="0,12,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource flowlauncherHotkey}" />
|
||||
|
|
@ -2412,7 +2444,7 @@
|
|||
Style="{StaticResource SettingSeparatorStyle}" />
|
||||
<Border
|
||||
Margin="0"
|
||||
Padding="0,10,0,0"
|
||||
Padding="0,10,0,10"
|
||||
BorderThickness="0"
|
||||
Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
|
|
@ -2435,7 +2467,7 @@
|
|||
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Margin="0,0,12,2"
|
||||
Margin="0,10,12,10"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
|
|
@ -2460,7 +2492,7 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="540" Header="{DynamicResource customQuery}">
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customQuery}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||
<TextBlock Text="{Binding ActionKeyword}" />
|
||||
|
|
@ -2521,7 +2553,7 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="540" Header="{DynamicResource customShortcutExpansion}">
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customShortcutExpansion}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Value}" />
|
||||
|
|
@ -2561,11 +2593,11 @@
|
|||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="Built-in Shortcuts" />
|
||||
Text="{DynamicResource builtinShortcuts}" />
|
||||
<ListView
|
||||
Grid.Row="10"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,0"
|
||||
Margin="0,6,0,20"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
|
|
@ -2580,7 +2612,7 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="540" Header="{DynamicResource builtinShortcutDescription}">
|
||||
<GridViewColumn Width="430" Header="{DynamicResource builtinShortcutDescription}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Description, Converter={StaticResource TranlationConverter}}" />
|
||||
|
|
@ -2590,7 +2622,7 @@
|
|||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
|
@ -2803,54 +2835,54 @@
|
|||
Style="{DynamicResource PageTitle}"
|
||||
Text="{DynamicResource about}"
|
||||
TextAlignment="left" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border
|
||||
Width="200"
|
||||
Height="120"
|
||||
Margin="0,8,0,0"
|
||||
Padding="24,24,24,24"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{DynamicResource SettingGroupBox}">
|
||||
<Grid>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource version}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<TextBlock
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
DockPanel.Dock="Bottom"
|
||||
FontSize="22"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{Binding Version}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<Border Margin="0,4,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
|
||||
<Border Margin="0,9,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource update}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
FontWeight="Bold"
|
||||
Style="{DynamicResource SettingTitleLabel}"
|
||||
Text="{Binding Version}" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource version}" />
|
||||
</StackPanel>
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Margin="0,0,-20,0"
|
||||
Margin="0,0,-14,0"
|
||||
HorizontalAlignment="Right"
|
||||
Click="OnCheckUpdates"
|
||||
Content="{DynamicResource checkUpdates}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<Border Height="62" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource releaseNotes}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,0,-12,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SideTextAbout}">
|
||||
<Hyperlink NavigateUri="{Binding ReleaseNotes, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
|
||||
<Run Text="{DynamicResource releaseNotes}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
Height="62"
|
||||
Margin="0,4,0,0"
|
||||
Margin="0,14,0,0"
|
||||
Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
|
|
@ -2878,25 +2910,6 @@
|
|||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<Border Height="62" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource releaseNotes}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,0,-12,0"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource SideTextAbout}">
|
||||
<Hyperlink NavigateUri="{Binding ReleaseNotes, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
|
||||
<Run Text="{DynamicResource releaseNotes}" />
|
||||
</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<Border Height="62" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
|
|
@ -2924,10 +2937,13 @@
|
|||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<Border Height="62" Style="{DynamicResource SettingGroupBox}">
|
||||
<Border
|
||||
Height="62"
|
||||
Margin="0,14,0,0"
|
||||
Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="Icons" />
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource icons}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,0,-12,0"
|
||||
|
|
@ -2954,26 +2970,43 @@
|
|||
Margin="0,0,-20,0"
|
||||
HorizontalAlignment="Right"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Margin="0,0,12,0"
|
||||
Click="OpenWelcomeWindow"
|
||||
Content="{DynamicResource welcomewindow}" />
|
||||
<Button
|
||||
Margin="0,0,12,0"
|
||||
Click="OpenSettingFolder"
|
||||
Content="{DynamicResource settingfolder}" />
|
||||
<Button
|
||||
Name="ClearLogFolderBtn"
|
||||
Margin="0,0,12,0"
|
||||
Click="ClearLogFolder"
|
||||
Content="{Binding CheckLogFolder, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Click="OpenLogFolder" Content="{DynamicResource logfolder}" />
|
||||
<Button
|
||||
Margin="0,0,8,0"
|
||||
Content=""
|
||||
FontFamily="/Resources/#Segoe Fluent Icons"
|
||||
FontSize="20">
|
||||
<ui:FlyoutService.Flyout>
|
||||
<ui:MenuFlyout>
|
||||
<MenuItem Click="OpenWelcomeWindow" Header="{DynamicResource welcomewindow}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Click="OpenSettingFolder" Header="{DynamicResource settingfolder}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Click="OpenLogFolder" Header="{DynamicResource logfolder}">
|
||||
<MenuItem.Icon>
|
||||
<ui:FontIcon Glyph="" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ui:MenuFlyout>
|
||||
</ui:FlyoutService.Flyout>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Margin="14,20,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -2983,7 +3016,6 @@
|
|||
Foreground="{DynamicResource Color15B}"
|
||||
Text="{Binding ActivatedTimes, Mode=OneWay}"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -10,17 +10,14 @@ using Flow.Launcher.ViewModel;
|
|||
using ModernWpf;
|
||||
using ModernWpf.Controls;
|
||||
using System;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Navigation;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
|
|
@ -44,6 +41,7 @@ namespace Flow.Launcher
|
|||
API = api;
|
||||
InitializePosition();
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
#region General
|
||||
|
|
@ -64,7 +62,6 @@ namespace Flow.Launcher
|
|||
pluginStoreView.Filter = PluginStoreFilter;
|
||||
|
||||
InitializePosition();
|
||||
ClockDisplay();
|
||||
}
|
||||
|
||||
private void OnSelectPythonDirectoryClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -514,34 +511,6 @@ namespace Flow.Launcher
|
|||
}
|
||||
}
|
||||
|
||||
private void PreviewClockAndDate(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ClockDisplay();
|
||||
}
|
||||
|
||||
public void ClockDisplay()
|
||||
{
|
||||
if (settings.UseClock)
|
||||
{
|
||||
ClockBox.Visibility = Visibility.Visible;
|
||||
ClockBox.Text = DateTime.Now.ToString(settings.TimeFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
ClockBox.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
if (settings.UseDate)
|
||||
{
|
||||
DateBox.Visibility = Visibility.Visible;
|
||||
DateBox.Text = DateTime.Now.ToString(settings.DateFormat);
|
||||
}
|
||||
else
|
||||
{
|
||||
DateBox.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializePosition()
|
||||
{
|
||||
if (settings.SettingWindowTop >= 0 && settings.SettingWindowLeft >= 0)
|
||||
|
|
@ -556,6 +525,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
WindowState = settings.SettingWindowState;
|
||||
}
|
||||
|
||||
public double WindowLeft()
|
||||
{
|
||||
var screen = Screen.FromPoint(System.Windows.Forms.Cursor.Position);
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:system="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:userSettings="clr-namespace:Flow.Launcher.Infrastructure.UserSettings;assembly=Flow.Launcher.Infrastructure">
|
||||
|
||||
|
||||
<!-- Further font customisations are dynamically loaded in Theme.cs -->
|
||||
<Style x:Key="BaseQueryBoxStyle" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
|
|
@ -79,29 +79,39 @@
|
|||
<Setter Property="Stroke" Value="Blue" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="BaseClockPosition" TargetType="{x:Type Canvas}" />
|
||||
<Style x:Key="BaseClockPanelPosition" TargetType="{x:Type Canvas}" />
|
||||
|
||||
<Style x:Key="BaseClockPanel" TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Orientation" Value="Horizontal" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Height" Value="Auto" />
|
||||
<Setter Property="Margin" Value="0,0,14,0" />
|
||||
<Setter Property="Margin" Value="0,0,66,0" />
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Style>
|
||||
<Style x:Key="BaseClockBox" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="22" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,0,2,0" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=DateBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style x:Key="BaseDateBox" TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Foreground" Value="#8f8f8f" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ClockBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
|
|
@ -120,8 +130,8 @@
|
|||
x:Key="ClockPanel"
|
||||
BasedOn="{StaticResource BaseClockPanel}"
|
||||
TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Margin" Value="0,0,66,0" />
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Setter Property="Orientation" Value="Vertical" />
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
|
|
@ -129,30 +139,19 @@
|
|||
<Condition Binding="{Binding ElementName=ContextMenu, Path=Visibility}" Value="Collapsed" />
|
||||
<Condition Binding="{Binding ElementName=History, Path=Visibility}" Value="Collapsed" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.0"
|
||||
To="1.0"
|
||||
Duration="0:0:0.2" />
|
||||
To="1"
|
||||
Duration="0:0:0.25" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.0"
|
||||
Duration="0:0:0.2" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
|
||||
</MultiDataTrigger>
|
||||
|
||||
</Style.Triggers>
|
||||
|
||||
</Style>
|
||||
|
|
@ -368,6 +367,12 @@
|
|||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="ClockPanelPosition"
|
||||
BasedOn="{StaticResource BaseClockPanelPosition}"
|
||||
TargetType="{x:Type Canvas}">
|
||||
<Setter Property="Margin" Value="0,2,66,0" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="ItemHotkeyStyle"
|
||||
BasedOn="{StaticResource BaseItemHotkeyStyle}"
|
||||
|
|
|
|||
|
|
@ -96,18 +96,31 @@
|
|||
BasedOn="{StaticResource BaseClockBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#2C5595" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=DateBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="DateBox"
|
||||
BasedOn="{StaticResource BaseDateBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
<Setter Property="Foreground" Value="#2C5595" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ClockBox, Path=Visibility}" Value="Visible">
|
||||
<Setter Property="FontSize" Value="18" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="ClockPanel"
|
||||
BasedOn="{StaticResource BaseClockPanel}"
|
||||
BasedOn="{StaticResource ClockPanel}"
|
||||
TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Margin" Value="0,0,22,0" />
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Setter Property="Orientation" Value="Horizontal" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
|
@ -123,6 +123,7 @@
|
|||
x:Key="DateBox"
|
||||
BasedOn="{StaticResource BaseDateBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="FontWeight" Value="Bold" />
|
||||
<Setter Property="Foreground" Value="#71114b" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
|
@ -159,12 +159,12 @@
|
|||
x:Key="ClockBox"
|
||||
BasedOn="{StaticResource BaseClockBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#b2b2b2" />
|
||||
<Setter Property="Foreground" Value="#818181" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="DateBox"
|
||||
BasedOn="{StaticResource BaseDateBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#b2b2b2" />
|
||||
<Setter Property="Foreground" Value="#818181" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@
|
|||
BasedOn="{StaticResource BaseClockBox}"
|
||||
TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="#acacac" />
|
||||
<Setter Property="FontSize" Value="22" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="DateBox"
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ using ISavable = Flow.Launcher.Plugin.ISavable;
|
|||
using System.IO;
|
||||
using System.Collections.Specialized;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -77,12 +78,21 @@ namespace Flow.Launcher.ViewModel
|
|||
_userSelectedRecord = _userSelectedRecordStorage.Load();
|
||||
_topMostRecord = _topMostRecordStorage.Load();
|
||||
|
||||
ContextMenu = new ResultsViewModel(Settings);
|
||||
Results = new ResultsViewModel(Settings);
|
||||
History = new ResultsViewModel(Settings);
|
||||
|
||||
ContextMenu = new ResultsViewModel(Settings)
|
||||
{
|
||||
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
|
||||
};
|
||||
Results = new ResultsViewModel(Settings)
|
||||
{
|
||||
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
|
||||
};
|
||||
History = new ResultsViewModel(Settings)
|
||||
{
|
||||
LeftClickResultCommand = OpenResultCommand, RightClickResultCommand = LoadContextMenuCommand
|
||||
};
|
||||
_selectedResults = Results;
|
||||
|
||||
InitializeKeyCommands();
|
||||
|
||||
RegisterViewUpdate();
|
||||
RegisterResultsUpdatedEvent();
|
||||
|
|
@ -157,165 +167,164 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void InitializeKeyCommands()
|
||||
[RelayCommand]
|
||||
private async Task ReloadPluginDataAsync()
|
||||
{
|
||||
EscCommand = new RelayCommand(_ =>
|
||||
Hide();
|
||||
|
||||
await PluginManager.ReloadDataAsync().ConfigureAwait(false);
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("success"), InternationalizationManager.Instance.GetTranslation("completedSuccessfully"));
|
||||
}
|
||||
[RelayCommand]
|
||||
private void LoadHistory()
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
if (!SelectedIsFromQueryResults())
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
});
|
||||
|
||||
ClearQueryCommand = new RelayCommand(_ =>
|
||||
SelectedResults = History;
|
||||
History.SelectedIndex = _history.Items.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(QueryText))
|
||||
{
|
||||
ChangeQueryText(string.Empty);
|
||||
|
||||
// Push Event to UI SystemQuery has changed
|
||||
//OnPropertyChanged(nameof(SystemQueryText));
|
||||
}
|
||||
});
|
||||
|
||||
SelectNextItemCommand = new RelayCommand(_ => { SelectedResults.SelectNextResult(); });
|
||||
|
||||
SelectPrevItemCommand = new RelayCommand(_ => { SelectedResults.SelectPrevResult(); });
|
||||
|
||||
SelectNextPageCommand = new RelayCommand(_ => { SelectedResults.SelectNextPage(); });
|
||||
|
||||
SelectPrevPageCommand = new RelayCommand(_ => { SelectedResults.SelectPrevPage(); });
|
||||
|
||||
SelectFirstResultCommand = new RelayCommand(_ => SelectedResults.SelectFirstResult());
|
||||
|
||||
StartHelpCommand = new RelayCommand(_ =>
|
||||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void LoadContextMenu()
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
PluginManager.API.OpenUrl("https://github.com/Flow-Launcher/Flow.Launcher/wiki/Flow-Launcher/");
|
||||
});
|
||||
OpenSettingCommand = new RelayCommand(_ => { App.API.OpenSettingDialog(); });
|
||||
OpenResultCommand = new RelayCommand(async index =>
|
||||
// When switch to ContextMenu from QueryResults, but no item being chosen, should do nothing
|
||||
// i.e. Shift+Enter/Ctrl+O right after Alt + Space should do nothing
|
||||
if (SelectedResults.SelectedItem != null)
|
||||
SelectedResults = ContextMenu;
|
||||
}
|
||||
else
|
||||
{
|
||||
var results = SelectedResults;
|
||||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void Backspace(object index)
|
||||
{
|
||||
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
|
||||
|
||||
if (index != null)
|
||||
// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
|
||||
var path = FilesFolders.GetPreviousExistingDirectory((_) => true, query.Search.TrimEnd('\\'));
|
||||
|
||||
var actionKeyword = string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : $"{query.ActionKeyword} ";
|
||||
|
||||
ChangeQueryText($"{actionKeyword}{path}");
|
||||
}
|
||||
[RelayCommand]
|
||||
private void AutocompleteQuery()
|
||||
{
|
||||
var result = SelectedResults.SelectedItem?.Result;
|
||||
if (result != null && SelectedIsFromQueryResults()) // SelectedItem returns null if selection is empty.
|
||||
{
|
||||
var autoCompleteText = result.Title;
|
||||
|
||||
if (!string.IsNullOrEmpty(result.AutoCompleteText))
|
||||
{
|
||||
results.SelectedIndex = int.Parse(index.ToString()!);
|
||||
autoCompleteText = result.AutoCompleteText;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
|
||||
{
|
||||
autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText;
|
||||
}
|
||||
|
||||
var result = results.SelectedItem?.Result;
|
||||
if (result == null)
|
||||
var specialKeyState = GlobalHotkey.CheckModifiers();
|
||||
if (specialKeyState.ShiftPressed)
|
||||
{
|
||||
return;
|
||||
autoCompleteText = result.SubTitle;
|
||||
}
|
||||
var hideWindow = await result.ExecuteAsync(new ActionContext
|
||||
|
||||
ChangeQueryText(autoCompleteText);
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private async Task OpenResultAsync(string index)
|
||||
{
|
||||
var results = SelectedResults;
|
||||
if (index is not null)
|
||||
{
|
||||
results.SelectedIndex = int.Parse(index);
|
||||
}
|
||||
var result = results.SelectedItem?.Result;
|
||||
if (result == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var hideWindow = await result.ExecuteAsync(new ActionContext
|
||||
{
|
||||
SpecialKeyState = GlobalHotkey.CheckModifiers()
|
||||
}).ConfigureAwait(false);
|
||||
})
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (hideWindow)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
_userSelectedRecord.Add(result);
|
||||
_history.Add(result.OriginQuery.RawQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
});
|
||||
|
||||
AutocompleteQueryCommand = new RelayCommand(_ =>
|
||||
{
|
||||
var result = SelectedResults.SelectedItem?.Result;
|
||||
if (result != null && SelectedIsFromQueryResults()) // SelectedItem returns null if selection is empty.
|
||||
{
|
||||
var autoCompleteText = result.Title;
|
||||
|
||||
if (!string.IsNullOrEmpty(result.AutoCompleteText))
|
||||
{
|
||||
autoCompleteText = result.AutoCompleteText;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(SelectedResults.SelectedItem?.QuerySuggestionText))
|
||||
{
|
||||
autoCompleteText = SelectedResults.SelectedItem.QuerySuggestionText;
|
||||
}
|
||||
|
||||
var specialKeyState = GlobalHotkey.CheckModifiers();
|
||||
if (specialKeyState.ShiftPressed)
|
||||
{
|
||||
autoCompleteText = result.SubTitle;
|
||||
}
|
||||
|
||||
ChangeQueryText(autoCompleteText);
|
||||
}
|
||||
});
|
||||
|
||||
BackspaceCommand = new RelayCommand(index =>
|
||||
{
|
||||
var query = QueryBuilder.Build(QueryText.Trim(), PluginManager.NonGlobalPlugins);
|
||||
|
||||
// GetPreviousExistingDirectory does not require trailing '\', otherwise will return empty string
|
||||
var path = FilesFolders.GetPreviousExistingDirectory((_) => true, query.Search.TrimEnd('\\'));
|
||||
|
||||
var actionKeyword = string.IsNullOrEmpty(query.ActionKeyword) ? string.Empty : $"{query.ActionKeyword} ";
|
||||
|
||||
ChangeQueryText($"{actionKeyword}{path}");
|
||||
});
|
||||
|
||||
LoadContextMenuCommand = new RelayCommand(_ =>
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
// When switch to ContextMenu from QueryResults, but no item being chosen, should do nothing
|
||||
// i.e. Shift+Enter/Ctrl+O right after Alt + Space should do nothing
|
||||
if (SelectedResults.SelectedItem != null)
|
||||
SelectedResults = ContextMenu;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
});
|
||||
|
||||
LoadHistoryCommand = new RelayCommand(_ =>
|
||||
{
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
SelectedResults = History;
|
||||
History.SelectedIndex = _history.Items.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
});
|
||||
|
||||
ReloadPluginDataCommand = new RelayCommand(_ =>
|
||||
if (hideWindow)
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
|
||||
_ = PluginManager
|
||||
.ReloadDataAsync()
|
||||
.ContinueWith(_ =>
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
Notification.Show(
|
||||
InternationalizationManager.Instance.GetTranslation("success"),
|
||||
InternationalizationManager.Instance.GetTranslation("completedSuccessfully")
|
||||
);
|
||||
}), TaskScheduler.Default)
|
||||
.ConfigureAwait(false);
|
||||
});
|
||||
if (SelectedIsFromQueryResults())
|
||||
{
|
||||
_userSelectedRecord.Add(result);
|
||||
_history.Add(result.OriginQuery.RawQuery);
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
}
|
||||
[RelayCommand]
|
||||
private void OpenSetting()
|
||||
{
|
||||
App.API.OpenSettingDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectHelp()
|
||||
{
|
||||
PluginManager.API.OpenUrl("https://www.flowlauncher.com/docs/#/usage-tips");
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectFirstResult()
|
||||
{
|
||||
SelectedResults.SelectFirstResult();
|
||||
}
|
||||
[RelayCommand]
|
||||
private void SelectPrevPage()
|
||||
{
|
||||
SelectedResults.SelectPrevPage();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectNextPage()
|
||||
{
|
||||
SelectedResults.SelectNextPage();
|
||||
}
|
||||
[RelayCommand]
|
||||
private void SelectPrevItem()
|
||||
{
|
||||
SelectedResults.SelectPrevResult();
|
||||
}
|
||||
[RelayCommand]
|
||||
private void SelectNextItem()
|
||||
{
|
||||
SelectedResults.SelectNextResult();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void Esc()
|
||||
{
|
||||
if (!SelectedIsFromQueryResults())
|
||||
{
|
||||
SelectedResults = Results;
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -323,9 +332,10 @@ namespace Flow.Launcher.ViewModel
|
|||
#region ViewModel Properties
|
||||
|
||||
public Settings Settings { get; }
|
||||
public object ClockText { get; private set; }
|
||||
public string ClockText { get; private set; }
|
||||
public string DateText { get; private set; }
|
||||
|
||||
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
|
||||
private async Task RegisterClockAndDateUpdateAsync()
|
||||
{
|
||||
var timer = new PeriodicTimer(TimeSpan.FromSeconds(1));
|
||||
|
|
@ -333,9 +343,9 @@ namespace Flow.Launcher.ViewModel
|
|||
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
|
||||
{
|
||||
if (Settings.UseClock)
|
||||
ClockText = DateTime.Now.ToString(Settings.TimeFormat);
|
||||
ClockText = DateTime.Now.ToString(Settings.TimeFormat, cultureInfo);
|
||||
if (Settings.UseDate)
|
||||
DateText = DateTime.Now.ToString(Settings.DateFormat);
|
||||
DateText = DateTime.Now.ToString(Settings.DateFormat, cultureInfo);
|
||||
}
|
||||
}
|
||||
public ResultsViewModel Results { get; private set; }
|
||||
|
|
@ -363,9 +373,9 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
if (MainWindowWidth + 100 > 1920 || Settings.WindowSize == 1920)
|
||||
{
|
||||
Settings.WindowSize = 1920;
|
||||
Settings.WindowSize = 1920;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Settings.WindowSize += 100;
|
||||
Settings.WindowLeft -= 50;
|
||||
|
|
@ -411,6 +421,7 @@ namespace Flow.Launcher.ViewModel
|
|||
/// but we don't want to move cursor to end when query is updated from TextBox
|
||||
/// </summary>
|
||||
/// <param name="queryText"></param>
|
||||
/// <param name="reQuery">Force query even when Query Text doesn't change</param>
|
||||
public void ChangeQueryText(string queryText, bool reQuery = false)
|
||||
{
|
||||
if (QueryText != queryText)
|
||||
|
|
@ -489,25 +500,6 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string PluginIconPath { get; set; } = null;
|
||||
|
||||
public ICommand EscCommand { get; set; }
|
||||
public ICommand BackspaceCommand { get; set; }
|
||||
public ICommand SelectNextItemCommand { get; set; }
|
||||
public ICommand SelectPrevItemCommand { get; set; }
|
||||
public ICommand SelectNextPageCommand { get; set; }
|
||||
public ICommand SelectPrevPageCommand { get; set; }
|
||||
public ICommand SelectFirstResultCommand { get; set; }
|
||||
public ICommand StartHelpCommand { get; set; }
|
||||
public ICommand LoadContextMenuCommand { get; set; }
|
||||
public ICommand LoadHistoryCommand { get; set; }
|
||||
public ICommand OpenResultCommand { get; set; }
|
||||
public ICommand OpenSettingCommand { get; set; }
|
||||
public ICommand ReloadPluginDataCommand { get; set; }
|
||||
public ICommand ClearQueryCommand { get; private set; }
|
||||
|
||||
public ICommand CopyToClipboard { get; set; }
|
||||
|
||||
public ICommand AutocompleteQueryCommand { get; set; }
|
||||
|
||||
public string OpenResultCommandModifiers { get; private set; }
|
||||
|
||||
public string Image => Constant.QueryTextBoxIconImagePath;
|
||||
|
|
@ -648,7 +640,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
if (currentCancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
|
||||
|
||||
// handle the exclusiveness of plugin using action keyword
|
||||
RemoveOldQueryResults(query);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ using System.Windows;
|
|||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -49,6 +51,9 @@ namespace Flow.Launcher.ViewModel
|
|||
public ResultViewModel SelectedItem { get; set; }
|
||||
public Thickness Margin { get; set; }
|
||||
public Visibility Visbility { get; set; } = Visibility.Collapsed;
|
||||
|
||||
public ICommand RightClickResultCommand { get; init; }
|
||||
public ICommand LeftClickResultCommand { get; init; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ using Flow.Launcher.Plugin;
|
|||
using Flow.Launcher.Plugin.SharedModels;
|
||||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -46,6 +47,18 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.WindowSize):
|
||||
OnPropertyChanged(nameof(WindowWidthSize));
|
||||
break;
|
||||
case nameof(Settings.UseDate):
|
||||
case nameof(Settings.DateFormat):
|
||||
OnPropertyChanged(nameof(DateText));
|
||||
break;
|
||||
case nameof(Settings.UseClock):
|
||||
case nameof(Settings.TimeFormat):
|
||||
OnPropertyChanged(nameof(ClockText));
|
||||
break;
|
||||
case nameof(Settings.Language):
|
||||
OnPropertyChanged(nameof(ClockText));
|
||||
OnPropertyChanged(nameof(DateText));
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -56,7 +69,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
await _updater.UpdateAppAsync(App.API, false);
|
||||
}
|
||||
|
||||
|
||||
public bool AutoUpdates
|
||||
{
|
||||
get => Settings.AutoUpdates;
|
||||
|
|
@ -71,6 +84,8 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
public CultureInfo cultureInfo => new CultureInfo(Settings.Language);
|
||||
|
||||
public bool StartFlowLauncherOnSystemStartup
|
||||
{
|
||||
get => Settings.StartFlowLauncherOnSystemStartup;
|
||||
|
|
@ -157,7 +172,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"LastQuery{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new LastQueryMode { Display = display, Value = e, };
|
||||
var m = new LastQueryMode
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
|
|
@ -302,11 +320,11 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
|
||||
private IList<PluginStoreItemViewModel> LabelMaker(IList<UserPlugin> list)
|
||||
{
|
||||
return list.Select(p=>new PluginStoreItemViewModel(p))
|
||||
return list.Select(p => new PluginStoreItemViewModel(p))
|
||||
.OrderByDescending(p => p.Category == PluginStoreItemViewModel.NewRelease)
|
||||
.ThenByDescending(p=>p.Category == PluginStoreItemViewModel.RecentlyUpdated)
|
||||
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.RecentlyUpdated)
|
||||
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.None)
|
||||
.ThenByDescending(p => p.Category == PluginStoreItemViewModel.Installed)
|
||||
.ToList();
|
||||
|
|
@ -340,15 +358,14 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
|
||||
{
|
||||
var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0
|
||||
? string.Empty
|
||||
var actionKeyword = plugin.Metadata.ActionKeywords.Count == 0
|
||||
? string.Empty
|
||||
: plugin.Metadata.ActionKeywords[actionKeywordPosition];
|
||||
|
||||
|
||||
App.API.ChangeQuery($"{actionKeyword} {queryToDisplay}");
|
||||
App.API.ShowMainWindow();
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region theme
|
||||
|
|
@ -413,8 +430,7 @@ namespace Flow.Launcher.ViewModel
|
|||
var display = _translater.GetTranslation(key);
|
||||
var m = new ColorScheme
|
||||
{
|
||||
Display = display,
|
||||
Value = e,
|
||||
Display = display, Value = e,
|
||||
};
|
||||
modes.Add(m);
|
||||
}
|
||||
|
|
@ -422,8 +438,6 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class SearchWindowPosition
|
||||
{
|
||||
public string Display { get; set; }
|
||||
|
|
@ -440,32 +454,63 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"SearchWindowPosition{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new SearchWindowPosition { Display = display, Value = e, };
|
||||
var m = new SearchWindowPosition
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
modes.Add(m);
|
||||
}
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
||||
public List<string> TimeFormatList { get; set; } = new List<string>()
|
||||
public List<string> TimeFormatList { get; } = new()
|
||||
{
|
||||
"h:mm",
|
||||
"hh:mm",
|
||||
"H:mm",
|
||||
"HH:mm",
|
||||
"tt h:mm",
|
||||
"tt hh:mm",
|
||||
"h:mm tt",
|
||||
"hh:mm tt"
|
||||
};
|
||||
|
||||
public List<string> DateFormatList { get; set; } = new List<string>()
|
||||
public List<string> DateFormatList { get; } = new()
|
||||
{
|
||||
"MM'/'dd dddd",
|
||||
"MM'/'dd ddd",
|
||||
"MM'/'dd",
|
||||
"MM'-'dd",
|
||||
"MMMM', 'dd",
|
||||
"dd'/'MM",
|
||||
"dd'-'MM",
|
||||
"ddd MM'/'dd",
|
||||
"dddd MM'/'dd",
|
||||
"dddd"
|
||||
"dddd",
|
||||
"ddd dd'/'MM",
|
||||
"dddd dd'/'MM",
|
||||
"dddd dd', 'MMMM",
|
||||
"dd', 'MMMM"
|
||||
};
|
||||
|
||||
public string TimeFormat
|
||||
{
|
||||
get { return Settings.TimeFormat; }
|
||||
set { Settings.TimeFormat = value; }
|
||||
}
|
||||
|
||||
public string DateFormat
|
||||
{
|
||||
get { return Settings.DateFormat; }
|
||||
set { Settings.DateFormat = value; }
|
||||
}
|
||||
|
||||
public string ClockText => DateTime.Now.ToString(TimeFormat, cultureInfo);
|
||||
|
||||
public string DateText => DateTime.Now.ToString(DateFormat, cultureInfo);
|
||||
|
||||
|
||||
public double WindowWidthSize
|
||||
{
|
||||
get => Settings.WindowSize;
|
||||
|
|
@ -707,7 +752,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
string deleteWarning = string.Format(
|
||||
InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"),
|
||||
item?.Key, item?.Value);
|
||||
item.Key, item.Value);
|
||||
if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"),
|
||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||
{
|
||||
|
|
@ -758,36 +803,52 @@ namespace Flow.Launcher.ViewModel
|
|||
public string Documentation => Constant.Documentation;
|
||||
public string Docs => Constant.Docs;
|
||||
public string Github => Constant.GitHub;
|
||||
public static string Version => Constant.Version;
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Constant.Version == "1.0.0")
|
||||
{
|
||||
return Constant.Dev;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Constant.Version;
|
||||
}
|
||||
}
|
||||
}
|
||||
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||
|
||||
|
||||
public string CheckLogFolder
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
var dirInfo = new DirectoryInfo(Path.Combine(DataLocation.DataDirectory(), Constant.Logs, Constant.Version));
|
||||
long size = dirInfo.EnumerateFiles("*", SearchOption.AllDirectories).Sum(file => file.Length);
|
||||
|
||||
return _translater.GetTranslation("clearlogfolder") + " (" + FormatBytes(size) + ")" ;
|
||||
|
||||
return _translater.GetTranslation("clearlogfolder") + " (" + FormatBytes(size) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
internal void ClearLogFolder()
|
||||
{
|
||||
var directory = new DirectoryInfo(
|
||||
Path.Combine(
|
||||
DataLocation.DataDirectory(),
|
||||
Constant.Logs,
|
||||
Constant.Version));
|
||||
Path.Combine(
|
||||
DataLocation.DataDirectory(),
|
||||
Constant.Logs,
|
||||
Constant.Version));
|
||||
|
||||
directory.EnumerateFiles()
|
||||
.ToList()
|
||||
.ForEach(x => x.Delete());
|
||||
.ToList()
|
||||
.ForEach(x => x.Delete());
|
||||
}
|
||||
internal string FormatBytes(long bytes)
|
||||
{
|
||||
const int scale = 1024;
|
||||
string[] orders = new string[] { "GB", "MB", "KB", "Bytes" };
|
||||
string[] orders = new string[]
|
||||
{
|
||||
"GB", "MB", "KB", "Bytes"
|
||||
};
|
||||
long max = (long)Math.Pow(scale, orders.Length - 1);
|
||||
|
||||
foreach (string order in orders)
|
||||
|
|
@ -799,6 +860,7 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
return "0 Bytes";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@
|
|||
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource plugin_explorer_manageactionkeywords_header}"
|
||||
Width="400"
|
||||
SizeToContent="Height"
|
||||
Width="Auto"
|
||||
Height="255"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Width"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
|
|
@ -68,7 +69,7 @@
|
|||
|
||||
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Width="150"
|
||||
MinWidth="150"
|
||||
Margin="0,10,15,10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
|
|
@ -78,18 +79,19 @@
|
|||
Name="TxtCurrentActionKeyword"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Width="105"
|
||||
Width="135"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
|
||||
Text="{Binding ActionKeyword}" />
|
||||
</StackPanel>
|
||||
<StackPanel Margin="0,10,0,15" Orientation="Horizontal">
|
||||
<TextBlock Margin="0 0 15 0 "
|
||||
<TextBlock
|
||||
MinWidth="150"
|
||||
Margin="0,0,18,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Width="150"
|
||||
Text="{DynamicResource plugin_explorer_actionkeyword_enabled}" />
|
||||
<CheckBox
|
||||
Name="ChkActionKeywordEnabled"
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
Title="{DynamicResource flowlauncher_plugin_program_suffixes}"
|
||||
Width="600"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
ResizeMode="NoResize"
|
||||
SizeToContent="Height"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
|
|
@ -163,17 +163,32 @@
|
|||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource flowlauncher_plugin_program_suffixes_excutable_types}" />
|
||||
<CheckBox Name="apprefMS" Margin="10,0,0,0" IsChecked="{Binding SuffixesStatus[appref-ms]}">appref-ms</CheckBox>
|
||||
<CheckBox Name="exe" Margin="10,0,0,0" IsChecked="{Binding SuffixesStatus[exe]}">exe</CheckBox>
|
||||
<CheckBox Name="lnk" Margin="10,0,0,0" IsChecked="{Binding SuffixesStatus[lnk]}">lnk</CheckBox>
|
||||
<CheckBox
|
||||
Name="apprefMS"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding SuffixesStatus[appref-ms]}">
|
||||
appref-ms
|
||||
</CheckBox>
|
||||
<CheckBox
|
||||
Name="exe"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding SuffixesStatus[exe]}">
|
||||
exe
|
||||
</CheckBox>
|
||||
<CheckBox
|
||||
Name="lnk"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding SuffixesStatus[lnk]}">
|
||||
lnk
|
||||
</CheckBox>
|
||||
<CheckBox
|
||||
Name="CustomFiles"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding UseCustomSuffixes}"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_file_types}" />
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_file_types}"
|
||||
IsChecked="{Binding UseCustomSuffixes}" />
|
||||
<TextBox
|
||||
x:Name="tbSuffixes"
|
||||
Margin="10,4,0,6"
|
||||
Margin="10,4,0,10"
|
||||
Style="{StaticResource CustomFileTypeTextBox}" />
|
||||
</StackPanel>
|
||||
|
||||
|
|
@ -189,17 +204,29 @@
|
|||
FontSize="16"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource flowlauncher_plugin_program_suffixes_URL_types}" />
|
||||
<CheckBox Name="steam" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[steam]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_steam}"></CheckBox>
|
||||
<CheckBox Name="epic" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[epic]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_epic}"></CheckBox>
|
||||
<CheckBox Name="http" Margin="10,0,0,0" IsChecked="{Binding ProtocolsStatus[http]}" Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_http}"></CheckBox>
|
||||
<CheckBox
|
||||
Name="steam"
|
||||
Margin="10,0,0,0"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_steam}"
|
||||
IsChecked="{Binding ProtocolsStatus[steam]}" />
|
||||
<CheckBox
|
||||
Name="epic"
|
||||
Margin="10,0,0,0"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_epic}"
|
||||
IsChecked="{Binding ProtocolsStatus[epic]}" />
|
||||
<CheckBox
|
||||
Name="http"
|
||||
Margin="10,0,0,0"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_URL_http}"
|
||||
IsChecked="{Binding ProtocolsStatus[http]}" />
|
||||
<CheckBox
|
||||
Name="CustomProtocol"
|
||||
Margin="10,0,0,0"
|
||||
IsChecked="{Binding UseCustomProtocols}"
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_urls}" />
|
||||
Content="{DynamicResource flowlauncher_plugin_program_suffixes_custom_urls}"
|
||||
IsChecked="{Binding UseCustomProtocols}" />
|
||||
<TextBox
|
||||
x:Name="tbProtocols"
|
||||
Margin="10,4,0,6"
|
||||
Margin="10,4,0,0"
|
||||
Style="{StaticResource CustomURLTypeTextBox}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
}
|
||||
|
||||
// To initialize the app description
|
||||
public String description = String.Empty;
|
||||
|
||||
public string description = string.Empty;
|
||||
public string arguments = string.Empty;
|
||||
|
||||
// Retrieve the target path using Shell Link
|
||||
public string retrieveTargetPath(string path)
|
||||
|
|
@ -122,13 +122,16 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
buffer = new StringBuilder(MAX_PATH);
|
||||
((IShellLinkW)link).GetDescription(buffer, MAX_PATH);
|
||||
description = buffer.ToString();
|
||||
|
||||
buffer.Clear();
|
||||
((IShellLinkW)link).GetArguments(buffer, MAX_PATH);
|
||||
arguments = buffer.ToString();
|
||||
}
|
||||
|
||||
// To release unmanaged memory
|
||||
Marshal.ReleaseComObject(link);
|
||||
|
||||
return target;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,18 +26,17 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
public string UniqueIdentifier { get => _uid; set => _uid = value == null ? string.Empty : value.ToLowerInvariant(); } // For path comparison
|
||||
public string IcoPath { get; set; }
|
||||
/// <summary>
|
||||
/// Path of the file. It's the path of .lnk or .url for .lnk and .url.
|
||||
/// Path of the file. It's the path of .lnk and .url for .lnk and .url files.
|
||||
/// </summary>
|
||||
public string FullPath { get; set; }
|
||||
/// <summary>
|
||||
/// Path of the excutable for .lnk, or the URL for .url.
|
||||
/// Path of the excutable for .lnk, or the URL for .url. Arguments are included if any.
|
||||
/// </summary>
|
||||
public string LnkResolvedPath { get; set; }
|
||||
/// <summary>
|
||||
/// Path of the actual executable file.
|
||||
/// </summary>
|
||||
public string ExecutablePath => LnkResolvedPath ?? FullPath;
|
||||
public string WorkingDir => Directory.GetParent(ExecutablePath)?.FullName ?? string.Empty;
|
||||
public string ParentDirectory { get; set; }
|
||||
public string ExecutableName { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
|
@ -140,8 +139,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = ExecutablePath,
|
||||
WorkingDirectory = WorkingDir,
|
||||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
UseShellExecute = true,
|
||||
Verb = runAsAdmin ? "runas" : null
|
||||
};
|
||||
|
|
@ -167,8 +166,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
{
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = ExecutablePath,
|
||||
WorkingDirectory = WorkingDir,
|
||||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
||||
|
|
@ -186,8 +185,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
{
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
FileName = ExecutablePath,
|
||||
WorkingDirectory = WorkingDir,
|
||||
FileName = FullPath,
|
||||
WorkingDirectory = ParentDirectory,
|
||||
Verb = "runas",
|
||||
UseShellExecute = true
|
||||
};
|
||||
|
|
@ -221,8 +220,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
return Name;
|
||||
}
|
||||
|
||||
public static List<FileSystemWatcher> Watchers = new List<FileSystemWatcher>();
|
||||
|
||||
private static List<FileSystemWatcher> Watchers = new List<FileSystemWatcher>();
|
||||
|
||||
private static Win32 Win32Program(string path)
|
||||
{
|
||||
|
|
@ -277,6 +275,12 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
program.LnkResolvedPath = Path.GetFullPath(target);
|
||||
program.ExecutableName = Path.GetFileName(target);
|
||||
|
||||
var args = _helper.arguments;
|
||||
if(!string.IsNullOrEmpty(args))
|
||||
{
|
||||
program.LnkResolvedPath += " " + args;
|
||||
}
|
||||
|
||||
var description = _helper.description;
|
||||
if (!string.IsNullOrEmpty(description))
|
||||
{
|
||||
|
|
@ -447,9 +451,9 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
var paths = pathEnv.Split(";", StringSplitOptions.RemoveEmptyEntries).DistinctBy(p => p.ToLowerInvariant());
|
||||
|
||||
paths = paths.Where(x => commonParents.All(parent => !x.StartsWith(parent, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
var toFilter = paths.AsParallel().SelectMany(p => EnumerateProgramsInDir(p, suffixes, recursive: false));
|
||||
var toFilter = paths.Where(x => commonParents.All(parent => !IsSubPathOf(x, parent)))
|
||||
.AsParallel()
|
||||
.SelectMany(p => EnumerateProgramsInDir(p, suffixes, recursive: false));
|
||||
|
||||
var programs = ExceptDisabledSource(toFilter.Distinct())
|
||||
.Select(x => GetProgramFromPath(x, protocols));
|
||||
|
|
@ -573,6 +577,7 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
private static IEnumerable<Win32> ProgramsHasher(IEnumerable<Win32> programs)
|
||||
{
|
||||
// TODO: Unable to distinguish multiple lnks to the same excutable but with different params
|
||||
return programs.GroupBy(p => p.ExecutablePath.ToLowerInvariant())
|
||||
.AsParallel()
|
||||
.SelectMany(g =>
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@
|
|||
BorderThickness="1" />
|
||||
<StackPanel
|
||||
Width="Auto"
|
||||
Height="55"
|
||||
Margin="60,6,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Orientation="Horizontal">
|
||||
|
|
@ -145,8 +146,8 @@
|
|||
DragEnter="programSourceView_DragEnter"
|
||||
Drop="programSourceView_Drop"
|
||||
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"
|
||||
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
|
||||
MouseDoubleClick="programSourceView_MouseDoubleClick"
|
||||
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
|
||||
SelectionChanged="programSourceView_SelectionChanged"
|
||||
SelectionMode="Extended">
|
||||
<ListView.View>
|
||||
|
|
|
|||
Loading…
Reference in a new issue