private async Task Rescan(bool initial = false) { if (!initial) { SaveLaunchedCounts(entries); } LoadingIndicator.IsActive = true; InputText.IsEnabled = false; entries.Clear(); entries.AddRange(await StoreApp.FindAllStoreApps()); entries.AddRange(DesktopApp.FindAllDesktopApps()); entries.AddRange(UriLauncher.FindAllUriLaunchers()); entries.AddRange(LoadAliases(entries)); entries.Sort((x, y) => x.Name.CompareTo(y.Name)); LoadLaunchedCounts(entries); LoadingIndicator.IsActive = false; InputText.IsEnabled = true; InputText.Focus(); }
OptionsViewModel(Options options) { this.options = options; var modifiers = (ModifierKeys)options.HotKeyModifiers; Theme = options.Theme; Opacity = options.Opacity; HotKey = options.HotKeyCharacter; HotKeyControl = (modifiers & ModifierKeys.Control) == ModifierKeys.Control; HotKeyShift = (modifiers & ModifierKeys.Shift) == ModifierKeys.Shift; HotKeyAlt = (modifiers & ModifierKeys.Alt) == ModifierKeys.Alt; HotKeyWin = (modifiers & ModifierKeys.Windows) == ModifierKeys.Windows; LaunchAtLogin = options.LaunchAtLogin; Aliases = new ObservableCollection <AliasViewModel>(); if (options.Aliases != null) { foreach (var alias in options.Aliases) { Aliases.Add(new AliasViewModel(alias)); } } CustomURIs = new ObservableCollection <CustomURIViewModel>(); foreach (var uriLauncher in UriLauncher.FindAllUriLaunchers()) { CustomURIs.Add(new CustomURIViewModel(uriLauncher)); } var extraFolderViewModels = options.ExtraFoldersAndExtenstions .Where((t) => t.Item1.Length > 0 && Directory.Exists(t.Item1)) .Select((t) => new ExtraFolderViewModel(t.Item1, t.Item2)); ExtraFolders = new ObservableCollection <ExtraFolderViewModel>(extraFolderViewModels); }
public CustomURIViewModel(UriLauncher uriLauncher) { this.uriLauncher = uriLauncher; }
public CustomURIViewModel() { uriLauncher = new UriLauncher("", ""); }