mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add Prerelease update source
This commit is contained in:
parent
1bf95201cc
commit
82a174ff30
7 changed files with 108 additions and 20 deletions
|
|
@ -22,18 +22,20 @@ namespace Flow.Launcher.Core
|
||||||
{
|
{
|
||||||
public class Updater
|
public class Updater
|
||||||
{
|
{
|
||||||
public string GitHubRepository { get; }
|
public bool UpdateToPrerelease { get; set; }
|
||||||
|
|
||||||
|
public const string ReleaseRepository = "https://github.com/Flow-Launcher/Flow.Launcher";
|
||||||
|
public const string PrereleaseRepository = "https://github.com/Flow-Launcher/Prereleases";
|
||||||
|
|
||||||
|
public string GitHubRepository => UpdateToPrerelease ? PrereleaseRepository : ReleaseRepository;
|
||||||
|
|
||||||
public Updater(string gitHubRepository)
|
|
||||||
{
|
|
||||||
GitHubRepository = gitHubRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
|
private SemaphoreSlim UpdateLock { get; } = new SemaphoreSlim(1);
|
||||||
|
|
||||||
public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
|
public async Task UpdateAppAsync(IPublicAPI api, bool silentUpdate = true)
|
||||||
{
|
{
|
||||||
await UpdateLock.WaitAsync().ConfigureAwait(false);
|
await UpdateLock.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!silentUpdate)
|
if (!silentUpdate)
|
||||||
|
|
@ -54,6 +56,7 @@ namespace Flow.Launcher.Core
|
||||||
{
|
{
|
||||||
if (!silentUpdate)
|
if (!silentUpdate)
|
||||||
MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest"));
|
MessageBox.Show(api.GetTranslation("update_flowlauncher_already_on_latest"));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,7 +97,7 @@ namespace Flow.Launcher.Core
|
||||||
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
|
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
|
||||||
else
|
else
|
||||||
Log.Exception($"|Updater.UpdateApp|Error Occurred", e);
|
Log.Exception($"|Updater.UpdateApp|Error Occurred", e);
|
||||||
|
|
||||||
if (!silentUpdate)
|
if (!silentUpdate)
|
||||||
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
|
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
|
||||||
api.GetTranslation("update_flowlauncher_check_connection"));
|
api.GetTranslation("update_flowlauncher_check_connection"));
|
||||||
|
|
@ -134,6 +137,7 @@ namespace Flow.Launcher.Core
|
||||||
{
|
{
|
||||||
Proxy = Http.WebProxy
|
Proxy = Http.WebProxy
|
||||||
};
|
};
|
||||||
|
|
||||||
var downloader = new FileDownloader(client);
|
var downloader = new FileDownloader(client);
|
||||||
|
|
||||||
var manager = new UpdateManager(latestUrl, urlDownloader: downloader);
|
var manager = new UpdateManager(latestUrl, urlDownloader: downloader);
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
public double SettingWindowHeight { get; set; } = 700;
|
public double SettingWindowHeight { get; set; } = 700;
|
||||||
public double SettingWindowTop { get; set; }
|
public double SettingWindowTop { get; set; }
|
||||||
public double SettingWindowLeft { get; set; }
|
public double SettingWindowLeft { get; set; }
|
||||||
public System.Windows.WindowState SettingWindowState { get; set; } = WindowState.Normal;
|
public WindowState SettingWindowState { get; set; } = WindowState.Normal;
|
||||||
|
|
||||||
|
public bool PrereleaseUpdateSource { get; set; }
|
||||||
|
|
||||||
public int CustomExplorerIndex { get; set; } = 0;
|
public int CustomExplorerIndex { get; set; } = 0;
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
|
|
@ -253,8 +255,8 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
||||||
|
|
||||||
[JsonConverter(typeof(JsonStringEnumConverter))]
|
[JsonConverter(typeof(JsonStringEnumConverter))]
|
||||||
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
|
public LastQueryMode LastQueryMode { get; set; } = LastQueryMode.Selected;
|
||||||
|
|
||||||
|
|
||||||
// This needs to be loaded last by staying at the bottom
|
// This needs to be loaded last by staying at the bottom
|
||||||
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace Flow.Launcher
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
private MainViewModel _mainVM;
|
private MainViewModel _mainVM;
|
||||||
private SettingWindowViewModel _settingsVM;
|
private SettingWindowViewModel _settingsVM;
|
||||||
private readonly Updater _updater = new Updater(Flow.Launcher.Properties.Settings.Default.GithubRepo);
|
private readonly Updater _updater = new();
|
||||||
private readonly Portable _portable = new Portable();
|
private readonly Portable _portable = new Portable();
|
||||||
private readonly PinyinAlphabet _alphabet = new PinyinAlphabet();
|
private readonly PinyinAlphabet _alphabet = new PinyinAlphabet();
|
||||||
private StringMatcher _stringMatcher;
|
private StringMatcher _stringMatcher;
|
||||||
|
|
@ -59,7 +59,7 @@ namespace Flow.Launcher
|
||||||
RegisterDispatcherUnhandledException();
|
RegisterDispatcherUnhandledException();
|
||||||
|
|
||||||
ImageLoader.Initialize();
|
ImageLoader.Initialize();
|
||||||
|
|
||||||
_settingsVM = new SettingWindowViewModel(_updater, _portable);
|
_settingsVM = new SettingWindowViewModel(_updater, _portable);
|
||||||
_settings = _settingsVM.Settings;
|
_settings = _settingsVM.Settings;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -234,6 +234,9 @@
|
||||||
<system:String x:Key="clearlogfolder">Clear Logs</system:String>
|
<system:String x:Key="clearlogfolder">Clear Logs</system:String>
|
||||||
<system:String x:Key="clearlogfolderMessage">Are you sure you want to delete all logs?</system:String>
|
<system:String x:Key="clearlogfolderMessage">Are you sure you want to delete all logs?</system:String>
|
||||||
<system:String x:Key="welcomewindow">Wizard</system:String>
|
<system:String x:Key="welcomewindow">Wizard</system:String>
|
||||||
|
<system:String x:Key="updateSource">Update Source</system:String>
|
||||||
|
<system:String x:Key="release">Release</system:String>
|
||||||
|
<system:String x:Key="prerelease">Prerelease</system:String>
|
||||||
|
|
||||||
<!-- FileManager Setting Dialog -->
|
<!-- FileManager Setting Dialog -->
|
||||||
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
|
<system:String x:Key="fileManagerWindow">Select File Manager</system:String>
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,8 @@
|
||||||
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
|
<Setting Name="GithubRepo" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">https://github.com/Flow-Launcher/Flow.Launcher</Value>
|
<Value Profile="(Default)">https://github.com/Flow-Launcher/Flow.Launcher</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="PrereleaseRepo" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)">https://github.com/Flow-Launcher/Prereleases</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
||||||
|
|
@ -3058,12 +3058,13 @@
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{DynamicResource SettingTitleLabel}"
|
Style="{DynamicResource SettingTitleLabel}"
|
||||||
Text="Update Source" />
|
Text="{DynamicResource updateSource}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||||
<ComboBox Margin="0,0,8,0" SelectedIndex="0">
|
<ComboBox Margin="0,0,8,0" SelectedIndex="0">
|
||||||
<ComboBoxItem>Release</ComboBoxItem>
|
<ComboBoxItem Content="{DynamicResource release}"/>
|
||||||
<ComboBoxItem>Preview</ComboBoxItem>
|
<ComboBoxItem IsSelected="{Binding Settings.PrereleaseUpdateSource}"
|
||||||
|
Content="{DynamicResource prerelease}"/>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Button
|
<Button
|
||||||
Margin="0,0,14,0"
|
Margin="0,0,14,0"
|
||||||
|
|
|
||||||
|
|
@ -43,29 +43,41 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
case nameof(Settings.ActivateTimes):
|
case nameof(Settings.ActivateTimes):
|
||||||
OnPropertyChanged(nameof(ActivatedTimes));
|
OnPropertyChanged(nameof(ActivatedTimes));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case nameof(Settings.WindowSize):
|
case nameof(Settings.WindowSize):
|
||||||
OnPropertyChanged(nameof(WindowWidthSize));
|
OnPropertyChanged(nameof(WindowWidthSize));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case nameof(Settings.UseDate):
|
case nameof(Settings.UseDate):
|
||||||
case nameof(Settings.DateFormat):
|
case nameof(Settings.DateFormat):
|
||||||
OnPropertyChanged(nameof(DateText));
|
OnPropertyChanged(nameof(DateText));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case nameof(Settings.UseClock):
|
case nameof(Settings.UseClock):
|
||||||
case nameof(Settings.TimeFormat):
|
case nameof(Settings.TimeFormat):
|
||||||
OnPropertyChanged(nameof(ClockText));
|
OnPropertyChanged(nameof(ClockText));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case nameof(Settings.Language):
|
case nameof(Settings.Language):
|
||||||
OnPropertyChanged(nameof(ClockText));
|
OnPropertyChanged(nameof(ClockText));
|
||||||
OnPropertyChanged(nameof(DateText));
|
OnPropertyChanged(nameof(DateText));
|
||||||
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case nameof(Settings.PreviewHotkey):
|
case nameof(Settings.PreviewHotkey):
|
||||||
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
OnPropertyChanged(nameof(AlwaysPreviewToolTip));
|
||||||
|
|
||||||
|
break;
|
||||||
|
case nameof(Settings.PrereleaseUpdateSource):
|
||||||
|
_updater.UpdateToPrerelease = Settings.PrereleaseUpdateSource;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_updater.UpdateToPrerelease = Settings.PrereleaseUpdateSource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|
@ -160,6 +172,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
};
|
};
|
||||||
|
|
||||||
var result = dlg.ShowDialog();
|
var result = dlg.ShowDialog();
|
||||||
|
|
||||||
if (result == System.Windows.Forms.DialogResult.OK)
|
if (result == System.Windows.Forms.DialogResult.OK)
|
||||||
{
|
{
|
||||||
return dlg.FileName;
|
return dlg.FileName;
|
||||||
|
|
@ -176,6 +189,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
public class LastQueryMode : BaseModel
|
public class LastQueryMode : BaseModel
|
||||||
{
|
{
|
||||||
public string Display { get; set; }
|
public string Display { get; set; }
|
||||||
|
|
||||||
public Infrastructure.UserSettings.LastQueryMode Value { get; set; }
|
public Infrastructure.UserSettings.LastQueryMode Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,6 +202,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
_lastQueryModes = InitLastQueryModes();
|
_lastQueryModes = InitLastQueryModes();
|
||||||
}
|
}
|
||||||
|
|
||||||
return _lastQueryModes;
|
return _lastQueryModes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -196,6 +211,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
var modes = new List<LastQueryMode>();
|
var modes = new List<LastQueryMode>();
|
||||||
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.LastQueryMode));
|
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.LastQueryMode));
|
||||||
|
|
||||||
foreach (var e in enums)
|
foreach (var e in enums)
|
||||||
{
|
{
|
||||||
var key = $"LastQuery{e}";
|
var key = $"LastQuery{e}";
|
||||||
|
|
@ -204,8 +220,10 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
Display = display, Value = e,
|
Display = display, Value = e,
|
||||||
};
|
};
|
||||||
|
|
||||||
modes.Add(m);
|
modes.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,8 +284,11 @@ namespace Flow.Launcher.ViewModel
|
||||||
KeyConstant.Ctrl,
|
KeyConstant.Ctrl,
|
||||||
$"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
$"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
||||||
};
|
};
|
||||||
|
|
||||||
private Internationalization _translater => InternationalizationManager.Instance;
|
private Internationalization _translater => InternationalizationManager.Instance;
|
||||||
|
|
||||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||||
|
|
||||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||||
|
|
||||||
public string AlwaysPreviewToolTip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
|
public string AlwaysPreviewToolTip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
|
||||||
|
|
@ -276,10 +297,12 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
var proxyServer = Settings.Proxy.Server;
|
var proxyServer = Settings.Proxy.Server;
|
||||||
var proxyUserName = Settings.Proxy.UserName;
|
var proxyUserName = Settings.Proxy.UserName;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(proxyServer))
|
if (string.IsNullOrEmpty(proxyServer))
|
||||||
{
|
{
|
||||||
return InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty");
|
return InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.Proxy.Port <= 0)
|
if (Settings.Proxy.Port <= 0)
|
||||||
{
|
{
|
||||||
return InternationalizationManager.Instance.GetTranslation("portCantBeEmpty");
|
return InternationalizationManager.Instance.GetTranslation("portCantBeEmpty");
|
||||||
|
|
@ -298,9 +321,11 @@ namespace Flow.Launcher.ViewModel
|
||||||
Credentials = new NetworkCredential(proxyUserName, Settings.Proxy.Password)
|
Credentials = new NetworkCredential(proxyUserName, Settings.Proxy.Password)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = (HttpWebResponse)request.GetResponse();
|
var response = (HttpWebResponse)request.GetResponse();
|
||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
if (response.StatusCode == HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
return InternationalizationManager.Instance.GetTranslation("proxyIsCorrect");
|
return InternationalizationManager.Instance.GetTranslation("proxyIsCorrect");
|
||||||
|
|
@ -321,6 +346,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
#region plugin
|
#region plugin
|
||||||
|
|
||||||
public static string Plugin => @"https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest";
|
public static string Plugin => @"https://github.com/Flow-Launcher/Flow.Launcher.PluginsManifest";
|
||||||
|
|
||||||
public PluginViewModel SelectedPlugin { get; set; }
|
public PluginViewModel SelectedPlugin { get; set; }
|
||||||
|
|
||||||
public IList<PluginViewModel> PluginViewModels
|
public IList<PluginViewModel> PluginViewModels
|
||||||
|
|
@ -358,11 +384,13 @@ namespace Flow.Launcher.ViewModel
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var settingProvider = SelectedPlugin.PluginPair.Plugin as ISettingProvider;
|
var settingProvider = SelectedPlugin.PluginPair.Plugin as ISettingProvider;
|
||||||
|
|
||||||
if (settingProvider != null)
|
if (settingProvider != null)
|
||||||
{
|
{
|
||||||
var control = settingProvider.CreateSettingPanel();
|
var control = settingProvider.CreateSettingPanel();
|
||||||
control.HorizontalAlignment = HorizontalAlignment.Stretch;
|
control.HorizontalAlignment = HorizontalAlignment.Stretch;
|
||||||
control.VerticalAlignment = VerticalAlignment.Stretch;
|
control.VerticalAlignment = VerticalAlignment.Stretch;
|
||||||
|
|
||||||
return control;
|
return control;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -378,8 +406,8 @@ namespace Flow.Launcher.ViewModel
|
||||||
await PluginsManifest.UpdateManifestAsync();
|
await PluginsManifest.UpdateManifestAsync();
|
||||||
OnPropertyChanged(nameof(ExternalPlugins));
|
OnPropertyChanged(nameof(ExternalPlugins));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
|
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
|
||||||
{
|
{
|
||||||
|
|
@ -396,6 +424,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
#region theme
|
#region theme
|
||||||
|
|
||||||
public static string Theme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
|
public static string Theme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
|
||||||
|
|
||||||
public static string ThemeGallery => @"https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438";
|
public static string ThemeGallery => @"https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438";
|
||||||
|
|
||||||
public string SelectedTheme
|
public string SelectedTheme
|
||||||
|
|
@ -421,6 +450,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
if (ThemeManager.Instance.BlurEnabled && value)
|
if (ThemeManager.Instance.BlurEnabled && value)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("shadowEffectNotAllowed"));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -440,6 +470,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
public class ColorScheme
|
public class ColorScheme
|
||||||
{
|
{
|
||||||
public string Display { get; set; }
|
public string Display { get; set; }
|
||||||
|
|
||||||
public ColorSchemes Value { get; set; }
|
public ColorSchemes Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,6 +480,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
List<ColorScheme> modes = new List<ColorScheme>();
|
List<ColorScheme> modes = new List<ColorScheme>();
|
||||||
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
|
var enums = (ColorSchemes[])Enum.GetValues(typeof(ColorSchemes));
|
||||||
|
|
||||||
foreach (var e in enums)
|
foreach (var e in enums)
|
||||||
{
|
{
|
||||||
var key = $"ColorScheme{e}";
|
var key = $"ColorScheme{e}";
|
||||||
|
|
@ -457,8 +489,10 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
Display = display, Value = e,
|
Display = display, Value = e,
|
||||||
};
|
};
|
||||||
|
|
||||||
modes.Add(m);
|
modes.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -466,6 +500,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
public class SearchWindowScreen
|
public class SearchWindowScreen
|
||||||
{
|
{
|
||||||
public string Display { get; set; }
|
public string Display { get; set; }
|
||||||
|
|
||||||
public SearchWindowScreens Value { get; set; }
|
public SearchWindowScreens Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -475,17 +510,19 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
List<SearchWindowScreen> modes = new List<SearchWindowScreen>();
|
List<SearchWindowScreen> modes = new List<SearchWindowScreen>();
|
||||||
var enums = (SearchWindowScreens[])Enum.GetValues(typeof(SearchWindowScreens));
|
var enums = (SearchWindowScreens[])Enum.GetValues(typeof(SearchWindowScreens));
|
||||||
|
|
||||||
foreach (var e in enums)
|
foreach (var e in enums)
|
||||||
{
|
{
|
||||||
var key = $"SearchWindowScreen{e}";
|
var key = $"SearchWindowScreen{e}";
|
||||||
var display = _translater.GetTranslation(key);
|
var display = _translater.GetTranslation(key);
|
||||||
var m = new SearchWindowScreen
|
var m = new SearchWindowScreen
|
||||||
{
|
{
|
||||||
Display = display,
|
Display = display, Value = e,
|
||||||
Value = e,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
modes.Add(m);
|
modes.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -493,6 +530,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
public class SearchWindowAlign
|
public class SearchWindowAlign
|
||||||
{
|
{
|
||||||
public string Display { get; set; }
|
public string Display { get; set; }
|
||||||
|
|
||||||
public SearchWindowAligns Value { get; set; }
|
public SearchWindowAligns Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -502,6 +540,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
List<SearchWindowAlign> modes = new List<SearchWindowAlign>();
|
List<SearchWindowAlign> modes = new List<SearchWindowAlign>();
|
||||||
var enums = (SearchWindowAligns[])Enum.GetValues(typeof(SearchWindowAligns));
|
var enums = (SearchWindowAligns[])Enum.GetValues(typeof(SearchWindowAligns));
|
||||||
|
|
||||||
foreach (var e in enums)
|
foreach (var e in enums)
|
||||||
{
|
{
|
||||||
var key = $"SearchWindowAlign{e}";
|
var key = $"SearchWindowAlign{e}";
|
||||||
|
|
@ -510,8 +549,10 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
Display = display, Value = e,
|
Display = display, Value = e,
|
||||||
};
|
};
|
||||||
|
|
||||||
modes.Add(m);
|
modes.Add(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modes;
|
return modes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -522,10 +563,12 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
var screens = System.Windows.Forms.Screen.AllScreens;
|
var screens = System.Windows.Forms.Screen.AllScreens;
|
||||||
var screenNumbers = new List<int>();
|
var screenNumbers = new List<int>();
|
||||||
|
|
||||||
for (int i = 1; i <= screens.Length; i++)
|
for (int i = 1; i <= screens.Length; i++)
|
||||||
{
|
{
|
||||||
screenNumbers.Add(i);
|
screenNumbers.Add(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return screenNumbers;
|
return screenNumbers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -643,6 +686,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var wallpaper = WallpaperPathRetrieval.GetWallpaperPath();
|
var wallpaper = WallpaperPathRetrieval.GetWallpaperPath();
|
||||||
|
|
||||||
if (wallpaper != null && File.Exists(wallpaper))
|
if (wallpaper != null && File.Exists(wallpaper))
|
||||||
{
|
{
|
||||||
var memStream = new MemoryStream(File.ReadAllBytes(wallpaper));
|
var memStream = new MemoryStream(File.ReadAllBytes(wallpaper));
|
||||||
|
|
@ -656,12 +700,14 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
Stretch = Stretch.UniformToFill
|
Stretch = Stretch.UniformToFill
|
||||||
};
|
};
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
|
var wallpaperColor = WallpaperPathRetrieval.GetWallpaperColor();
|
||||||
var brush = new SolidColorBrush(wallpaperColor);
|
var brush = new SolidColorBrush(wallpaperColor);
|
||||||
|
|
||||||
return brush;
|
return brush;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -698,8 +744,10 @@ namespace Flow.Launcher.ViewModel
|
||||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var vm = new ResultsViewModel(Settings);
|
var vm = new ResultsViewModel(Settings);
|
||||||
vm.AddResults(results, "PREVIEW");
|
vm.AddResults(results, "PREVIEW");
|
||||||
|
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -713,11 +761,13 @@ namespace Flow.Launcher.ViewModel
|
||||||
o.FamilyNames.Values.Contains(Settings.QueryBoxFont)) > 0)
|
o.FamilyNames.Values.Contains(Settings.QueryBoxFont)) > 0)
|
||||||
{
|
{
|
||||||
var font = new FontFamily(Settings.QueryBoxFont);
|
var font = new FontFamily(Settings.QueryBoxFont);
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var font = new FontFamily("Segoe UI");
|
var font = new FontFamily("Segoe UI");
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -738,6 +788,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
Settings.QueryBoxFontWeight,
|
Settings.QueryBoxFontWeight,
|
||||||
Settings.QueryBoxFontStretch
|
Settings.QueryBoxFontStretch
|
||||||
));
|
));
|
||||||
|
|
||||||
return typeface;
|
return typeface;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|
@ -758,11 +809,13 @@ namespace Flow.Launcher.ViewModel
|
||||||
o.FamilyNames.Values.Contains(Settings.ResultFont)) > 0)
|
o.FamilyNames.Values.Contains(Settings.ResultFont)) > 0)
|
||||||
{
|
{
|
||||||
var font = new FontFamily(Settings.ResultFont);
|
var font = new FontFamily(Settings.ResultFont);
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var font = new FontFamily("Segoe UI");
|
var font = new FontFamily("Segoe UI");
|
||||||
|
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -783,6 +836,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
Settings.ResultFontWeight,
|
Settings.ResultFontWeight,
|
||||||
Settings.ResultFontStretch
|
Settings.ResultFontStretch
|
||||||
));
|
));
|
||||||
|
|
||||||
return typeface;
|
return typeface;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
|
|
@ -815,16 +869,21 @@ namespace Flow.Launcher.ViewModel
|
||||||
public void DeleteSelectedCustomShortcut()
|
public void DeleteSelectedCustomShortcut()
|
||||||
{
|
{
|
||||||
var item = SelectedCustomShortcut;
|
var item = SelectedCustomShortcut;
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string deleteWarning = string.Format(
|
string deleteWarning = string.Format(
|
||||||
InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"),
|
InternationalizationManager.Instance.GetTranslation("deleteCustomShortcutWarning"),
|
||||||
item.Key, item.Value);
|
item.Key,
|
||||||
if (MessageBox.Show(deleteWarning, InternationalizationManager.Instance.GetTranslation("delete"),
|
item.Value);
|
||||||
|
|
||||||
|
if (MessageBox.Show(deleteWarning,
|
||||||
|
InternationalizationManager.Instance.GetTranslation("delete"),
|
||||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
Settings.CustomShortcuts.Remove(item);
|
Settings.CustomShortcuts.Remove(item);
|
||||||
|
|
@ -834,13 +893,16 @@ namespace Flow.Launcher.ViewModel
|
||||||
public bool EditSelectedCustomShortcut()
|
public bool EditSelectedCustomShortcut()
|
||||||
{
|
{
|
||||||
var item = SelectedCustomShortcut;
|
var item = SelectedCustomShortcut;
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("pleaseSelectAnItem"));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var shortcutSettingWindow = new CustomShortcutSetting(item.Key, item.Value, this);
|
var shortcutSettingWindow = new CustomShortcutSetting(item.Key, item.Value, this);
|
||||||
|
|
||||||
if (shortcutSettingWindow.ShowDialog() == true)
|
if (shortcutSettingWindow.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
// Fix un-selectable shortcut item after the first selection
|
// Fix un-selectable shortcut item after the first selection
|
||||||
|
|
@ -849,14 +911,17 @@ namespace Flow.Launcher.ViewModel
|
||||||
item.Key = shortcutSettingWindow.Key;
|
item.Key = shortcutSettingWindow.Key;
|
||||||
item.Value = shortcutSettingWindow.Value;
|
item.Value = shortcutSettingWindow.Value;
|
||||||
SelectedCustomShortcut = item;
|
SelectedCustomShortcut = item;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCustomShortcut()
|
public void AddCustomShortcut()
|
||||||
{
|
{
|
||||||
var shortcutSettingWindow = new CustomShortcutSetting(this);
|
var shortcutSettingWindow = new CustomShortcutSetting(this);
|
||||||
|
|
||||||
if (shortcutSettingWindow.ShowDialog() == true)
|
if (shortcutSettingWindow.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
var shortcut = new CustomShortcutModel(shortcutSettingWindow.Key, shortcutSettingWindow.Value);
|
var shortcut = new CustomShortcutModel(shortcutSettingWindow.Key, shortcutSettingWindow.Value);
|
||||||
|
|
@ -874,11 +939,17 @@ namespace Flow.Launcher.ViewModel
|
||||||
#region about
|
#region about
|
||||||
|
|
||||||
public string Website => Constant.Website;
|
public string Website => Constant.Website;
|
||||||
|
|
||||||
public string SponsorPage => Constant.SponsorPage;
|
public string SponsorPage => Constant.SponsorPage;
|
||||||
|
|
||||||
public string ReleaseNotes => _updater.GitHubRepository + @"/releases/latest";
|
public string ReleaseNotes => _updater.GitHubRepository + @"/releases/latest";
|
||||||
|
|
||||||
public string Documentation => Constant.Documentation;
|
public string Documentation => Constant.Documentation;
|
||||||
|
|
||||||
public string Docs => Constant.Docs;
|
public string Docs => Constant.Docs;
|
||||||
|
|
||||||
public string Github => Constant.GitHub;
|
public string Github => Constant.GitHub;
|
||||||
|
|
||||||
public string Version
|
public string Version
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -893,6 +964,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||||
|
|
||||||
public string CheckLogFolder
|
public string CheckLogFolder
|
||||||
|
|
@ -901,6 +973,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
var logFiles = GetLogFiles();
|
var logFiles = GetLogFiles();
|
||||||
long size = logFiles.Sum(file => file.Length);
|
long size = logFiles.Sum(file => file.Length);
|
||||||
|
|
||||||
return string.Format("{0} ({1})", _translater.GetTranslation("clearlogfolder"), BytesToReadableString(size));
|
return string.Format("{0} ({1})", _translater.GetTranslation("clearlogfolder"), BytesToReadableString(size));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -942,6 +1015,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
{
|
{
|
||||||
"GB", "MB", "KB", "B"
|
"GB", "MB", "KB", "B"
|
||||||
};
|
};
|
||||||
|
|
||||||
long max = (long)Math.Pow(scale, orders.Length - 1);
|
long max = (long)Math.Pow(scale, orders.Length - 1);
|
||||||
|
|
||||||
foreach (string order in orders)
|
foreach (string order in orders)
|
||||||
|
|
@ -951,6 +1025,7 @@ namespace Flow.Launcher.ViewModel
|
||||||
|
|
||||||
max /= scale;
|
max /= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "0 B";
|
return "0 B";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue