Flow.Launcher/Plugins/Flow.Launcher.Plugin.Sys/SysSettings.xaml.cs
Jack Ye 5b6ea73513
Code cleanup & Use Flow.Launcher.Localization to improve code quality (#4009)
* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Improve code quality

* Improve code quality

* Use internal static Context & Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Use Flow.Launcher.Localization to improve code quality

* Improve code quality

* Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Fix logic issue

* Fix the variable name typo

* Fix redundant boolean cast and ensure consistent default value handling

* Use Flow.Launcher.Localization to improve code quality

* Revert namespace styles

* Fix indent format

* Revert namespace style

* Fix indent format

* Fix namespace style

* Fix indent format

* Fix indent format
2025-09-27 19:18:33 +03:00

52 lines
1.7 KiB
C#

using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
namespace Flow.Launcher.Plugin.Sys
{
public partial class SysSettings : UserControl
{
private readonly Settings _settings;
public SysSettings(SettingsViewModel viewModel)
{
InitializeComponent();
_settings = viewModel.Settings;
DataContext = viewModel;
}
private void ListView_SizeChanged(object sender, SizeChangedEventArgs e)
{
ListView listView = sender as ListView;
GridView gView = listView.View as GridView;
var workingWidth =
listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar
if (workingWidth <= 0) return;
var col1 = 0.2;
var col2 = 0.6;
var col3 = 0.2;
gView.Columns[0].Width = workingWidth * col1;
gView.Columns[1].Width = workingWidth * col2;
gView.Columns[2].Width = workingWidth * col3;
}
public void OnEditCommandKeywordClick(object sender, RoutedEventArgs e)
{
var commandKeyword = new CommandKeywordSettingWindow(_settings.SelectedCommand);
commandKeyword.ShowDialog();
}
private void MouseDoubleClickItem(object sender, MouseButtonEventArgs e)
{
if (((FrameworkElement)e.OriginalSource).DataContext is Command && _settings.SelectedCommand != null)
{
var commandKeyword = new CommandKeywordSettingWindow(_settings.SelectedCommand);
commandKeyword.ShowDialog();
}
}
}
}