void HandlePeriodsClicked(object sender, EventArgs e) { string res, desc; List <string> periods; desc = Catalog.GetString("Game periods") + " (eg: 1 2 ex1 ex2) "; res = MessagesHelpers.QueryMessage(this, desc, "", String.Join(" ", Template.GamePeriods)); if (res == null) { return; } periods = new List <string> (res.Split(' ')); if (periods.Count == 0) { string msg = Catalog.GetString("Invalid content. Periods must be separated by spaces " + "(\"1 2 ex1 ex2\")"); MessagesHelpers.ErrorMessage(this, msg); } else { Template.GamePeriods = periods; periodsLabel.Text = String.Join(" - ", periods); } }
void HandleDeleteTeamClicked(object sender, EventArgs e) { if (loadedTeam != null) { if (loadedTeam.Static) { string msg = Catalog.GetString("System teams can't be deleted"); MessagesHelpers.WarningMessage(this, msg); return; } else { string msg = Catalog.GetString("Do you really want to delete the template: ") + loadedTeam.Name; if (MessagesHelpers.QuestionMessage(this, msg, null)) { provider.Delete(loadedTeam.Name); teams.Remove(ref selectedIter); templatesNames.Remove(loadedTeam.Name); selectedIter = TreeIter.Zero; teamseditortreeview.Selection.SelectPath(new TreePath("0")); HandleSelectionChanged(null, null); } } } }
protected virtual void OnDeleteButtonPressed(object sender, System.EventArgs e) { List <ProjectDescription> deletedProjects = new List <ProjectDescription>(); if (selectedProjects == null) { return; } foreach (ProjectDescription selectedProject in selectedProjects) { if (openedProject != null && selectedProject.File.FilePath == openedProject.Description.File.FilePath) { MessagesHelpers.WarningMessage(this, Catalog.GetString("This Project is actually in use.") + "\n" + Catalog.GetString("Close it first to allow its removal from the database")); continue; } var msg = Catalog.GetString("Do you really want to delete:") + "\n" + selectedProject.Title; if (MessagesHelpers.QuestionMessage(this, msg)) { DB.RemoveProject(selectedProject.UUID); deletedProjects.Add(selectedProject); } } projectlistwidget1.RemoveProjects(deletedProjects); Clear(); }
public Task <bool> NewVersionAvailable(Version currentVersion, Version latestVersion, string downloadURL, string changeLog, object parent = null) { bool res = MessagesHelpers.NewVersionAvailable(currentVersion, latestVersion, downloadURL, changeLog, GetParentWidget(parent)); return(AsyncHelpers.Return(res)); }
protected override void OnExportbuttonClicked(object sender, System.EventArgs e) { EntryDialog dialog = new EntryDialog(); dialog.TransientFor = (Gtk.Window) this.Toplevel; dialog.ShowCount = false; dialog.Text = Catalog.GetString("New template"); if (dialog.Run() == (int)ResponseType.Ok) { if (dialog.Text == "") { MessagesHelpers.ErrorMessage(dialog, Catalog.GetString("The template name is void.")); } else if (provider.Exists(dialog.Text)) { var msg = Catalog.GetString("The template already exists. " + "Do you want to overwrite it ?"); if (MessagesHelpers.QuestionMessage(this, msg)) { Template.Name = dialog.Text; provider.Update(Template); } } else { Template.Name = dialog.Text; provider.Save(Template); } } dialog.Destroy(); }
protected override void RemoveSelected() { if (Project != null) { var msg = Catalog.GetString("You are about to delete a player and all " + "its tags. Do you want to proceed?"); if (MessagesHelpers.QuestionMessage(this, msg)) { try { foreach (var player in selected) { Project.RemovePlayer(template, player); } } catch { MessagesHelpers.WarningMessage(this, Catalog.GetString("A template needs at least one category")); } } } else { try { foreach (var player in selected) { Template.Remove(player); } } catch { MessagesHelpers.WarningMessage(this, Catalog.GetString("A template needs at least one category")); } } base.RemoveSelected(); }
protected void OnDelbuttonClicked(object sender, System.EventArgs e) { TreeIter iter; IDatabase db; treeview.Selection.GetSelected(out iter); db = store.GetValue(iter, 0) as IDatabase; if (db == manager.ActiveDB) { var msg = Catalog.GetString("This database is the active one and can't be deleted"); MessagesHelpers.ErrorMessage(this, msg); return; } if (db != null) { var msg = Catalog.GetString("Do you really want to delete the database: " + db.Name); if (MessagesHelpers.QuestionMessage(this, msg)) { db.Backup(); manager.Delete(db); store.Remove(ref iter); } } }
protected virtual void OnMultimediaError(object o, string message) { MessagesHelpers.ErrorMessage(this, Catalog.GetString("The following error happened and" + " the current project will be closed:") + "\n" + message); EmitCloseOpenedProject(true); }
protected override void RemoveSelected() { if (Project != null) { var msg = Catalog.GetString("You are about to delete a category and all the plays added to this category. Do you want to proceed?"); if (MessagesHelpers.QuestionMessage(this, msg)) { try { foreach (var cat in selected) { Project.RemoveCategory(cat); } } catch { MessagesHelpers.WarningMessage(this, Catalog.GetString("A template needs at least one category")); } } } else { foreach (Category cat in selected) { if (template.Count == 1) { MessagesHelpers.WarningMessage(this, Catalog.GetString("A template needs at least one category")); } else { template.Remove(cat); } } } base.RemoveSelected(); }
private static void ProcessExecutionError(Exception ex) { string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now + ".log"; string message; logFile = logFile.Replace("/", "-"); logFile = logFile.Replace(" ", "-"); logFile = logFile.Replace(":", "-"); logFile = System.IO.Path.Combine(Config.HomeDir, logFile); message = SysInfo.PrintInfo(Assembly.GetExecutingAssembly().GetName().Version); if (ex.InnerException != null) { message += String.Format("{0}\n{1}\n{2}\n{3}\n{4}", ex.Message, ex.InnerException.Message, ex.Source, ex.StackTrace, ex.InnerException.StackTrace); } else { message += String.Format("{0}\n{1}\n{2}", ex.Message, ex.Source, ex.StackTrace); } using (StreamWriter s = new StreamWriter(logFile)) { s.WriteLine(message); s.WriteLine("\n\n\nStackTrace:"); s.WriteLine(System.Environment.StackTrace); } Log.Exception(ex); //TODO Add bug reports link MessagesHelpers.ErrorMessage(null, Catalog.GetString("The application has finished with an unexpected error.") + "\n" + Catalog.GetString("A log has been saved at: ") + logFile + "\n" + Catalog.GetString("Please, fill a bug report ")); Application.Quit(); }
public void WarningMessage(string message, object parent = null) { if (parent == null) { parent = mainWindow as Widget; } MessagesHelpers.WarningMessage(parent as Widget, message); }
public void ErrorMessage(string message, Widget parent = null) { if (parent == null) { parent = mainWindow as Widget; } MessagesHelpers.ErrorMessage(parent, message); }
public bool QuestionMessage(string question, string title, object parent = null) { if (parent == null) { parent = mainWindow as Widget; } return(MessagesHelpers.QuestionMessage(parent as Widget, question, title)); }
public string QueryMessage(string key, string title = null, string value = "", object parent = null) { if (parent == null) { parent = mainWindow; } return(MessagesHelpers.QueryMessage(parent as Widget, key, title, value)); }
void HandleCloseClicked(object sender, EventArgs e) { string msg = Catalog.GetString("Do you want to close and cancel the current capture?"); if (MessagesHelpers.QuestionMessage(this, msg)) { Config.EventsBroker.EmitCaptureFinished(true); } }
void HandleClearClicked(object sender, EventArgs e) { string msg = Catalog.GetString("Do you want to clear the drawing?"); if (MessagesHelpers.QuestionMessage(this, msg)) { blackboard.Clear(); } }
void Clear() { string msg = Catalog.GetString("Do you want to clear the drawing?"); if (MessagesHelpers.QuestionMessage(this, msg)) { blackboard.Clear(); } }
private void PromptToSaveEditedProject() { var msg = Catalog.GetString("The Project has been edited, do you want to save the changes?"); if (MessagesHelpers.QuestionMessage(this, msg)) { SaveProject(); projectdetails.Edited = false; } }
public bool NewVersionAvailable(Version currentVersion, Version latestVersion, string downloadURL, string changeLog, object parent = null) { if (parent == null) { parent = mainWindow; } return(MessagesHelpers.NewVersionAvailable(currentVersion, latestVersion, downloadURL, changeLog, parent as Widget)); }
void HandleDeleteEvent(object o, DeleteEventArgs args) { string msg = Catalog.GetString("Do you want to close the current drawing?"); if (MessagesHelpers.QuestionMessage(this, msg)) { args.RetVal = false; } else { args.RetVal = true; } }
void HandleCloseClicked(object sender, EventArgs e) { string msg = Catalog.GetString("Do you want to close and cancel the current capture?"); if (MessagesHelpers.QuestionMessage(this, msg)) { App.Current.EventsBroker.Publish <CaptureFinishedEvent> ( new CaptureFinishedEvent { Cancel = true, Reopen = false } ); } }
protected virtual void OnSubcategoriesDeleted(List <ISubCategory> subcats) { if (Project != null) { var msg = Catalog.GetString("If you delete this subcategory you will loose" + "all the tags associated with it. Do you want to proceed?"); if (!MessagesHelpers.QuestionMessage(this, msg)) { return; } Project.DeleteSubcategoryTags(Category, subcats); } Category.SubCategories.RemoveAll(s => subcats.Contains(s)); }
protected virtual void OnHotKeyChanged(HotKey prevHotKey, Category category) { if (hkList.Contains(category.HotKey)) { MessagesHelpers.WarningMessage(this, Catalog.GetString("This hotkey is already in use.")); category.HotKey = prevHotKey; timenodeproperties2.Category = category; //Update Gui } else if (category.HotKey.Defined) { hkList.Remove(prevHotKey); hkList.Add(category.HotKey); } }
protected virtual void OnProjectlistwidget1ProjectsSelected(List <ProjectDescription> projects) { ProjectDescription project; /* prompt tp save the opened project if has changes */ if (projectdetails.Edited) { PromptToSaveEditedProject(); } selectedProjects = projects; /* if no projects are selected clear everything */ if (projects.Count == 0) { Clear(); return; /* if more than one project is selected clear everything but keep * the delete button and the export button sensitives */ } else if (projects.Count > 1) { Clear(); deleteButton.Sensitive = true; exportbutton.Sensitive = true; return; } /* if only one project is selected try to load it in the editor */ project = projects[0]; if (openedProject != null && project.File.FilePath == openedProject.Description.File.FilePath) { MessagesHelpers.WarningMessage(this, Catalog.GetString("The Project you are trying to load is actually in use.") + "\n" + Catalog.GetString("Close it first to edit it")); Clear(); } else { projectdetails.Sensitive = true; projectdetails.SetProject(DB.GetProject(project.UUID)); saveButton.Sensitive = false; deleteButton.Sensitive = true; exportbutton.Sensitive = true; } }
void HandleDeleteTemplateClicked(object sender, EventArgs e) { if (loadedTemplate != null) { string msg = Catalog.GetString("Do you really want to delete the dashboard: ") + loadedTemplate.Name; if (MessagesHelpers.QuestionMessage(this, msg, null)) { provider.Delete(loadedTemplate.Name); templates.Remove(ref selectedIter); templatesNames.Remove(loadedTemplate.Name); selectedIter = TreeIter.Zero; dashboardseditortreeview.Selection.SelectPath(new TreePath("0")); HandleSelectionChanged(null, null); } } }
protected void OnBackupbuttonClicked(object sender, System.EventArgs e) { IDatabase db = SelectedDB; if (db != null) { if (db.Backup()) { MessagesHelpers.InfoMessage(this, Catalog.GetString("Backup successfull")); } else { MessagesHelpers.ErrorMessage(this, Catalog.GetString("Could not create backup")); } } }
protected void OnDeleteKeyFrame(object obj, EventArgs args) { var msg = Catalog.GetString("Do you want to delete the key frame for this play?"); if (MessagesHelpers.QuestionMessage(Toplevel, msg)) { TreePath[] paths = Selection.GetSelectedRows(); for (int i = 0; i < paths.Length; i++) { Play tNode = (Play)GetValueFromPath(paths[i]); tNode.Drawings.Clear(); } // Refresh the thumbnails QueueDraw(); } }
private static void ProcessExecutionError(Exception ex) { string logFile = Constants.SOFTWARE_NAME + "-" + DateTime.Now + ".log"; logFile = Utils.SanitizePath(logFile, ' ', ':'); logFile = Path.Combine(Config.HomeDir, logFile); Log.Information(SysInfo.PrintInfo(Assembly.GetExecutingAssembly().GetName().Version)); Log.Exception(ex); File.Copy(Config.LogFile, logFile); //TODO Add bug reports link MessagesHelpers.ErrorMessage(null, Catalog.GetString("The application has finished with an unexpected error.") + "\n" + Catalog.GetString("A log has been saved at: ") + logFile + "\n" + Catalog.GetString("Please, fill a bug report ")); Application.Quit(); }
void DeviceChanged(int deviceID) { string msg; /* device disconnected, pause capture */ if (deviceID == -1) { PausePeriod(); msg = Catalog.GetString("Device disconnected. " + "The capture will be paused"); MessagesHelpers.WarningMessage(this, msg); } else { msg = Catalog.GetString("Device reconnected. " + "Do you want to restart the capture?"); if (MessagesHelpers.QuestionMessage(this, msg, null)) { ResumePeriod(); } } }
void HandleDeleteClicked(object sender, EventArgs e) { List <ProjectDescription> deletedProjects; if (selectedProjects == null) { return; } deletedProjects = new List <ProjectDescription> (); foreach (ProjectDescription selectedProject in selectedProjects) { if (openedProject != null && openedProject.ID == selectedProject.ProjectID) { MessagesHelpers.WarningMessage(this, Catalog.GetString("This Project is actually in use.") + "\n" + Catalog.GetString("Close it first to allow its removal from the database")); continue; } string msg = Catalog.GetString("Do you really want to delete:") + "\n" + selectedProject.Title; if (MessagesHelpers.QuestionMessage(this, msg)) { // Unload first if (loadedProject != null && loadedProject.ID == selectedProject.ProjectID) { loadedProject = null; } DB.RemoveProject(selectedProject.ProjectID); deletedProjects.Add(selectedProject); } } projectlistwidget1.RemoveProjects(deletedProjects); // In the case where there are no projects left we need to clear the project desc widget if (DB.GetAllProjects().Count == 0) { rbox.Visible = false; } }