mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Code quality
This commit is contained in:
parent
3b425413a2
commit
4b15add524
2 changed files with 36 additions and 31 deletions
|
|
@ -327,18 +327,6 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
container.Add(link);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void EditQuickAccessLink(object commandParameter)
|
||||
{
|
||||
if (SelectedQuickAccessLink is null)
|
||||
{
|
||||
ShowUnselectedMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
var quickAccessLinkSettings = new QuickAccessLinkSettings(SelectedQuickAccessLink);
|
||||
quickAccessLinkSettings.ShowDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void EditIndexSearchExcludePaths(object commandParameter)
|
||||
|
|
@ -368,20 +356,6 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
});
|
||||
}
|
||||
|
||||
private void ShowUnselectedMessage()
|
||||
{
|
||||
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
|
||||
Context.API.ShowMsgBox(warning);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AddQuickAccessLink(object commandParameter)
|
||||
{
|
||||
var quickAccessLinkSettings = new QuickAccessLinkSettings();
|
||||
quickAccessLinkSettings.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void AddIndexSearchExcludePaths(object commandParameter)
|
||||
{
|
||||
|
|
@ -400,6 +374,28 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
container.Add(newAccessLink);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void EditQuickAccessLink(object commandParameter)
|
||||
{
|
||||
if (SelectedQuickAccessLink is null)
|
||||
{
|
||||
ShowUnselectedMessage();
|
||||
return;
|
||||
}
|
||||
|
||||
var quickAccessLinkSettings = new QuickAccessLinkSettings(SelectedQuickAccessLink);
|
||||
quickAccessLinkSettings.ShowDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void AddQuickAccessLink(object commandParameter)
|
||||
{
|
||||
var quickAccessLinkSettings = new QuickAccessLinkSettings();
|
||||
quickAccessLinkSettings.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void RemoveLink(object obj)
|
||||
{
|
||||
|
|
@ -418,6 +414,12 @@ namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|||
}
|
||||
Save();
|
||||
}
|
||||
|
||||
private void ShowUnselectedMessage()
|
||||
{
|
||||
var warning = Context.API.GetTranslation("plugin_explorer_make_selection_warning");
|
||||
Context.API.ShowMsgBox(warning);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views;
|
|||
|
||||
public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private bool IsEdit { get; set; }
|
||||
[CanBeNull] private AccessLink SelectedAccessLink { get; set; }
|
||||
|
||||
private string _selectedPath;
|
||||
|
||||
public string SelectedPath
|
||||
|
|
@ -28,7 +26,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
{
|
||||
_selectedPath = value;
|
||||
OnPropertyChanged();
|
||||
SelectedName = GetPathName();
|
||||
if (string.IsNullOrEmpty(_selectedName)) SelectedName = GetPathName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -53,6 +51,8 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsEdit { get; set; }
|
||||
[CanBeNull] private AccessLink SelectedAccessLink { get; set; }
|
||||
public QuickAccessLinkSettings()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
|
@ -78,7 +78,7 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
|
||||
private void OnDoneButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(SelectedName) && string.IsNullOrEmpty(SelectedPath))
|
||||
if (string.IsNullOrEmpty(SelectedName) || string.IsNullOrEmpty(SelectedPath))
|
||||
{
|
||||
var warning = Main.Context.API.GetTranslation("plugin_explorer_quick_access_link_no_folder_selected");
|
||||
Main.Context.API.ShowMsgBox(warning);
|
||||
|
|
@ -122,6 +122,9 @@ public partial class QuickAccessLinkSettings : INotifyPropertyChanged
|
|||
{
|
||||
if (SelectedAccessLink == null)throw new ArgumentException("Access Link object is null");
|
||||
|
||||
|
||||
// Talvez nao seja preciso buscar pelo hash code, mas sim pelo nome ou path
|
||||
// Uma possivel validação, se pode nomes e paths iguais
|
||||
var obj = Settings.QuickAccessLinks.FirstOrDefault(x => x.GetHashCode() == SelectedAccessLink.GetHashCode());
|
||||
int index = Settings.QuickAccessLinks.IndexOf(obj);
|
||||
if (index >= 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue