Compare commits

..

1 commit

Author SHA1 Message Date
Jack Ye
b1b03fd3ea
Merge 95fc3eb489 into 24f6c90f72 2026-03-10 12:20:47 +08:00
6 changed files with 16 additions and 34 deletions

View file

@ -38,20 +38,9 @@ namespace Flow.Launcher
private void SetException(Exception exception)
{
FileInfo log = null;
try
{
var path = DataLocation.VersionLogDirectory;
var directory = new DirectoryInfo(path);
if (directory.Exists)
{
log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).FirstOrDefault();
}
}
catch (Exception)
{
// Intentionally ignore all errors when trying to find the log file to avoid secondary crashes
}
var path = DataLocation.VersionLogDirectory;
var directory = new DirectoryInfo(path);
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
var websiteUrl = exception switch
{
@ -60,11 +49,8 @@ namespace Flow.Launcher
};
var paragraph = Hyperlink(Localize.reportWindow_please_open_issue(), websiteUrl);
if (log is not null)
{
paragraph.Inlines.Add(Localize.reportWindow_upload_log(log.FullName));
paragraph.Inlines.Add("\n");
}
paragraph.Inlines.Add(Localize.reportWindow_upload_log(log.FullName));
paragraph.Inlines.Add("\n");
paragraph.Inlines.Add(Localize.reportWindow_copy_below());
ErrorTextbox.Document.Blocks.Add(paragraph);

View file

@ -96,7 +96,7 @@ public partial class SettingWindow
private void Window_StateChanged(object sender, EventArgs e)
{
RefreshMaximizeRestoreButton();
if (IsLoaded && WindowState != WindowState.Minimized)
if (IsLoaded)
{
_settings.SettingWindowState = WindowState;
}
@ -169,9 +169,7 @@ public partial class SettingWindow
SetWindowPosition(top, left);
}
WindowState = _settings.SettingWindowState == WindowState.Minimized
? WindowState.Normal
: _settings.SettingWindowState;
WindowState = _settings.SettingWindowState;
}
private void SetWindowPosition(double top, double left)

View file

@ -230,7 +230,7 @@ namespace Flow.Launcher.Plugin.Explorer
internal Dictionary<ActionKeyword, string> GetActiveActionKeywords(string actionKeywordStr)
{
var result = new Dictionary<ActionKeyword, string>();
if (string.IsNullOrEmpty(actionKeywordStr)) return result;
if (string.IsNullOrEmpty(actionKeywordStr)) return null;
foreach (var action in Enum.GetValues<ActionKeyword>())
{
var keywordStr = GetActionKeyword(action);

View file

@ -321,9 +321,8 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
Context.API.AddActionKeyword(Context.CurrentPluginMetadata.ID, actionKeywordWindow.ActionKeyword);
break;
case (false, false):
// Keyword was disabled and remains disabled, but the keyword text was changed.
// No action keyword registration changes needed; the model will be updated below.
break;
throw new ArgumentException(
$"Both false in {nameof(actionKeyword)}.{nameof(actionKeyword.Enabled)} and {nameof(actionKeywordWindow)}.{nameof(actionKeywordWindow.KeywordEnabled)} should suggest that the ShowDialog() result is false");
}
(actionKeyword.Keyword, actionKeyword.Enabled) = (actionKeywordWindow.ActionKeyword, actionKeywordWindow.KeywordEnabled);

View file

@ -82,7 +82,7 @@
VerticalAlignment="Center"
DataObject.Pasting="TextBox_Pasting"
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
Text="{Binding ActionKeyword, UpdateSourceTrigger=PropertyChanged}" />
Text="{Binding ActionKeyword}" />
</StackPanel>
<StackPanel Margin="0 10 0 15" Orientation="Horizontal">
<TextBlock

View file

@ -16,9 +16,9 @@ namespace Flow.Launcher.Plugin.Explorer.Views
get => actionKeyword;
set
{
// Set Enable to be true only when the ActionKeyword value actually changes
if (SetProperty(ref actionKeyword, value))
KeywordEnabled = true;
// Set Enable to be true if user change ActionKeyword
KeywordEnabled = true;
_ = SetProperty(ref actionKeyword, value);
}
}
@ -34,9 +34,8 @@ namespace Flow.Launcher.Plugin.Explorer.Views
public ActionKeywordSetting(ActionKeywordModel selectedActionKeyword)
{
CurrentActionKeyword = selectedActionKeyword;
// Initialize backing fields directly to avoid triggering the auto-enable side-effect
actionKeyword = selectedActionKeyword.Keyword;
_keywordEnabled = selectedActionKeyword.Enabled;
ActionKeyword = selectedActionKeyword.Keyword;
KeywordEnabled = selectedActionKeyword.Enabled;
InitializeComponent();