private void AppsBoxUpdate(bool force) { if (force) { CacheData.CurrentAppInfo = default; } if (CacheData.CurrentAppInfo?.Any() != true) { return; } var selectedItem = string.Empty; if (appsBox.SelectedIndex >= 0) { selectedItem = appsBox.SelectedItem.ToString(); } appsBox.Items.Clear(); appsBox.Items.AddRange(CacheData.CurrentAppInfo.Select(x => x.Name).Cast <object>().ToArray()); if (appsBox.SelectedIndex < 0 && !string.IsNullOrWhiteSpace(Arguments.AppName)) { var appName = CacheData.FindAppData(Arguments.AppName).Key; if (string.IsNullOrWhiteSpace(appName) || !appsBox.Items.Contains(appName)) { appName = CacheData.FindAppData(Arguments.AppName).Name; } if (!string.IsNullOrWhiteSpace(appName) && appsBox.Items.Contains(appName)) { appsBox.SelectedItem = appName; } } if (appsBox.SelectedIndex < 0 && !string.IsNullOrWhiteSpace(Settings.LastItem) && appsBox.Items.Contains(Settings.LastItem)) { appsBox.SelectedItem = Settings.LastItem; } if (!string.IsNullOrWhiteSpace(selectedItem)) { appsBox.SelectedItem = selectedItem; } if (appsBox.SelectedIndex < 0) { appsBox.SelectedIndex = 0; } if (!Settings.StartMenuIntegration) { return; } var appNames = appsBox.Items.Cast <object>().Select(item => item.ToString()); SystemIntegration.UpdateStartMenuShortcuts(appNames); }
private void OpenWithForm_FormClosing(object sender, FormClosingEventArgs e) { Reg.RemoveSubKey(Settings.RegistryPath); if (!Settings.StartMenuIntegration) { return; } var appNames = appsBox.Items.Cast <string>(); SystemIntegration.UpdateStartMenuShortcuts(appNames); }
private void MenuViewForm_FormClosing(object sender, FormClosingEventArgs e) { PreventClosure = true; if (Opacity > 0) { Opacity = 0; } if (!Settings.StartMenuIntegration) { return; } try { var appNames = appsListView.Items.OfType <ListViewItem>().Select(x => x.Text).Where(x => !x.EqualsEx("Portable")); SystemIntegration.UpdateStartMenuShortcuts(appNames); } catch (Exception ex) when(ex.IsCaught()) { Log.Write(ex); } }