static private void ShowMsg(Gtk.Window main, string title, string txt, Gtk.MessageType type) { var dlg = new Gtk.MessageDialog( main, Gtk.DialogFlags.Modal, type, Gtk.ButtonsType.Ok, title ); dlg.Text = txt; dlg.Title = title; if (type == Gtk.MessageType.Error) { dlg.Title += " Error"; } else { dlg.Title += " Information"; } dlg.Run(); dlg.Destroy(); }
void on_okButton_clicked(object o, EventArgs args) { if (Core.Settings.KeyEncrypted && !Core.Settings.CheckKeyPassword(oldPasswordEntry.Text)) { Gui.ShowErrorDialog("Old password incorrect"); oldPasswordEntry.GrabFocus(); return; } if (newPasswordEntry.Text != confirmPasswordEntry.Text) { Gui.ShowErrorDialog("New passwords do not match"); newPasswordEntry.GrabFocus(); return; } if (newPasswordEntry.Text == String.Empty) { var dialog = new Gtk.MessageDialog(base.Window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, "Are you sure you don't want to set a password?"); dialog.Show(); int r = dialog.Run(); dialog.Destroy(); if (r != (int)Gtk.ResponseType.Yes) { return; } } Core.Settings.ChangeKeyPassword(newPasswordEntry.Text); if (!Core.Settings.FirstRun) Gui.ShowMessageDialog("Your password has been changed."); Dialog.Respond(Gtk.ResponseType.Ok); }
protected void OnButtonOkClicked(object sender, EventArgs e) { try { if (cat != null) { int id = GetId(cat, idEntry.Text); string name = GetName(nameEntry.Text); doc = new Document(cat, id, name, dateCalendar.Date); cat.Add(doc); this.Respond(Gtk.ResponseType.Ok); } else { throw new Exception("You must select a category"); } } catch (Exception ex) { Gtk.MessageDialog msg = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, true, String.Format(ex.Message.ToString())); if ((Gtk.ResponseType)msg.Run() == Gtk.ResponseType.Close) { msg.Destroy(); } } }
public static void Run(string file) { ICompiler[] compilers = (ICompiler[])AddinManager.GetExtensionObjects(typeof(ICompiler)); ICompiler compiler = null; foreach (ICompiler comp in compilers) { if (comp.CanCompile(file)) { compiler = comp; break; } } if (compiler == null) { string msg = "No compiler available for this kind of file."; Gtk.MessageDialog dlg = new Gtk.MessageDialog(TextEditorApp.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg); dlg.Run(); dlg.Destroy(); return; } string messages = compiler.Compile(file, file + ".exe"); TextEditorApp.MainWindow.ConsoleWrite("Compilation finished.\n"); TextEditorApp.MainWindow.ConsoleWrite(messages); }
public BattleSession() { this.coreAbilities = new List<AbilityDefinition>(8); this.coreAbilities.Add(AbilityDefinition.Charisma); this.coreAbilities.Add(AbilityDefinition.Logic); this.coreAbilities.Add(AbilityDefinition.Perception); this.coreAbilities.Add(AbilityDefinition.Power); this.coreAbilities.Add(AbilityDefinition.Speed); this.coreAbilities.Add(AbilityDefinition.Stamina); this.coreAbilities.Add(AbilityDefinition.Strength); this.coreAbilities.Add(AbilityDefinition.Willpower); try { this.origins = new List<OriginDefinition>(); this.origins = Battle.Data.Storage.LoadOrigins("Data/origins.xml"); this.species = new List<SpeciesDefinition>(); this.species = Battle.Data.Storage.LoadSpecies("Data/species.xml"); this.skills = new List<SkillDefinition>(); this.skills = Battle.Data.Storage.LoadSkills("Data/skills.xml"); this.powerSources = new List<PowerSource>(); this.powerSources = Battle.Data.Storage.LoadPowerSources("Data/powersources.xml"); this.powers = new List<PowerDefinition>(); this.powers = Battle.Data.Storage.LoadPowers("Data/powers.xml"); } catch (Exception exp) { Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "{0}: {1}", exp.GetType().ToString(), exp.Message); dlg.Run(); } }
protected virtual void OnRemoveButtonClicked(object sender, System.EventArgs e) { Trace.Call(sender, e); try { Gtk.TreeIter iter; if (!f_TreeView.Selection.GetSelected(out iter)) { return; } Gtk.MessageDialog md = new Gtk.MessageDialog( f_Parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, _("Are you sure you want to delete the selected filter?") ); int result = md.Run(); md.Destroy(); if (result != (int)Gtk.ResponseType.Yes) { return; } f_ListStore.Remove(ref iter); OnChanged(EventArgs.Empty); } catch (Exception ex) { Frontend.ShowException(ex); } }
public BattleSession() { this.coreAbilities = new List <AbilityDefinition>(8); this.coreAbilities.Add(AbilityDefinition.Charisma); this.coreAbilities.Add(AbilityDefinition.Logic); this.coreAbilities.Add(AbilityDefinition.Perception); this.coreAbilities.Add(AbilityDefinition.Power); this.coreAbilities.Add(AbilityDefinition.Speed); this.coreAbilities.Add(AbilityDefinition.Stamina); this.coreAbilities.Add(AbilityDefinition.Strength); this.coreAbilities.Add(AbilityDefinition.Willpower); try { this.origins = new List <OriginDefinition>(); this.origins = Battle.Data.Storage.LoadOrigins("Data/origins.xml"); this.species = new List <SpeciesDefinition>(); this.species = Battle.Data.Storage.LoadSpecies("Data/species.xml"); this.skills = new List <SkillDefinition>(); this.skills = Battle.Data.Storage.LoadSkills("Data/skills.xml"); this.powerSources = new List <PowerSource>(); this.powerSources = Battle.Data.Storage.LoadPowerSources("Data/powersources.xml"); this.powers = new List <PowerDefinition>(); this.powers = Battle.Data.Storage.LoadPowers("Data/powers.xml"); } catch (Exception exp) { Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "{0}: {1}", exp.GetType().ToString(), exp.Message); dlg.Run(); } }
// uses reflection to call the corresponding method in the "Create" class. public static UML.Element CreateUmlElement(string elementType) { Type create = typeof(UML.Create); object newElement = create.InvokeMember( elementType, BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Static, null, null, null); UML.NamedElement ne = newElement as UML.NamedElement; if(ne != null) { _dialog = new Gtk.MessageDialog( null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.Ok, GettextCatalog.GetString ("New element name:")); Gtk.Entry elementName = new Gtk.Entry(); elementName.Activated += new EventHandler(CloseNewElementNameModal); _dialog.VBox.Add(elementName); elementName.Show(); _dialog.Run(); ne.Name = String.Format(elementName.Text, elementType); _dialog.Destroy(); _dialog = null; } return (UML.Element)newElement; }
private void GuardarMensaje(string fecha, string nombre, string mensaje) { cnx.Open(); try { if (nombre == "") { string g_ser = "INSERT INTO CONVERSACION (FECHA, NOMBRE, MENSAJE) VALUES (@fecha,'Servidor',@mensaje);"; SQLiteCommand cmd = new SQLiteCommand(g_ser, cnx); cmd.Parameters.Add(new SQLiteParameter("@fecha", fecha)); cmd.Parameters.Add(new SQLiteParameter("@mensaje", mensaje)); cmd.ExecuteNonQuery(); } else { string g_c = "INSERT INTO CONVERSACION (FECHA, NOMBRE, MENSAJE) VALUES (@fecha, @nombre,@mensaje);"; SQLiteCommand cmd = new SQLiteCommand(g_c, cnx); cmd.Parameters.Add(new SQLiteParameter("@fecha", fecha)); cmd.Parameters.Add(new SQLiteParameter("@nombre", nombre)); cmd.Parameters.Add(new SQLiteParameter("@mensaje", mensaje)); cmd.ExecuteNonQuery(); } } catch (Exception e) { Gtk.MessageDialog msg = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, "No se pudo guardar el mensaje"); msg.Title = "Error al Guardar"; msg.Run(); msg.Destroy(); } cnx.Close(); }
public static void ShowError(Gtk.Window parent, string msg, Exception ex) { Trace.Call(parent, msg, ex != null ? ex.GetType() : null); if (!IsGuiThread()) { Gtk.Application.Invoke(delegate { ShowError(parent, msg, ex); }); return; } if (ex != null) { #if LOG4NET _Logger.Error("ShowError(): Exception: ", ex); #endif msg += "\n" + String.Format(_("Cause: {0}"), ex.Message); } if (parent == null) { parent = _MainWindow; } Gtk.MessageDialog md = new Gtk.MessageDialog( parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, false, msg ); md.Run(); md.Destroy(); }
public virtual void Remove(ServerModel server) { Trace.Call(server); if (server == null) { throw new ArgumentNullException("server"); } Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, _("Are you sure you want to delete the selected server?")); int result = md.Run(); md.Destroy(); if (result != (int)Gtk.ResponseType.Yes) { return; } _Controller.RemoveServer(server.Protocol, server.ServerID); _Controller.Save(); // refresh the view Load(); }
public DialogResult ShowDialog(Control parent, MessageBoxButtons buttons) { Gtk.Widget c = (parent == null) ? null : (Gtk.Widget)parent.ControlObject; while (!(c is Gtk.Window) && c != null) { c = c.Parent; } control = new Gtk.MessageDialog((Gtk.Window)c, Gtk.DialogFlags.Modal, Convert(Type), Convert(buttons), false, Text); control.TypeHint = Gdk.WindowTypeHint.Dialog; var caption = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null); if (!string.IsNullOrEmpty(caption)) { control.Title = caption; } if (buttons == MessageBoxButtons.YesNoCancel) { // must add cancel manually Gtk.Button b = (Gtk.Button)control.AddButton(Gtk.Stock.Cancel, (int)Gtk.ResponseType.Cancel); b.UseStock = true; } int ret = control.Run(); control.Destroy(); return(Generator.Convert((Gtk.ResponseType)ret)); }
private void AddToRoster(String name) { name = name.Split('\t')[0]; name = name.Trim(); if (_autoComplete.GetPosterId(name, (String poster, int id) => { if (id > 0) { AddConfirmedPoster(poster); } else { String err = String.Format("\"{0}\" is not a poster. Check the spelling.", poster); Gtk.MessageDialog msg = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, err); msg.Run(); msg.Destroy(); } } ) > 0) { AddConfirmedPoster(name); } }
private static OSMessageBoxResult PlatformShowCore(string message, string title, System.Exception exception, OSMessageBoxButton buttons, Dictionary <OSMessageBoxButton, string> customButtonLabels, OSMessageBoxIcon icon, OSMessageBoxResult defaultResult, System.Action <OSMessageBoxResult> onComplete) { var result = OSMessageBoxResult.None; if (onComplete == null) { INTV.Shared.Utility.OSDispatcher.Current.InvokeOnMainDispatcher(() => { var nativeButtons = Gtk.ButtonsType.Ok; switch (buttons) { case OSMessageBoxButton.OK: case OSMessageBoxButton.YesNo: nativeButtons = (Gtk.ButtonsType)buttons; break; case OSMessageBoxButton.YesNoCancel: nativeButtons = Gtk.ButtonsType.None; // we'll add buttons below break; } var parent = Gtk.Window.ListToplevels().FirstOrDefault(w => w.IsActive || w.IsFocus); if (parent == null) { parent = INTV.Shared.Utility.SingleInstanceApplication.Instance.MainWindow; } using (var messageBox = new Gtk.MessageDialog(parent, Gtk.DialogFlags.Modal, (Gtk.MessageType)icon, nativeButtons, "{0}", message)) { messageBox.Title = title; messageBox.MessageType = (Gtk.MessageType)icon; messageBox.DefaultResponse = (Gtk.ResponseType)defaultResult; switch (buttons) { case OSMessageBoxButton.OK: case OSMessageBoxButton.YesNo: break; case OSMessageBoxButton.YesNoCancel: messageBox.AddButton(Resources.Strings.YesButton_Text, Gtk.ResponseType.Yes); messageBox.AddButton(Resources.Strings.NoButton_Text, Gtk.ResponseType.No); messageBox.AddButton(Resources.Strings.CancelButtonText, Gtk.ResponseType.Cancel); break; } result = (OSMessageBoxResult)messageBox.Run(); VisualHelpers.Close(messageBox); } }); } else { INTV.Shared.Utility.SingleInstanceApplication.MainThreadDispatcher.BeginInvoke(() => { result = ShowCore(message, title, exception, null, buttons, customButtonLabels, icon, defaultResult, null); onComplete(result); }); } return(result); }
static void ShowDialog(string title, string message, Gtk.MessageType msgType, Gtk.ButtonsType btnType) { Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, msgType, btnType, message); md.Title = title; md.Run(); md.Destroy(); }
/// <summary> /// Saves a temporary pdf to be used in the viewer. /// </summary> /// <param name='report'> /// Report. /// </param> /// <param name='FileName'> /// File name. /// </param> private void ExportReport(Report report, string FileName, OutputPresentationType exportType) { OneFileStreamGen sg = null; try { sg = new OneFileStreamGen(FileName, true); report.RunRender(sg, exportType); } catch (Exception ex) { Gtk.MessageDialog m = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, false, ex.Message); m.Run(); m.Destroy(); } finally { if (sg != null) { sg.CloseMainStream(); } } return; }
public MainClass(bool debug, string appName) { GLibLogging.Enabled = true; Assembly exe = typeof (MainClass).Assembly; string configDir = Path.GetFullPath (Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData), appName)); string lockFile = Path.Combine (configDir, "pid.lock"); bool instanceRunning = DetectInstances (lockFile, appName); if (instanceRunning) { Gtk.Application.Init (); Gtk.MessageDialog md = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.Close, GettextCatalog.GetString ("An instance of StrongMonkey with configuration profile '{0}' is already running.{1}If you really want to run 2 seperate instances, use the \"--appName=StrongMonkeyXXX\" command line parameter", appName, Environment.NewLine)); md.Run (); md.Destroy (); md.Dispose (); md.Close += delegate(object sender, EventArgs e) { Gtk.Application.Quit (); }; Gtk.Application.Run (); } else { CoreUtility.Initialize (exe, appName, debug); WriteInstancePid (lockFile); AddinUtility.Initialize (); } }
public static void Load() { try { SetDefaultValues(); using (FileStream stream = new FileStream(SettingsPath, FileMode.Open)) { BinaryFormatter bin = new BinaryFormatter(); HelperClass hc = (HelperClass)bin.Deserialize(stream); hc.PushValues(); } } catch (Exception ex) { Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, "Couldn´t read Settings!" + Environment.NewLine + ex.Message); md.Title = "Error"; md.AddButton("Restore Settings?", Gtk.ResponseType.Yes); Gtk.ResponseType result = (Gtk.ResponseType)md.Run(); md.Destroy(); if (result == Gtk.ResponseType.Yes) { Recreate(); } } }
public void FinishChangeDatabase(bool success) { BooruApp.BooruApplication.TaskRunner.StartTaskMainThread("FinishChangeDatabase", () => { if (success) { // fire event if (this.DatabaseLoadSucceeded != null) { this.DatabaseLoadSucceeded(); } } else { // show error message var dlg = new Gtk.MessageDialog(BooruApp.BooruApplication.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, "Could not open database"); dlg.Run(); dlg.Destroy(); // clear last used database BooruApp.BooruApplication.Settings.Set("last_used_db", null); // fire event if (this.DatabaseLoadFailed != null) { this.DatabaseLoadFailed(); } } }); }
// Directly use OS-specific dialog. The fancier OSMessageBox may cause a crash if we report a crash while we're reporting a crash. Because of its fancy fanciness. private static void PlatformPanic(string message, string title) { using (var dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, "{0}", message)) { dialog.Title = title; dialog.Run(); } }
/// <summary> /// Shows message box using GTK. /// </summary> /// <param name='msg'> /// The message. /// </param> private void ShowMessageGtk(string msg) { var msgBox = new Gtk.MessageDialog(mainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, msg); msgBox.Run(); msgBox.Destroy(); }
public DialogResult ShowDialog(Control parent) { Gtk.Window parentWindow = null; if (parent != null && parent.ParentWindow != null) { parentWindow = parent.ParentWindow.ControlObject as Gtk.Window; } control = new Gtk.MessageDialog(parentWindow, Gtk.DialogFlags.Modal, Type.ToGtk(), Buttons.ToGtk(), false, string.Empty); control.Text = Text; control.TypeHint = Gdk.WindowTypeHint.Dialog; var caption = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null); if (!string.IsNullOrEmpty(caption)) { control.Title = caption; } // must add buttons manually for this case if (Buttons == MessageBoxButtons.YesNoCancel) { var bn = (Gtk.Button)control.AddButton(Gtk.Stock.No, (int)Gtk.ResponseType.No); bn.UseStock = true; var bc = (Gtk.Button)control.AddButton(Gtk.Stock.Cancel, (int)Gtk.ResponseType.Cancel); bc.UseStock = true; var by = (Gtk.Button)control.AddButton(Gtk.Stock.Yes, (int)Gtk.ResponseType.Yes); by.UseStock = true; } control.DefaultResponse = DefaultButton.ToGtk(Buttons); int ret = control.Run(); control.Hide(); #if GTKCORE control.Dispose(); #else control.Destroy(); #endif var result = ((Gtk.ResponseType)ret).ToEto(); if (result == DialogResult.None) { switch (Buttons) { case MessageBoxButtons.OK: result = DialogResult.Ok; break; case MessageBoxButtons.YesNo: result = DialogResult.No; break; case MessageBoxButtons.OKCancel: case MessageBoxButtons.YesNoCancel: result = DialogResult.Cancel; break; } } return(result); }
/// <summary> /// Shows an error dialog if we were unable to load the libwebp library. /// </summary> /// <param name="parent">The parent window for the dialog that will be shown.</param> public static void ShowErrorDialog(Gtk.Window parent) { var dialog = new Gtk.MessageDialog(parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, AddinManager.CurrentLocalizer.GetString("Could not find an installed WebP library.")); dialog.Title = AddinManager.CurrentLocalizer.GetString("Error"); dialog.Run(); dialog.Destroy(); }
void ShowErrorMessage(string msg) { Gtk.MessageDialog md = new Gtk.MessageDialog (null , Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg, new object [] {}); md.Run (); md.Destroy (); }
internal void ShowMessageDialog(string message, string title, Gtk.ButtonsType buttonsType, Gtk.MessageType messageType) { Gtk.MessageDialog dlg = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, messageType, buttonsType, message); dlg.Title = title; dlg.Run(); dlg.Destroy(); }
void ShowErrorMessage(string msg) { Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg, new object [] {}); md.Run(); md.Destroy(); }
// Message box void MessageBox(string msg, bool info = true) { var mb = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, info ? Gtk.MessageType.Info : Gtk.MessageType.Error, info ? Gtk.ButtonsType.Ok : Gtk.ButtonsType.Close, msg); mb.Run(); mb.Destroy(); }
protected override void ShowErrorDialog(string msg, bool isFatal) { // show the error dialog using (var dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, isFatal ? Gtk.MessageType.Error : Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, null)) { dlg.Title = Program.Settings.Target; dlg.Text = msg; dlg.Run(); dlg.Hide(); } }
private void CalibrateWiimote() { IWiimote wiimote = (IWiimote)Device; ReportingMode oldReportingMode = wiimote.ReportingMode; wiimote.SetReportingMode(ReportingMode.ButtonsAccelerometer); AccelerometerAxes <ushort> raw = wiimote.Accelerometer.Raw; Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.OkCancel, false, "Place the wiimote on a table.", new object[0]); if (dialog.Run() == -5) { ushort xZero, yZero, zZero, xOne, yOne, zOne = 0; xZero = raw.X; yZero = raw.Y; zOne = raw.Z; dialog.Markup = "Place the wiimote on its left side."; if (dialog.Run() == -5) { xOne = raw.X; zZero = raw.Z; // Invert zOne (so that the values are negated). zOne = (ushort)(zZero - (zOne - zZero)); dialog.Markup = "Place the wiimote on its lower side, so that it points up."; if (dialog.Run() == -5) { yOne = raw.Y; wiimote.WriteMemory(0x16, new byte[] { (byte)xZero, (byte)yZero, (byte)zZero, 0, (byte)xOne, (byte)yOne, (byte)zOne, 0 }, 0, 8); wiimote.Initialize(); } } } dialog.Destroy(); wiimote.SetReportingMode(oldReportingMode); }
public static void ShowWarningMessage(Gtk.Window parentWin, string format, params object[] args) { Gtk.MessageDialog md = new Gtk.MessageDialog(parentWin, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, format, args); md.Title = Catalog.GetString("Warning"); md.Run(); md.Destroy(); }
public static void Warning(Gtk.Window window, string Message, string Title) { Gtk.MessageDialog md = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.Ok, Message, new string[] {}); md.Title = Title; md.Run(); md.Destroy(); }
private void DoCancel() { m_parser.Cancel = true; this.Hide(); String message = Catalog.GetString("Import cancelled, all changes reverted."); Gtk.MessageDialog dlg = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, message); dlg.Run(); dlg.Hide(); dlg.Dispose(); }
public static void ShowInfo(Gtk.Window parent, string message) { var dialog = new Gtk.MessageDialog(parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, message); dialog.Run(); dialog.Destroy(); }
void Delete(ActionMenuItem menuItem) { string msg = string.Format(Catalog.GetString("Are you sure you want to delete the action '{0}'? It will be removed from all menus and toolbars."), menuItem.Node.Action.Name); Gtk.MessageDialog md = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, msg); if (md.Run() == (int)Gtk.ResponseType.Yes) { menuItem.Node.Action.Delete(); darea.SetSelection(null, null); } md.Destroy(); }
private void _OnActivated(object sender, EventArgs e) { Trace.Call(sender, e); try { if (!(Text.Length > 0)) { return; } if (Text.IndexOf("\n") != -1) { // seems to be a paste, so let's break it apart string[] msgParts = Text.Split(new char[] { '\n' }); if (msgParts.Length > 3) { string msg = String.Format(_("You are going to paste {0} lines. Do you want to continue?"), msgParts.Length); Gtk.MessageDialog md = new Gtk.MessageDialog( Frontend.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, msg); Gtk.ResponseType res = (Gtk.ResponseType)md.Run(); md.Destroy(); if (res != Gtk.ResponseType.Yes) { Text = String.Empty; return; } } foreach (string msg in msgParts) { ExecuteCommand(msg); } } else { ExecuteCommand(Text); AddToHistory(Text, _History.Count - _HistoryPosition); // reset history position to last entry _HistoryPosition = _History.Count - 1; } Text = String.Empty; } catch (Exception ex) { #if LOG4NET _Logger.Error(ex); #endif Frontend.ShowException(null, ex); } }
bool HandleOverrideConfirmation (String name) { Gtk.MessageDialog dialog = new Gtk.MessageDialog(this.Toplevel as Gtk.Window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, name + Mono.Unix.Catalog.GetString(" already exists.\n Do you want to override it?")); dialog.Modal = true; Gtk.ResponseType result = (Gtk.ResponseType)dialog.Run(); dialog.Destroy (); return result == Gtk.ResponseType.Yes; }
public static bool Question(Gtk.Window window, string Message, string Title) { Gtk.MessageDialog md = new Gtk.MessageDialog(window, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, Message, new string[] {}); md.Title = Title; bool r = md.Run() == (int)Gtk.ResponseType.Yes; md.Destroy(); return(r); }
public DialogResult ShowDialog(Control parent) { Gtk.Widget c = (parent == null) ? null : (Gtk.Widget)parent.ControlObject; while (!(c is Gtk.Window) && c != null) { c = c.Parent; } control = new Gtk.MessageDialog((Gtk.Window)c, Gtk.DialogFlags.Modal, Convert (Type), Gtk.ButtonsType.Ok, false, Text); control.TypeHint = Gdk.WindowTypeHint.Dialog; var caption = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null); if (!string.IsNullOrEmpty(caption)) control.Title = caption; int ret = control.Run(); control.Destroy(); return Generator.Convert((Gtk.ResponseType)ret); }
protected void OnButtonCloseClicked(object sender, EventArgs e) { //Check if preferences are valid if (pathFileChooserButton.Filename != null) { this.Respond(Gtk.ResponseType.Close); } else { Gtk.MessageDialog mes = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Mono.Unix.Catalog.GetString("You must choose a valid path for registry files.")); if ((Gtk.ResponseType)mes.Run() == Gtk.ResponseType.Ok) { mes.Destroy(); } } }
public void Run () { string text = TextEditorApp.MainWindow.View.Buffer.Text; XmlDocument doc = new XmlDocument (); try { doc.LoadXml (text); StringWriter sw = new StringWriter (); XmlTextWriter tw = new XmlTextWriter (sw); tw.Formatting = Formatting.Indented; doc.Save (tw); TextEditorApp.MainWindow.View.Buffer.Text = sw.ToString (); } catch { Gtk.MessageDialog dlg = new Gtk.MessageDialog (TextEditorApp.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "Error parsing XML."); dlg.Run (); dlg.Destroy (); } }
public DialogResult ShowDialog(Control parent, MessageBoxButtons buttons) { Gtk.Widget c = (parent == null) ? null : (Gtk.Widget)parent.ControlObject; while (!(c is Gtk.Window) && c != null) { c = c.Parent; } control = new Gtk.MessageDialog((Gtk.Window)c, Gtk.DialogFlags.Modal, Convert (Type), Convert(buttons), false, Text); control.TypeHint = Gdk.WindowTypeHint.Dialog; var caption = Caption ?? ((parent != null && parent.ParentWindow != null) ? parent.ParentWindow.Title : null); if (!string.IsNullOrEmpty(caption)) control.Title = caption; if (buttons == MessageBoxButtons.YesNoCancel) { // must add cancel manually Gtk.Button b = (Gtk.Button)control.AddButton(Gtk.Stock.Cancel, (int)Gtk.ResponseType.Cancel); b.UseStock = true; } int ret = control.Run(); control.Destroy(); return Generator.Convert((Gtk.ResponseType)ret); }
public SaveCheckDialogResult ShowSaveCheckDialog() { Gtk.MessageDialog saveCheckDialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, false, "The current document has unsaved changes. Do you wish to save those now?"); saveCheckDialog.AddButton("Cancel", Gtk.ResponseType.Cancel); SaveCheckDialogResult result = SaveCheckDialogResult.Cancel; int dialogResult = saveCheckDialog.Run(); if ((int)Gtk.ResponseType.Yes == dialogResult) { result = SaveCheckDialogResult.Save; } else if ((int)Gtk.ResponseType.No == dialogResult) { result = SaveCheckDialogResult.NoSave; } saveCheckDialog.Destroy(); return result; }
public static void Run (string file) { ICompiler[] compilers = (ICompiler[]) AddinManager.GetExtensionObjects (typeof(ICompiler)); ICompiler compiler = null; foreach (ICompiler comp in compilers) { if (comp.CanCompile (file)) { compiler = comp; break; } } if (compiler == null) { string msg = "No compiler available for this kind of file."; Gtk.MessageDialog dlg = new Gtk.MessageDialog (TextEditorApp.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg); dlg.Run (); dlg.Destroy (); return; } string messages = compiler.Compile (file, file + ".exe"); TextEditorApp.MainWindow.ConsoleWrite ("Compilation finished.\n"); TextEditorApp.MainWindow.ConsoleWrite (messages); }
private static bool CheckFrontendManagerStatus() { Trace.Call(); if (_FrontendManager == null) { // we lost the frontend manager, nothing to check return false; } if (_FrontendManager.IsAlive) { // everything is fine return true; } #if LOG4NET _Logger.Error("CheckFrontendManagerStatus(): frontend manager is not alive anymore!"); #endif Gtk.Application.Invoke(delegate { Gtk.MessageDialog md = new Gtk.MessageDialog(_MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.OkCancel, _("The server has lost the connection to the frontend.\nDo you want to reconnect now?")); Gtk.ResponseType res = (Gtk.ResponseType) md.Run(); md.Destroy(); if (res != Gtk.ResponseType.Ok) { // the frontend is unusable in this state -> say good bye Frontend.Quit(); return; } Frontend.ReconnectEngineToGUI(); }); return false; }
private void _OnActivated(object sender, EventArgs e) { Trace.Call(sender, e); try { if (!(Text.Length > 0)) { return; } if (ChatViewManager.CurrentChatView == null) { return; } if (Text.IndexOf("\n") != -1) { var text = Text.TrimEnd('\n'); // seems to be a paste, so let's break it apart string[] msgParts = text.Split(new char[] {'\n'}); if (msgParts.Length > 3) { string msg = String.Format(_("You are going to paste {0} lines. Do you want to continue?"), msgParts.Length); Gtk.MessageDialog md = new Gtk.MessageDialog( Frontend.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, msg); Gtk.ResponseType res = (Gtk.ResponseType)md.Run(); md.Destroy(); if (res != Gtk.ResponseType.Yes) { Text = String.Empty; return; } } if (Frontend.EngineProtocolVersion < new Version(0,8,11)) { foreach (string msg in msgParts) { ExecuteCommand(msg); } } else { // new engines know how to handle messages containing \n ExecuteCommand(text); } } else { ExecuteCommand(Text); AddToHistory(Text, _History.Count - _HistoryPosition); // reset history position to last entry _HistoryPosition = _History.Count - 1; } Text = String.Empty; } catch (Exception ex) { #if LOG4NET _Logger.Error(ex); #endif Frontend.ShowException(null, ex); } }
protected virtual void OnRemoveButtonClicked(object sender, System.EventArgs e) { Trace.Call(sender, e); try { Gtk.TreeIter iter; if (!f_TreeView.Selection.GetSelected(out iter)) { return; } Gtk.MessageDialog md = new Gtk.MessageDialog( f_Parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, _("Are you sure you want to delete the selected filter?") ); int result = md.Run(); md.Destroy(); if (result != (int) Gtk.ResponseType.Yes) { return; } f_ListStore.Remove(ref iter); OnChanged(EventArgs.Empty); } catch (Exception ex) { Frontend.ShowException(ex); } }
bool CheckBug77135 () { try { // Check for bug 77135. Some versions of gnome-vfs2 and libgda // make MD crash in the file open dialog or in FileIconLoader. // Only in Suse. string path = "/etc/SuSE-release"; if (!File.Exists (path)) return true; // Only run the check for SUSE 10 StreamReader sr = File.OpenText (path); string txt = sr.ReadToEnd (); sr.Close (); if (txt.IndexOf ("SUSE LINUX 10") == -1) return true; string current_libgda; string current_gnomevfs; string required_libgda = "1.3.91.5.4"; string required_gnomevfs = "2.12.0.9.2"; StringWriter sw = new StringWriter (); ProcessWrapper pw = Runtime.ProcessService.StartProcess ("rpm", "--qf %{version}.%{release} -q libgda", null, sw, null, null); pw.WaitForOutput (); current_libgda = sw.ToString ().Trim (' ','\n'); sw = new StringWriter (); pw = Runtime.ProcessService.StartProcess ("rpm", "--qf %{version}.%{release} -q gnome-vfs2", null, sw, null, null); pw.WaitForOutput (); current_gnomevfs = sw.ToString ().Trim (' ','\n'); bool fail1 = Addin.CompareVersions (current_libgda, required_libgda) == 1; bool fail2 = Addin.CompareVersions (current_gnomevfs, required_gnomevfs) == 1; if (fail1 || fail2) { string msg = GettextCatalog.GetString ("Some packages installed in your system are not compatible with MonoDevelop:\n"); if (fail1) msg += "\nlibgda " + current_libgda + " ("+ GettextCatalog.GetString ("version required: {0}", required_libgda) + ")"; if (fail2) msg += "\ngnome-vfs2 " + current_gnomevfs + " ("+ GettextCatalog.GetString ("version required: {0}", required_gnomevfs) + ")"; msg += "\n\n"; msg += GettextCatalog.GetString ("You need to upgrade the previous packages to start using MonoDevelop."); SplashScreenForm.SplashScreen.Hide (); Gtk.MessageDialog dlg = new Gtk.MessageDialog (null, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, msg); dlg.Run (); dlg.Destroy (); return false; } else return true; } catch (Exception ex) { // Just ignore for now. Console.WriteLine (ex); return true; } }
/// <summary> /// MessageDialog wrapper</summary> /// This simplifies the MessageDialog into a single function for ease of use. /// <param name="text"> /// The message</param> /// <param name="type"><para> /// The type of icon to use. Defaults to none.</para><para>0 = Error </para><para>1 = Info </para><para>2 = Question </para><para>3 = Warning </para></param> /// <seealso cref="Gtk.MessageDialog(Window, DialogFlags, MessageType, ButtonsType, string)"/> public void MsgBox(string text, int type = 4) { Gtk.MessageType mt; switch (type) { case 0: mt = Gtk.MessageType.Error; break; case 1: mt = Gtk.MessageType.Info; break; case 2: mt = Gtk.MessageType.Question; break; case 3: mt = Gtk.MessageType.Warning; break; default: mt = Gtk.MessageType.Other; break; } Gtk.MessageDialog md = new Gtk.MessageDialog(this,Gtk.DialogFlags.DestroyWithParent,mt,Gtk.ButtonsType.Ok,text); md.Run (); md.Destroy(); }
protected void OnSaveNoteBtnClicked(object sender, EventArgs e) { var note = (NoteNode)listView.NodeSelection.SelectedNode; if (note == null) { var md = new Gtk.MessageDialog( this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.Close, "No note selected for saving!" ); md.Run(); md.Destroy(); } else { note.Note.Content = noteView.Buffer.Text; } }
protected void OnUseLocalEngineActionActivated(object sender, EventArgs e) { Trace.Call(sender, e); try { var dialog = new Gtk.MessageDialog( Parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, _("Switching to local engine will disconnect you from the current engine!\n"+ "Are you sure you want to do this?") ); int result = dialog.Run(); dialog.Destroy(); if ((Gtk.ResponseType)result == Gtk.ResponseType.Yes) { Frontend.DisconnectEngineFromGUI(); Frontend.InitLocalEngine(); Frontend.ConnectEngineToGUI(); } } catch (Exception ex) { Frontend.ShowException(Parent, ex); } }
private void _OnDeleteButtonPressed() { string msg = String.Format( _("Are you sure you want to delete the engine \"{0}\"?"), _SelectedEngine); Gtk.MessageDialog md = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, msg); int res = md.Run(); md.Destroy(); if ((Gtk.ResponseType)res == Gtk.ResponseType.Yes) { _DeleteEngine(_SelectedEngine); _InitEngineList(); // Re-run the Dialog Run(); } }
private void _OnConnectButtonPressed() { if (_SelectedEngine == null || _SelectedEngine == String.Empty) { Gtk.MessageDialog md = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, _("Please select an engine!")); md.Run(); md.Destroy(); // Re-run the Dialog Run(); return; } if (_SelectedEngine == "<" + _("Local Engine") + ">") { Frontend.InitLocalEngine(); Frontend.ConnectEngineToGUI(); Destroy(); return; } string engine = _SelectedEngine; try { _EngineManager.Connect(engine); var engineVersion = _EngineManager.EngineVersion; var frontendVersion = Frontend.Version; if ((engineVersion >= new Version("0.8") && engineVersion.Major != frontendVersion.Major) || (engineVersion < new Version("0.8") && (engineVersion.Major != frontendVersion.Major || engineVersion.Minor != frontendVersion.Minor))) { throw new ApplicationException(String.Format( _("Your frontend version ({0}) does not match the engine version ({1})!"), Frontend.Version, _EngineManager.EngineVersion)); } Frontend.Session = _EngineManager.Session; Frontend.UserConfig = _EngineManager.UserConfig; Frontend.EngineVersion = _EngineManager.EngineVersion; Frontend.ConnectEngineToGUI(); } catch (Exception ex) { #if LOG4NET _Logger.Error(ex); #endif // clean-up try { _EngineManager.Disconnect(); } catch (Exception disEx) { #if LOG4NET _Logger.Error(disEx); #endif } string error_msg = ex.Message + "\n"; if (ex.InnerException != null) { error_msg += " [" + ex.InnerException.Message + "]\n"; } string msg; msg = _("An error occurred while connecting to the engine!") + "\n\n"; msg += String.Format(_("Engine URL: {0}") + "\n", _EngineManager.EngineUrl); msg += String.Format(_("Error: {0}"), error_msg); Gtk.MessageDialog md = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, msg); md.Run(); md.Destroy(); // Re-run the Dialog Run(); } }
protected void OnChkSortToggled(object sender, System.EventArgs e) { if (!disableSettingsEvents) { cmbSort.Visible = chkSort.Active; if (chkSort.Active) { if (!disableSettingsEvents) { Gtk.MessageDialog d = new Gtk.MessageDialog (this, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Question, Gtk.ButtonsType.YesNo, textSortDialogMsg); d.Modal = true; d.Title = textChkSort; Gtk.ResponseType answer = (Gtk.ResponseType)d.Run (); if (answer == Gtk.ResponseType.Yes) { SortMaster = true; lblWarnings.Text = textLogSortMaster + ": " + textOn; } else { SortMaster = false; lblWarnings.Text = textLogSortMaster + ": " + textOff; } d.Destroy (); } // effect sort on the Master Log, if desired if (SortMaster) { rewriteMasterLog (); } // sort the list, if filter is running if (enabled) { sortNeeded = true; // force the filter of the logs (arguments probably have the wrong values, but they aren't used by the code) this.OnTimedEvent (sender, null); } } else { lblWarnings.Text = ""; } // save settings writeSettings (); } }
public static void ShowException(Gtk.Window parent, Exception ex) { Trace.Call(parent, ex != null ? ex.GetType() : null); if (parent == null) { parent = _MainWindow; } if (!IsGuiThread()) { Gtk.Application.Invoke(delegate { ShowException(parent, ex); }); return; } if (ex is NotImplementedException) { // don't quit on NotImplementedException ShowError(parent, ex); return; } #if LOG4NET _Logger.Error("ShowException(): Exception:", ex); #endif // HACK: ugly MS .NET throws underlaying SocketException instead of // wrapping those into a nice RemotingException, see: // http://projects.qnetp.net/issues/show/232 if (ex is System.Runtime.Remoting.RemotingException || ex is System.Net.Sockets.SocketException) { if (_InReconnectHandler || _InCrashHandler) { // one reconnect is good enough and a crash we won't survive return; } Frontend.ReconnectEngineToGUI(); return; } if (_InCrashHandler) { // only show not more than one crash dialog, else the user // will not be able to copy/paste the stack trace and stuff return; } _InCrashHandler = true; // we are using a remote engine, we are not running on Mono and an // IConvertible issue happened if (!Frontend.IsLocalEngine && Type.GetType("Mono.Runtime") == null && ex is InvalidCastException && ex.Message.Contains("IConvertible")) { var msg = _( "A fatal error has been detected because of a protocol incompatibility with the smuxi-server!\n\n" + "Please install Mono on the frontend side so it matches the smuxi-server.\n\n" + "More details about this issue can be found here:\n" + "https://smuxi.im/issues/show/589" ); var dialog = new Gtk.MessageDialog( parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, true, msg ); dialog.Run(); dialog.Destroy(); Quit(); return; } CrashDialog cd = new CrashDialog(parent, ex); cd.Run(); cd.Destroy(); if (SysDiag.Debugger.IsAttached) { // allow the debugger to examine the situation //SysDiag.Debugger.Break(); // HACK: Break() would be nicer but crashes the runtime throw ex; } Quit(); }
public static bool ShowReconnectDialog(Gtk.Window parent) { Trace.Call(parent); Gtk.MessageDialog md = new Gtk.MessageDialog(parent, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.OkCancel, _("The frontend has lost the connection to the server.\nDo you want to reconnect now?")); Gtk.ResponseType res = (Gtk.ResponseType) md.Run(); md.Destroy(); if (res != Gtk.ResponseType.Ok) { Quit(); return false; } while (true) { try { Frontend.ReconnectEngineToGUI(); // yay, we made it _InReconnectHandler = false; break; } catch (Exception e) { #if LOG4NET _Logger.Error("ShowReconnectDialog(): Reconnect failed, exception:", e); #endif var msg = _("Reconnecting to the server has failed.\nDo you want to try again?"); // the parent window is hidden (MainWindow) at this // point thus modal doesn't make sense here md = new Gtk.MessageDialog(parent, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Error, Gtk.ButtonsType.OkCancel, msg); md.SetPosition(Gtk.WindowPosition.CenterAlways); res = (Gtk.ResponseType) md.Run(); md.Destroy(); if (res != Gtk.ResponseType.Ok) { // give up Quit(); return false; } } } return true; }
public override void Close() { Trace.Call(); // show warning if there are open chats (besides protocol chat) var ownedChats = 0; foreach (var chatView in Frontend.MainWindow.ChatViewManager.Chats) { if (chatView.ProtocolManager == ProtocolManager) { ownedChats++; } } if (ownedChats > 1) { Gtk.MessageDialog md = new Gtk.MessageDialog( Frontend.MainWindow, Gtk.DialogFlags.Modal, Gtk.MessageType.Warning, Gtk.ButtonsType.YesNo, _("Closing the protocol chat will also close all open chats connected to it!\n"+ "Are you sure you want to do this?")); int result = md.Run(); md.Destroy(); if ((Gtk.ResponseType) result != Gtk.ResponseType.Yes) { return; } } ThreadPool.QueueUserWorkItem(delegate { try { // no need to call base.Close() as CommandNetwork() will // deal with it Frontend.Session.CommandNetwork( new CommandModel( Frontend.FrontendManager, ChatModel, "close" ) ); } catch (Exception ex) { Frontend.ShowException(ex); } }); }
protected virtual void OnApply(object sender, EventArgs e) { Trace.Call(sender, e); string engine = f_NameWidget.EngineNameEntry.Text; if (f_EngineName == null) { // check if an engine wit that name exists already string[] engines = (string[]) f_Config["Engines/Engines"]; foreach (string oldEngine in engines) { if (engine == oldEngine) { Gtk.MessageDialog md = new Gtk.MessageDialog(this, Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Close, _("An engine with this name already exists! Please specify a different one.")); md.Run(); md.Destroy(); // jump back to the name page // HACK: assistant API is buggy here, the "Apply" button // will trigger a next page signal, thus we have to jump // to one page before the name page :( CurrentPage = f_NamePage - 1; return; } } string[] newEngines; if (engines.Length == 0) { // there was no existing engines newEngines = new string[] { engine }; } else { newEngines = new string[engines.Length + 1]; engines.CopyTo(newEngines, 0); newEngines[engines.Length] = engine; } if (engines.Length == 1) { f_Config["Engines/Default"] = engine; } f_Config["Engines/Engines"] = newEngines; } if (f_NameWidget.MakeDefaultEngineCheckButton.Active) { f_Config["Engines/Default"] = engine; } f_Config["Engines/"+engine+"/Username"] = f_CredentialsWidget.UsernameEntry.Text.Trim(); f_Config["Engines/"+engine+"/Password"] = f_CredentialsWidget.PasswordEntry.Text.Trim(); f_Config["Engines/"+engine+"/Hostname"] = f_ConnectionWidget.HostEntry.Text.Trim(); f_Config["Engines/"+engine+"/Port"] = f_ConnectionWidget.PortSpinButton.ValueAsInt; f_Config["Engines/"+engine+"/UseSshTunnel"] = f_ConnectionWidget.UseSshTunnelCheckButton.Active; f_Config["Engines/"+engine+"/SshUsername"] = f_CredentialsWidget.SshUsernameEntry.Text.Trim(); if (f_CredentialsWidget.SshPasswordVBox.Visible) { f_Config["Engines/"+engine+"/SshPassword"] = f_CredentialsWidget.SshPasswordEntry.Text; } f_Config["Engines/"+engine+"/SshKeyfile"] = f_CredentialsWidget.SshKeyfileChooserButton.Filename ?? String.Empty; f_Config["Engines/"+engine+"/SshHostname"] = f_ConnectionWidget.SshHostEntry.Text.Trim(); f_Config["Engines/"+engine+"/SshPort"] = f_ConnectionWidget.SshPortSpinButton.ValueAsInt; // HACK: we don't really support any other channels/formatters (yet) f_Config["Engines/"+engine+"/Channel"] = "TCP"; f_Config["Engines/"+engine+"/Formatter"] = "binary"; f_Config.Save(); }