public IActionResult populateSubApplications() { using (var db = new FormsContext()) { if (db.LogDatas.Count() > 0) { return(BadRequest("DB already initalized")); } SubApplication subApplication1 = new SubApplication(); subApplication1.Id = Guid.NewGuid().ToString(); SubApplication subApplication2 = new SubApplication(); subApplication2.Id = Guid.NewGuid().ToString(); SubApplication subApplication3 = new SubApplication(); subApplication3.Id = Guid.NewGuid().ToString(); db.Add(subApplication1); db.Add(subApplication2); db.Add(subApplication3); db.SaveChanges(); return(Ok("DB Sub Applications Initialized")); } }
public void DisplayContextMenus(TextBlock tb) { // Triggered by a right-click on an application. SubApplication subApplication = (SubApplication)tb.DataContext; //GetSelectedApplication(applicationName); //ApplicationContextMenus = new ObservableCollection<MenuItem>(); // Send a message containing the project name to the main view model. The main view model returns the context // menu parameters as listed in the associations section Messenger.Default.Send(new NotificationMessageAction <string>(subApplication, subApplication.Name, (contextMenuParameters) => { //subApplication.CreateContextMenus(contextMenuParameters); })); tb.ContextMenu.ItemsSource = subApplication.ContextMenuCollection; }
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; } }
private void LaunchApplication(ref int i, SubApplication subApplication) { Process p; // Check if application is already open Process[] processName = Process.GetProcessesByName(subApplication.Exe.Replace(".exe", "")); try { if (processName.Length == 0) { p = new Process(); p.StartInfo.FileName = subApplication.InstallPath + subApplication.Exe; p.Start(); i += 1; } } catch (Win32Exception) { MessageBox.Show(subApplication.Name + " could not be started.\n\n- Check that application is installed correctly.\n- Check that the 'install path' in the configuration XML file is valid.", "Check Installation", MessageBoxButton.OK, MessageBoxImage.Error); //throw; } }