/// <summary> /// Closes the applications. /// </summary> /// <returns></returns> public bool CloseApplications(TopApplication application) { if (application == null) { application = _selectedApplication; } if (application != null) { foreach (SubApplication subApplication in application.SubItems) { Process[] procs = Process.GetProcessesByName(subApplication.Exe.Replace(".exe", "")); if (procs.Length > 0) { for (var i = 0; i < procs.Length; i++) { procs[i].CloseMainWindow(); } } if (subApplication.SubItems.Any()) { CloseApplications(subApplication); } } } return(true); }
/// <summary> /// Opens the applications. /// </summary> /// <param name="p">The p.</param> /// <returns></returns> private bool OpenApplications(TopApplication application, int count) { try { foreach (SubApplication subApplication in application.SubItems) { if (subApplication.IsSelected == true && subApplication.Exe != "") { LaunchApplication(ref count, subApplication); } if (subApplication.SubItems.Any()) { OpenApplications(subApplication, count); } } System.Threading.Thread.Sleep(2000 * count); return(true); } catch (Exception) { MessageBox.Show("Executable is missing from install directory.\n\nCheck the executable paths in the configuration XML file.", "Executable Missing", MessageBoxButton.OK, MessageBoxImage.Error); return(false); //throw; } }
private void GetAssociatedApplications() { // Only get associated applications if they haven't already been gathered (i.e. the selected tiles application collection is empty) // Update 17/07/15: Always gather applications incase application details have been edited //if (SelectedTile.Applications.Any() == false) //{ // Get all the associations associated with the selected item Messenger.Default.Send(new Message.M_GetAssociatedApplications(SelectedTile)); //} if (SelectedTile.Applications.Any()) { if (SelectedTile.Applications.Count == 1) { // Only one application is associated with the selected item. Pass the application details to the applications tab for display. TopApplication application = SelectedTile.Applications[0] as TopApplication; Messenger.Default.Send <GenericMessage <TopApplication> >(new GenericMessage <TopApplication>(application)); } else { DisplayTileTab(); DisplayApplicationsAsTiles(); } } else { DisplayTileTab(); } }
private void UpdateApplicationsCollection(GenericMessage <TopApplication> message) { DisplayApplicationsTab(); SelectedApplication = message.Content; ActiveApplicationCollection = new ObservableCollection <TopApplication>(message.Content.SubItems); }
private void btnTileMain_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; Project selectedProject = btn.DataContext as Project; if (selectedProject != null) { Messenger.Default.Send(new Message.M_ChangeSelectedTile(selectedProject, this)); } else { TopApplication selectedApplication = btn.DataContext as TopApplication; Messenger.Default.Send(new Message.M_ChangeSelectedTile(selectedApplication, this)); } }
private void UpdateSelectedApplication(GenericMessage <TopApplication> message) { _selectedApplication = message.Content; // If the select application only has one subapplication, & that subapplication only has one executable application, launch it if (_selectedApplication.SubItems.Count == 1) { SubApplication subApplication = _selectedApplication.SubItems[0]; if (subApplication.SubItems.Count == 1) { CloseOpenApplications(); } } Messenger.Default.Send(new Message.M_ChangeView(Message.M_ChangeView.ViewToSelect.DisplayApplicationsTab)); }
public void AddNewApplication() { if (SelectedApplication != null) { Class.SubApplication subApp = new SubApplication(); subApp.Setup("New App", "<path>", "<exe>", false, true, true, SelectedApplication.Name); SelectedApplication.SubItems.Add(subApp); SelectedApplication = subApp; } else { Class.TopApplication topApp = new TopApplication(); topApp.Setup("New Top App", true); ApplicationsCollection.Add(topApp); SelectedApplication = topApp; } }
/// <summary> /// Displays the context menus. Triggered by a right-click on a tile. /// </summary> /// <param name="msg">Message containing the grid control contained within tile that has been clicked.</param> public void DisplayContextMenus(Grid grid) { Project project = grid.DataContext as Project; if (project != null) { grid.ContextMenu.ItemsSource = project.CombinedContextMenuCollection; } else { TopApplication application = grid.DataContext as TopApplication; if (application != null) { grid.ContextMenu.ItemsSource = application.ContextMenuCollection; } } }
// Edit button click on tile private void btnTileEdit_Click(object sender, RoutedEventArgs e) { Button btn = (Button)sender; Project selectedProject = btn.DataContext as Project; if (selectedProject != null) { Messenger.Default.Send(new Message.M_EditTile(selectedProject, this)); } else { TopApplication selectedApplication = btn.DataContext as TopApplication; if (selectedApplication != null) { Messenger.Default.Send(new Message.M_ChangeView(Message.M_ChangeView.ViewToSelect.DisplayEditApplicationsTab)); } } }
public M_ChangeSelectedTile(TopApplication selectedApplication, object sender, bool resetBreadcrumb = false) { SelectedApplication = selectedApplication; Sender = sender; ResetBreadcrumb = resetBreadcrumb; }