mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add fody and use binding to change width
This commit is contained in:
parent
6aaca100f2
commit
5be44b68ea
7 changed files with 36 additions and 25 deletions
|
|
@ -365,7 +365,6 @@ namespace Flow.Launcher.Core.Resource
|
|||
var windowHelper = new WindowInteropHelper(w);
|
||||
|
||||
// this determines the width of the main query window
|
||||
w.Width = mainWindowWidth;
|
||||
windowHelper.EnsureHandle();
|
||||
|
||||
var accent = new AccentPolicy { AccentState = state };
|
||||
|
|
|
|||
|
|
@ -50,10 +50,15 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Ben.Demystifier" Version="0.4.1" />
|
||||
<PackageReference Include="Fody" Version="6.5.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="16.10.56" />
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
<PackageReference Include="NLog.Schema" Version="4.7.10" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
|
||||
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
||||
<!--ToolGood.Words.Pinyin v3.0.2.6 results in high memory usage when search with pinyin is enabled-->
|
||||
<!--Bumping to it or higher needs to test and ensure this is no longer a problem-->
|
||||
|
|
|
|||
|
|
@ -5,28 +5,21 @@ using System.Text.Json.Serialization;
|
|||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Plugin.SharedModels;
|
||||
using Flow.Launcher;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
{
|
||||
public class Settings : BaseModel
|
||||
{
|
||||
private string language = "en";
|
||||
public double windowsize = 580;
|
||||
public string Hotkey { get; set; } = $"{KeyConstant.Alt} + {KeyConstant.Space}";
|
||||
public string OpenResultModifiers { get; set; } = KeyConstant.Alt;
|
||||
public bool ShowOpenResultHotkey { get; set; } = true;
|
||||
public double WindowSize
|
||||
{
|
||||
get => windowsize; set
|
||||
{
|
||||
windowsize = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
|
||||
}
|
||||
public double WindowSize { get; set; } = 580;
|
||||
|
||||
public string Language
|
||||
{
|
||||
get => language; set
|
||||
get => language;
|
||||
set
|
||||
{
|
||||
language = value;
|
||||
OnPropertyChanged();
|
||||
|
|
@ -62,7 +55,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
try
|
||||
{
|
||||
var precisionScore = (SearchPrecisionScore)Enum
|
||||
.Parse(typeof(SearchPrecisionScore), value);
|
||||
.Parse(typeof(SearchPrecisionScore), value);
|
||||
|
||||
QuerySearchPrecision = precisionScore;
|
||||
StringMatcher.Instance.UserSettingSearchPrecision = precisionScore;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
LocationChanged="OnLocationChanged"
|
||||
Deactivated="OnDeactivated"
|
||||
PreviewKeyDown="OnKeyDown"
|
||||
Width="{Binding MainWindowWidth, Mode=OneTime}"
|
||||
Visibility="{Binding MainWindowVisibility, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
d:DataContext="{d:DesignInstance vm:MainViewModel}">
|
||||
<Window.Resources>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ using DragEventArgs = System.Windows.DragEventArgs;
|
|||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
using MessageBox = System.Windows.MessageBox;
|
||||
using NotifyIcon = System.Windows.Forms.NotifyIcon;
|
||||
using System.Windows.Interop;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -131,6 +132,10 @@ namespace Flow.Launcher
|
|||
_viewModel.QueryTextCursorMovedToEnd = false;
|
||||
}
|
||||
break;
|
||||
case nameof(MainViewModel.MainWindowWidth):
|
||||
MinWidth = _viewModel.MainWindowWidth;
|
||||
MaxWidth = _viewModel.MainWindowWidth;
|
||||
break;
|
||||
}
|
||||
};
|
||||
_settings.PropertyChanged += (o, e) =>
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ using System.Threading.Channels;
|
|||
using ISavable = Flow.Launcher.Plugin.ISavable;
|
||||
using System.Windows.Threading;
|
||||
using NHotkey;
|
||||
using Windows.Web.Syndication;
|
||||
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
|
|
@ -63,6 +64,13 @@ namespace Flow.Launcher.ViewModel
|
|||
_lastQuery = new Query();
|
||||
|
||||
_settings = settings;
|
||||
_settings.PropertyChanged += (_, args) =>
|
||||
{
|
||||
if (args.PropertyName == nameof(Settings.WindowSize))
|
||||
{
|
||||
OnPropertyChanged(nameof(MainWindowWidth));
|
||||
}
|
||||
};
|
||||
|
||||
_historyItemsStorage = new FlowLauncherJsonStorage<History>();
|
||||
_userSelectedRecordStorage = new FlowLauncherJsonStorage<UserSelectedRecord>();
|
||||
|
|
@ -378,6 +386,8 @@ namespace Flow.Launcher.ViewModel
|
|||
public Visibility ProgressBarVisibility { get; set; }
|
||||
public Visibility MainWindowVisibility { get; set; }
|
||||
|
||||
public double MainWindowWidth => _settings.WindowSize;
|
||||
|
||||
public ICommand EscCommand { get; set; }
|
||||
public ICommand SelectNextItemCommand { get; set; }
|
||||
public ICommand SelectPrevItemCommand { get; set; }
|
||||
|
|
|
|||
|
|
@ -35,9 +35,11 @@ namespace Flow.Launcher.ViewModel
|
|||
Settings = _storage.Load();
|
||||
Settings.PropertyChanged += (s, e) =>
|
||||
{
|
||||
if (e.PropertyName == nameof(Settings.ActivateTimes))
|
||||
switch (e.PropertyName)
|
||||
{
|
||||
OnPropertyChanged(nameof(ActivatedTimes));
|
||||
case nameof(Settings.ActivateTimes):
|
||||
OnPropertyChanged(nameof(ActivatedTimes));
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -51,7 +53,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public bool AutoUpdates
|
||||
{
|
||||
get { return Settings.AutoUpdates; }
|
||||
get => Settings.AutoUpdates;
|
||||
set
|
||||
{
|
||||
Settings.AutoUpdates = value;
|
||||
|
|
@ -71,7 +73,7 @@ namespace Flow.Launcher.ViewModel
|
|||
private bool _portableMode = DataLocation.PortableDataLocationInUse();
|
||||
public bool PortableMode
|
||||
{
|
||||
get { return _portableMode; }
|
||||
get => _portableMode;
|
||||
set
|
||||
{
|
||||
if (!_portable.CanUpdatePortability())
|
||||
|
|
@ -306,18 +308,14 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public double WindowWidthSize
|
||||
{
|
||||
get { return Settings.WindowSize; }
|
||||
set
|
||||
{
|
||||
Settings.WindowSize = value;
|
||||
ThemeManager.Instance.ChangeTheme(Settings.Theme);
|
||||
}
|
||||
get => Settings.WindowSize;
|
||||
set => Settings.WindowSize = value;
|
||||
}
|
||||
|
||||
public bool UseGlyphIcons
|
||||
{
|
||||
get { return Settings.UseGlyphIcons; }
|
||||
set { Settings.UseGlyphIcons = value; }
|
||||
get => Settings.UseGlyphIcons;
|
||||
set => Settings.UseGlyphIcons = value;
|
||||
}
|
||||
|
||||
public Brush PreviewBackground
|
||||
|
|
|
|||
Loading…
Reference in a new issue