public void PinToTaskbarClickHandler(object sender, EventArgs eventArgs) { var clickedApp = Helper.GetApplicationViewModelFromContextMenuClick(sender); var clickedItem = (MenuItem)sender; //Item is checked at this point if when it was clicked it was NOT checked if (clickedItem.IsChecked && !ViewModel.PinnedApps.Contains(clickedApp)) { if (clickedApp.IsUnsupported) { clickedItem.IsChecked = false; _uiHelper.ShowMessage("Application cannot be pinned because it is unsupported"); } else { ViewModel.AddPinnedApp(clickedApp); AddButton(clickedApp); } } else { ViewModel.RemovePinnedApp(clickedApp); RemoveButton(clickedApp); } }
public static void AppButtonClick(object sender, RoutedEventArgs e) { try { var clickedApp = GetApplicationFromButtonSender(sender); //if the status is not active the application is disabled in the UI if ((clickedApp.Application.Status == DisplayStatus.Active) && !UnsupportedApps.IsUnsupported(clickedApp.Application)) { LaunchApp(clickedApp); } } catch (Exception ex) { Log.ErrorException("Exception executing onClick", ex); UiHelper.ShowMessage(ex.Message); } }
private TaskbarPanel CreateTaskbarPanel(MainViewModel mainViewModel, IUiHelper uiHelper) { try { var taskbarPanel = new TaskbarPanel(_mainWindowReadyLatch, new NLogLogger("TaskbarPanel"), mainViewModel, uiHelper); taskbarPanel.InitializeButtons(); return(taskbarPanel); } catch (Exception ex) { _log.ErrorException("Failed to initialize taskbar module", ex); uiHelper.ShowMessage(ex.ToString()); uiHelper.IgnoreException(_instanceMutex.ReleaseMutex); _instanceMutex = null; Current.Shutdown(); Environment.Exit(0); } return(null); }
private TaskbarPanel CreateTaskbarPanel(MainViewModel mainViewModel, IUiHelper uiHelper) { try { var taskbarPanel = new TaskbarPanel(_mainWindowReadyLatch, new NLogLogger("TaskbarPanel"), mainViewModel, uiHelper); taskbarPanel.InitializeButtons(); return taskbarPanel; } catch (Exception ex) { _log.ErrorException("Failed to initialize taskbar module", ex); uiHelper.ShowMessage(ex.ToString()); uiHelper.IgnoreException(_instanceMutex.ReleaseMutex); _instanceMutex = null; Current.Shutdown(); Environment.Exit(0); } return null; }