public GroupsViewDialog(Connection connection, string newContainer) : base(connection, newContainer) { Init(); populateUsers(); groupDialog.Title = "Add Group"; groupIDSpinButton.Value = conn.Data.GetNextGID(); groupDialog.Icon = Global.latIcon; groupDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } groupDialog.Run(); } groupDialog.Destroy(); }
public HostsViewDialog(Connection connection, string newContainer) : base(connection, newContainer) { Init(); hostDialog.Icon = Global.latIcon; hostDialog.Title = "Add Computer"; hostDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } hostDialog.Run(); } hostDialog.Destroy(); }
void doDialog() { #if GTK_SHARP_2_6 bool rename = combo.Active == values.Count + 1; #else bool rename = combo.Active == values.Count; #endif Gtk.Dialog dialog = new Gtk.Dialog( rename ? Catalog.GetString("Rename Group") : Catalog.GetString("New Group"), combo.Toplevel as Gtk.Window, Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Ok, Gtk.ResponseType.Ok); dialog.DefaultResponse = Gtk.ResponseType.Ok; dialog.HasSeparator = false; dialog.BorderWidth = 12; dialog.VBox.Spacing = 18; dialog.VBox.BorderWidth = 0; Gtk.HBox hbox = new Gtk.HBox(false, 12); Gtk.Label label = new Gtk.Label(rename ? Catalog.GetString("_New name:") : Catalog.GetString("_Name:")); Gtk.Entry entry = new Gtk.Entry(); label.MnemonicWidget = entry; hbox.PackStart(label, false, false, 0); entry.ActivatesDefault = true; if (rename) { entry.Text = group; } hbox.PackStart(entry, true, true, 0); dialog.VBox.PackStart(hbox, false, false, 0); dialog.ShowAll(); // Have to set this *after* ShowAll dialog.ActionArea.BorderWidth = 0; Gtk.ResponseType response = (Gtk.ResponseType)dialog.Run(); if (response == Gtk.ResponseType.Cancel || entry.Text.Length == 0) { dialog.Destroy(); Value = group; // reset combo.Active return; } string oldname = group; group = entry.Text; dialog.Destroy(); // FIXME: check that the new name doesn't already exist // This will trigger a GroupsChanged, which will eventually // update combo.Active if (rename) { manager.Rename(oldname, group); } else { manager.Add(group); } }
public CreateEntryDialog(Connection connection, Template theTemplate) { if (connection == null) { throw new ArgumentNullException("connection"); } if (theTemplate == null) { throw new ArgumentNullException("theTemplate"); } conn = connection; t = theTemplate; isTemplate = true; Init(); foreach (string s in t.Classes) { attrListStore.AppendValues("objectClass", s, "Optional"); _objectClass.Add(s); } showAttributes(); createEntryDialog.Icon = Global.latIcon; createEntryDialog.Run(); createEntryDialog.Run(); createEntryDialog.Destroy(); }
public TemplateEditorDialog(Connection connection) { conn = connection; Init(); templateEditorDialog.Run(); templateEditorDialog.Destroy(); }
public ProfileDialog() { conn = new Connection(new ConnectionData()); Init(); portEntry.Text = "389"; profileDialog.Run(); profileDialog.Destroy(); }
private void on_ok_button_clicked(object o, EventArgs args) { ArrayList lsdest = new ArrayList(); ArrayList bsdest = new ArrayList(); ArrayList contacts = new ArrayList(); lsdest = ls.GetSelections(ALL_COLUMNS); // if there are indiviual entries don't do entire phonebooks if (lsdest.Count > 0) { IEnumerator enu = lsdest.GetEnumerator(); while (enu.MoveNext()) { GfaxContact c = new GfaxContact(); c.Organization = (string)enu.Current; enu.MoveNext(); c.PhoneNumber = (string)enu.Current; enu.MoveNext(); c.ContactPerson = (string)enu.Current; gfax.Destinations.Add(c); } } else { bsdest = bs.GetSelections(COLUMN_0); if (bsdest.Count > 0) { IEnumerator enu = bsdest.GetEnumerator(); while (enu.MoveNext()) { foreach (Phonebook p in myPhoneBooks) { if (p.Name == (string)enu.Current) { contacts = Phonetools.get_contacts(p); } } // add contacts to global desinations if (contacts.Count > 0) { IEnumerator enuc = contacts.GetEnumerator(); while (enuc.MoveNext()) { gfax.Destinations.Add((GfaxContact)enuc.Current); } } } } } phbd.Destroy(); }
public SearchBuilderDialog() { _allCombos = new List <ComboBox> (); _critTable = new Dictionary <string, SearchCriteria> (); _ls = new LdapSearch(); ui = new Glade.XML(null, "lat.glade", "searchBuilderDialog", null); ui.Autoconnect(this); Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource("edit-find-48x48.png"); image117.Pixbuf = pb; opComboBox = createCombo(ops); opHbox.Add(opComboBox); addButton.Clicked += new EventHandler(OnAddClicked); removeButton.Clicked += new EventHandler(OnRemoveClicked); okButton.Clicked += new EventHandler(OnOkClicked); cancelButton.Clicked += new EventHandler(OnCancelClicked); searchBuilderDialog.Icon = Global.latIcon; searchBuilderDialog.Run(); searchBuilderDialog.Destroy(); }
public PrintDialog(Photo [] photos) { this.photos = photos; #if ENABLE_CUSTOM_PRINT Glade.XML xml = new Glade.XML(null, "f-spot.glade", "print_dialog", "f-spot"); xml.Autoconnect(this); #endif print_job = new Gnome.PrintJob(Gnome.PrintConfig.Default()); //Render (); #if ENABLE_CUSTOM_PRINT int response = print_dialog.Run(); switch (response) { case (int)Gtk.ResponseType.Ok: print_job.Print(); break; } print_dialog.Destroy(); #else RunGnomePrintDialog(); #endif }
public NewUserViewDialog(Connection connection, string newContainer, Dictionary <string, string> defaultValues) : base(connection, newContainer) { this.defaultValues = defaultValues; Init(); getGroups(); createCombo(); SetDefaults(); uidSpinButton.Value = conn.Data.GetNextUID(); enableSambaButton.Toggled += new EventHandler(OnSambaChanged); newUserDialog.Icon = Global.latIcon; newUserDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } newUserDialog.Run(); } newUserDialog.Destroy(); }
public NewAdUserViewDialog(Connection connection, string newContainer) : base(connection, newContainer) { Init(); groupList = GetGroups(); createCombo(); newAdUserDialog.Icon = Global.latIcon; newAdUserDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } newAdUserDialog.Run(); } newAdUserDialog.Destroy(); }
public int Run() { thisDialog.ShowAll(); int result = 0; for (; true;) { result = thisDialog.Run(); if ((result != ((int)(Gtk.ResponseType.None)))) { switch (result) { case 1: Application.Quit(); break; case 2: //todo : send a mail break; } break; } Thread.Sleep(500); } thisDialog.Destroy(); return(result); }
public SelectGroupsDialog(string[] allGroups) { ui = new Glade.XML(null, "lat.glade", "selectGroupsDialog", null); ui.Autoconnect(this); groups = new List <string> (); TreeViewColumn col; store = new ListStore(typeof(string)); allGroupsTreeview.Model = store; allGroupsTreeview.Selection.Mode = SelectionMode.Multiple; col = allGroupsTreeview.AppendColumn("Name", new CellRendererText(), "text", 0); col.SortColumnId = 0; store.SetSortColumnId(0, SortType.Ascending); foreach (string s in allGroups) { store.AppendValues(s); } selectGroupsDialog.Icon = Global.latIcon; selectGroupsDialog.Resize(320, 200); selectGroupsDialog.Run(); selectGroupsDialog.Destroy(); }
public MassEditDialog() { _modList = new List <LdapModification> (); ui = new Glade.XML(null, "lat.glade", "massEditDialog", null); ui.Autoconnect(this); createCombos(); modListStore = new ListStore(typeof(string), typeof(string), typeof(string)); modListView.Model = modListStore; TreeViewColumn col; col = modListView.AppendColumn("Action", new CellRendererText(), "text", 0); col.SortColumnId = 0; col = modListView.AppendColumn("Name", new CellRendererText(), "text", 1); col.SortColumnId = 1; col = modListView.AppendColumn("Value", new CellRendererText(), "text", 2); col.SortColumnId = 2; modListStore.SetSortColumnId(0, SortType.Ascending); massEditDialog.Resize(300, 450); massEditDialog.Icon = Global.latIcon; massEditDialog.Run(); massEditDialog.Destroy(); }
public ConnectDialog() { ui = new Glade.XML(null, "lat.glade", "connectionDialog", null); ui.Autoconnect(this); Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server-48x48.png"); image5.Pixbuf = pb; connectionDialog.Icon = Global.latIcon; connectionDialog.Resizable = false; portEntry.Text = "389"; createCombo(); // profileListStore = new ListStore (typeof (string)); // profileListview.Model = profileListStore; // profileListStore.SetSortColumnId (0, SortType.Ascending); // // TreeViewColumn col; // col = profileListview.AppendColumn ("Name", new CellRendererText (), "text", 0); // col.SortColumnId = 0; // // UpdateProfileList (); // // if (haveProfiles) { // // notebook1.CurrentPage = 1; // connectionDialog.Resizable = true; // } noEncryptionRadioButton.Active = true; connectionDialog.Run(); connectionDialog.Destroy(); }
public PreferencesDialog(Gnome.Program program) { ui = new Glade.XML(null, "lat.glade", "preferencesDialog", null); ui.Autoconnect(this); this.program = program; profileStore = new ListStore(typeof(string)); profilesTreeView.Model = profileStore; profileStore.SetSortColumnId(0, SortType.Ascending); TreeViewColumn col; col = profilesTreeView.AppendColumn("Name", new CellRendererText(), "text", 0); col.SortColumnId = 0; UpdateProfileList(); LoadPreference(Preferences.BROWSER_SELECTION); preferencesDialog.Icon = Global.latIcon; preferencesDialog.Resize(300, 400); preferencesDialog.Run(); if (gettingHelp) { preferencesDialog.Run(); gettingHelp = false; } preferencesDialog.Destroy(); }
public NewContactsViewDialog(Connection connection, string newContainer) : base(connection, newContainer) { Init(); newContactDialog.Icon = Global.latIcon; newContactDialog.Title = "New Contact"; newContactDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } newContactDialog.Run(); } newContactDialog.Destroy(); }
public AddObjectClassDialog(Connection conn) { objectClasses = new List <string> (); ui = new Glade.XML(null, "lat.glade", "addObjectClassDialog", null); ui.Autoconnect(this); store = new ListStore(typeof(bool), typeof(string)); CellRendererToggle crt = new CellRendererToggle(); crt.Activatable = true; crt.Toggled += OnClassToggled; objClassTreeView.AppendColumn("Enabled", crt, "active", 0); objClassTreeView.AppendColumn("Name", new CellRendererText(), "text", 1); objClassTreeView.Model = store; try { foreach (string n in conn.Data.ObjectClasses) { store.AppendValues(false, n); } } catch (Exception e) { store.AppendValues(false, "Error getting object classes"); Log.Debug(e); } addObjectClassDialog.Icon = Global.latIcon; addObjectClassDialog.Resize(300, 400); addObjectClassDialog.Run(); addObjectClassDialog.Destroy(); }
void on_dialog_response(object obj, ResponseArgs args) { if (args.ResponseId == ResponseType.Ok) { create_mosaics(); } metapixel_dialog.Destroy(); }
void OnDialogReponse(object obj, ResponseArgs args) { if (args.ResponseId == ResponseType.Ok) { CreatePhotoWall(); } picturetile_dialog.Destroy(); }
private void onClick(object Sender, EventArgs e) { Dialog d = new Dialog ("Test", this, DialogFlags.DestroyWithParent); d.Modal = true; d.AddButton ("Close", ResponseType.Close); d.Run (); d.Destroy (); }
public int Show() { int respType = -1; respType = SelectWriteModeDialog.Run(); SelectWriteModeDialog.Destroy(); return(respType); }
public TimeDateDialog() { ui = new Glade.XML(null, "lat.glade", "timeDateDialog", null); ui.Autoconnect(this); timeDateDialog.Icon = Global.latIcon; timeDateDialog.Run(); timeDateDialog.Destroy(); }
public EditContactsViewDialog(Connection connection, LdapEntry le) : base(connection, null) { currentEntry = le; Init(); string displayName = conn.Data.GetAttributeValueFromEntry(currentEntry, "displayName"); gnNameLabel.Text = displayName; gnFirstNameEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "givenName"); gnInitialsEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "initials"); gnLastNameEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "sn"); gnDisplayName.Text = displayName; gnDescriptionEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "description"); gnOfficeEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "physicalDeliveryOfficeName"); gnTelephoneNumberEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "telephoneNumber"); gnEmailEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "mail"); adPOBoxEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "postOfficeBox"); adCityEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "l"); adStateEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "st"); adZipEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "postalCode"); tnHomeEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "homePhone"); tnPagerEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "pager"); tnMobileEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "mobile"); tnFaxEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "facsimileTelephoneNumber"); ozTitleEntry.Text = conn.Data.GetAttributeValueFromEntry(currentEntry, "title"); string contactName = conn.Data.GetAttributeValueFromEntry(currentEntry, "cn"); editContactDialog.Title = contactName + " Properties"; conn.Data.GetAttributeValueFromEntry(currentEntry, "street"); editContactDialog.Icon = Global.latIcon; editContactDialog.Run(); while (missingValues || errorOccured) { if (missingValues) { missingValues = false; } else if (errorOccured) { errorOccured = false; } editContactDialog.Run(); } editContactDialog.Destroy(); }
/// <summary> /// Show Dialog to change Pin1 status /// </summary> public string Show() { int respType = -1; string pin1 = "", pin1check = ""; int retNumber = 0; while (1 == 1) { SetupDialog(); respType = ChangePinStatusDialog.Run(); pin1 = TxtPin1.Text.Trim(); pin1check = TxtPin1check.Text.Trim(); ChangePinStatusDialog.Destroy(); if (respType != 0) { // Cancel button pressed return(null); } // check data entry if (pin1 == "" || pin1check == "") { // send warning message MainClass.ShowMessage(mainWin, "ERROR", GlobalObjUI.LMan.GetString("pinsimchk2"), MessageType.Warning); } else if (pin1.Trim() != pin1check.Trim()) { // send warning message MainClass.ShowMessage(mainWin, "ERROR", GlobalObjUI.LMan.GetString("pinsimchk1"), MessageType.Warning); } else if (pin1.Trim().Length != 4) { // send warning message MainClass.ShowMessage(mainWin, "ERROR", GlobalObjUI.LMan.GetString("pinsimchk2"), MessageType.Warning); } else if (!int.TryParse(pin1.Trim(), out retNumber)) { // send warning message MainClass.ShowMessage(mainWin, "ERROR", GlobalObjUI.LMan.GetString("pinsimchk2"), MessageType.Warning); } else { // Data are correct return(GetHexFromPin(pin1)); } } }
public PluginConfigureDialog(Connection connection, string pluginName) { conn = connection; colNames = new List <string> (); colAttrs = new List <string> (); ui = new Glade.XML(null, "lat.glade", "pluginConfigureDialog", null); ui.Autoconnect(this); columnStore = new ListStore(typeof(string), typeof(string)); CellRendererText cell = new CellRendererText(); cell.Editable = true; cell.Edited += new EditedHandler(OnNameEdit); columnsTreeView.AppendColumn("Name", cell, "text", 0); cell = new CellRendererText(); cell.Editable = true; cell.Edited += new EditedHandler(OnAttributeEdit); columnsTreeView.AppendColumn("Attribute", cell, "text", 1); columnsTreeView.Model = columnStore; vp = Global.Plugins.GetViewPlugin(pluginName, connection.Settings.Name); if (vp != null) { for (int i = 0; i < vp.ColumnNames.Length; i++) { columnStore.AppendValues(vp.ColumnNames[i], vp.ColumnAttributes[i]); colNames.Add(vp.ColumnNames[i]); colAttrs.Add(vp.ColumnAttributes[i]); } filterEntry.Text = vp.Filter; if (vp.DefaultNewContainer != "") { newContainerButton.Label = vp.DefaultNewContainer; } if (vp.SearchBase != "") { searchBaseButton.Label = vp.SearchBase; } } else { Log.Error("Unable to find view plugin {0}", pluginName); } pluginConfigureDialog.Icon = Global.latIcon; pluginConfigureDialog.Resize(300, 400); pluginConfigureDialog.Run(); pluginConfigureDialog.Destroy(); }
private void on_PrefsDialog_delete_event(object o, DeleteEventArgs args) { MessageDialog md; if (taChanged) { md = new MessageDialog( null, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Ok, Catalog.GetString("You need to exit Gfax and restart it when you change transport agents") ); md.Run(); md.Destroy(); } PrefsDialog.Destroy(); args.RetVal = true; }
private bool RunDialog (Dialog dlg) { bool result = false; try { if (dlg.Run () == (int)ResponseType.Ok) result = true; } finally { dlg.Destroy (); } return result;
// ============================================ // PRIVATE Methods // ============================================ private void MessageErrorDialog(string title, string message) { MessageDialog dialog; dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Close, true, "<span size='x-large'><b>{0}</b></span>\n\n{1}", title, message); dialog.Run(); dialog.Destroy(); }
public static int ShowCustomDialog(Gtk.Dialog dialog, Window parent) { try { return(RunCustomDialog(dialog, parent)); } finally { if (dialog != null) { dialog.Destroy(); } } }
protected override bool RunDefault() { Gtk.Dialog md = null; try { md = new Gtk.Dialog(Caption, TransientFor, DialogFlags.Modal | DialogFlags.DestroyWithParent) { HasSeparator = false, BorderWidth = 6, }; var questionLabel = new Label(Question) { UseMarkup = true, Xalign = 0.0F, }; md.VBox.PackStart(questionLabel, true, false, 6); var responseEntry = new Entry(Value ?? "") { Visibility = !IsPassword, }; responseEntry.Activated += (sender, e) => { md.Respond(ResponseType.Ok); }; md.VBox.PackStart(responseEntry, false, true, 6); md.AddActionWidget(new Button(Gtk.Stock.Cancel) { CanDefault = true }, ResponseType.Cancel); md.AddActionWidget(new Button(Gtk.Stock.Ok), ResponseType.Ok); md.DefaultResponse = ResponseType.Cancel; md.Child.ShowAll(); var response = (ResponseType)MonoDevelop.Ide.MessageService.RunCustomDialog(md, TransientFor); if (response == ResponseType.Ok) { Value = responseEntry.Text; return(true); } return(false); } finally { if (md != null) { md.Destroy(); md.Dispose(); } } }
public bool Run() { ResponseType res = (ResponseType)loginDialog.Run(); loginDialog.Destroy(); if (res == ResponseType.Ok) { return(true); } return(false); }
internal static string TakePwd (Window parentWindow, string challengePwd, string experimentPwd) { var passwordPickerDialog = new InsertPassword (); string passwordFromUser = null; if (passwordPickerDialog.Run () == (int)Gtk.ResponseType.Ok) { //check pwds here passwordFromUser = passwordPickerDialog.userEnteredPassword; if (string.IsNullOrEmpty (passwordFromUser)) { //show alert dialog Dialog dialog = new Dialog ( "Warning", parentWindow, DialogFlags.Modal, "Close", ResponseType.Ok ); dialog.VBox.Add (new Label ("Please insert a valid password")); dialog.ShowAll (); dialog.Run (); dialog.Destroy (); return null; } else if (!checkPasswords (passwordFromUser, challengePwd, experimentPwd)) { //show alert Dialog dialog = new Dialog ( "Warning", parentWindow, DialogFlags.Modal, "Close", ResponseType.Ok ); dialog.VBox.Add (new Label ("Entered password is not valid")); dialog.ShowAll (); dialog.Run (); dialog.Destroy (); return null; } return passwordFromUser; } passwordPickerDialog.Destroy (); return null; }
private bool RunDialog(Dialog dlg) { bool result = false; // If the Preview Dialog is canceled, don't execute and don't close the Editor Dialog. try { int resp; do { resp = dlg.Run (); } while (resp != (int)ResponseType.Cancel && resp != (int)ResponseType.Ok && resp != (int)ResponseType.DeleteEvent); if (resp == (int)ResponseType.Ok) result = true; else result = false; } finally { dlg.Destroy (); } return result; }
void HandleSharpen (object sender, EventArgs args) { Gtk.Dialog dialog = new Gtk.Dialog (Catalog.GetString ("Unsharp Mask"), main_window, Gtk.DialogFlags.Modal); dialog.VBox.Spacing = 6; dialog.VBox.BorderWidth = 12; Gtk.Table table = new Gtk.Table (3, 2, false); table.ColumnSpacing = 6; table.RowSpacing = 6; table.Attach (new Gtk.Label (Catalog.GetString ("Amount:")), 0, 1, 0, 1); table.Attach (new Gtk.Label (Catalog.GetString ("Radius:")), 0, 1, 1, 2); table.Attach (new Gtk.Label (Catalog.GetString ("Threshold:")), 0, 1, 2, 3); Gtk.SpinButton amount_spin = new Gtk.SpinButton (0.5, 100.0, .01); Gtk.SpinButton radius_spin = new Gtk.SpinButton (5.0, 50.0, .01); Gtk.SpinButton threshold_spin = new Gtk.SpinButton (0.0, 50.0, .01); table.Attach (amount_spin, 1, 2, 0, 1); table.Attach (radius_spin, 1, 2, 1, 2); table.Attach (threshold_spin, 1, 2, 2, 3); dialog.VBox.PackStart (table); dialog.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dialog.AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok); dialog.ShowAll (); Gtk.ResponseType response = (Gtk.ResponseType) dialog.Run (); if (response == Gtk.ResponseType.Ok) { foreach (int id in SelectedIds ()) { Photo photo = query.Photos [id]; try { Gdk.Pixbuf orig = FSpot.PhotoLoader.Load (query, id); Gdk.Pixbuf final = PixbufUtils.UnsharpMask (orig, radius_spin.Value, amount_spin.Value, threshold_spin.Value); bool create_version = photo.DefaultVersionId == Photo.OriginalVersionId; photo.SaveVersion (final, create_version); query.Commit (id); } catch (System.Exception e) { string msg = Catalog.GetString ("Error saving sharpened photo"); string desc = String.Format (Catalog.GetString ("Received exception \"{0}\". Unable to save photo {1}"), e.Message, photo.Name.Replace ("_", "__")); HigMessageDialog md = new HigMessageDialog (main_window, DialogFlags.DestroyWithParent, Gtk.MessageType.Error, ButtonsType.Ok, msg, desc); md.Run (); md.Destroy (); } } } dialog.Destroy (); }
public static int ShowCustomDialog (Dialog dialog, Window parent) { try { return RunCustomDialog (dialog, parent); } finally { if (dialog != null) dialog.Destroy (); } }
public string GetTextResponse (string question, string caption, string initialValue, bool isPassword) { string returnValue = null; Dialog md = new Dialog (caption, rootWindow, DialogFlags.Modal | DialogFlags.DestroyWithParent); try { // add a label with the question Label questionLabel = new Label(question); questionLabel.UseMarkup = true; questionLabel.Xalign = 0.0F; md.VBox.PackStart(questionLabel, true, false, 6); // add an entry with initialValue Entry responseEntry = (initialValue != null) ? new Entry(initialValue) : new Entry(); md.VBox.PackStart(responseEntry, false, true, 6); responseEntry.Visibility = !isPassword; // add action widgets md.AddActionWidget(new Button(Gtk.Stock.Cancel), ResponseType.Cancel); md.AddActionWidget(new Button(Gtk.Stock.Ok), ResponseType.Ok); md.VBox.ShowAll(); md.ActionArea.ShowAll(); md.HasSeparator = false; md.BorderWidth = 6; PlaceDialog (md, rootWindow); int response = md.Run (); md.Hide (); if ((ResponseType) response == ResponseType.Ok) { returnValue = responseEntry.Text; } return returnValue; } finally { md.Destroy (); } }
/// <summary> /// Запуск простого диалога редактирования справочника /// </summary> /// <returns>Возвращает экземпляр сохраненного объекта, загруженного в сессии диалога. То есть не переданный объект. /// Если пользователь отказался от сохранения возвращаем null. /// </returns> /// <param name="editObject">Объект для редактирования. Если null создаем новый объект.</param> public static object RunSimpleDialog(Window parent, System.Type objectType, object editObject) { using (IUnitOfWork uow = UnitOfWorkFactory.CreateWithoutRoot ()) { //Создаем объект редактирования object tempObject; if(editObject == null) { tempObject = Activator.CreateInstance (objectType); } else { if(editObject is IDomainObject) { tempObject = uow.GetById(objectType, (editObject as IDomainObject).Id); } else { throw new InvalidCastException ("У объекта переданного для запуска простого диалога, нет интерфейса IDomainObject, объект не может быть открыт."); } } //Создаем диалог Dialog editDialog = new Dialog("Редактирование", parent, Gtk.DialogFlags.Modal); editDialog.AddButton("Отмена", ResponseType.Cancel); editDialog.AddButton("Сохранить", ResponseType.Ok); Gtk.Table editDialogTable = new Table(1, 2, false); Label LableName = new Label("Название:"); LableName.Justify = Justification.Right; editDialogTable.Attach(LableName, 0, 1, 0, 1); yEntry inputNameEntry = new yEntry(); inputNameEntry.WidthRequest = 300; inputNameEntry.Binding.AddBinding(tempObject, "Name", w => w.Text).InitializeFromSource (); editDialogTable.Attach(inputNameEntry, 1, 2, 0, 1); editDialog.VBox.Add(editDialogTable); //Запускаем диалог editDialog.ShowAll(); int result = editDialog.Run(); if (result == (int)ResponseType.Ok) { string name = (string)tempObject.GetPropertyValue ("Name"); if (String.IsNullOrWhiteSpace (name)) { var att = DomainHelper.GetSubjectNames (tempObject); string subjectName = att != null ? att.Accusative : null; string msg = String.Format ("Название {0} пустое и не будет сохранено.", string.IsNullOrEmpty (subjectName) ? "элемента справочника" : subjectName ); MessageDialogWorks.RunWarningDialog (msg); logger.Warn (msg); editDialog.Destroy (); return null; } var list = uow.Session.CreateCriteria (objectType) .Add (Restrictions.Eq ("Name", name)) .Add (Restrictions.Not (Restrictions.IdEq (DomainHelper.GetId (tempObject)))) .List (); if (list.Count > 0) { var att = DomainHelper.GetSubjectNames (tempObject); string subjectName = att != null ? StringWorks.StringToTitleCase (att.Nominative) : null; string msg = String.Format ("{0} с таким названием уже существует.", string.IsNullOrEmpty (subjectName) ? "Элемент справочника" : subjectName ); MessageDialogWorks.RunWarningDialog (msg); logger.Warn (msg); editDialog.Destroy (); return list [0]; } uow.TrySave (tempObject); uow.Commit (); OrmMain.NotifyObjectUpdated (tempObject); } else tempObject = null; editDialog.Destroy(); return tempObject; } }
public void OnAddPls() { Hyena.Log.Information ("add playlist"); Gtk.Dialog dlg=new Gtk.Dialog(); dlg.Title="Add Playlist"; Gtk.Entry pls=new Gtk.Entry(); pls.WidthChars=40; Gtk.Label lbl=new Gtk.Label("Playlist name:"); Gtk.HBox hb=new Gtk.HBox(); hb.PackStart (lbl,false,false,1); hb.PackEnd (pls); dlg.VBox.PackStart (hb); dlg.AddButton (Gtk.Stock.Cancel,0); dlg.AddButton (Gtk.Stock.Ok,1); dlg.VBox.ShowAll (); string plsname=""; while (plsname=="") { int response=dlg.Run (); if (response==0) { dlg.Hide (); dlg.Destroy (); return; } else { plsname=pls.Text.Trim (); } } dlg.Hide (); dlg.Destroy (); _pls=_col.NewPlayList(plsname); _model.Reload (); _pls_model.SetPlayList (_pls); }
protected void buttonOKClickedHandler (object sender, EventArgs e) { string fileName = tbx_fileName.Text.Trim (); string fileNameAndPath; if (!fileName.EndsWith (s_fileExtension)) { fileName += s_fileExtension; } fileNameAndPath = tbx_dirPath.Text + System.IO.Path.DirectorySeparatorChar + fileName; //warn the user if the file already exists if (System.IO.File.Exists (fileNameAndPath)) { //show message dialog Dialog dialog = null; ResponseType response = ResponseType.None; try { dialog = new Dialog ( "Warning", this, DialogFlags.DestroyWithParent | DialogFlags.Modal, "Ok", ResponseType.Yes, "No", ResponseType.No ); dialog.VBox.Add (new Label ("\n\n" + OVERWIRTE_WARNING_MESSAGE + " \n")); dialog.ShowAll (); response = (ResponseType)dialog.Run (); dialog.Destroy (); if (response == ResponseType.No) Results = false; else Results = true; } catch (Exception ex) { Console.WriteLine (ex.ToString ()); } } else { Results = true; } _experiment.ExperimentInfo.Name = tbx_experimentName.Text; //_experiment.ExperimentInfo.FilePath= flw_choseFile.CurrentFolder +"/"+ fileName; _experiment.ExperimentInfo.FilePath = fileNameAndPath;//tbx_dirPath.Text +"/"+ fileName; _experiment.ExperimentInfo.Author = tbx_author.Text; _experiment.ExperimentInfo.Description = tbx_description.Buffer.Text; this.Destroy (); }
void doDialog () { #if GTK_SHARP_2_6 bool rename = combo.Active == values.Count + 1; #else bool rename = combo.Active == values.Count; #endif Gtk.Dialog dialog = new Gtk.Dialog ( rename ? Catalog.GetString ("Rename Group") : Catalog.GetString ("New Group"), combo.Toplevel as Gtk.Window, Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator, Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, Gtk.Stock.Ok, Gtk.ResponseType.Ok); dialog.DefaultResponse = Gtk.ResponseType.Ok; dialog.HasSeparator = false; dialog.BorderWidth = 12; dialog.VBox.Spacing = 18; dialog.VBox.BorderWidth = 0; Gtk.HBox hbox = new Gtk.HBox (false, 12); Gtk.Label label = new Gtk.Label (rename ? Catalog.GetString ("_New name:") : Catalog.GetString ("_Name:")); Gtk.Entry entry = new Gtk.Entry (); label.MnemonicWidget = entry; hbox.PackStart (label, false, false, 0); entry.ActivatesDefault = true; if (rename) entry.Text = group; hbox.PackStart (entry, true, true, 0); dialog.VBox.PackStart (hbox, false, false, 0); dialog.ShowAll (); // Have to set this *after* ShowAll dialog.ActionArea.BorderWidth = 0; dialog.TransientFor = this.Toplevel as Gtk.Window; Gtk.ResponseType response = (Gtk.ResponseType)dialog.Run (); if (response == Gtk.ResponseType.Cancel || entry.Text.Length == 0) { dialog.Destroy (); Value = group; // reset combo.Active return; } string oldname = group; group = entry.Text; dialog.Destroy (); // FIXME: check that the new name doesn't already exist // This will trigger a GroupsChanged, which will eventually // update combo.Active if (rename) manager.Rename (oldname, group); else manager.Add (group); }
/// <summary> /// Handles the click on the datetag: /// Opens up a calendar dialog /// </summary> /// <param name="editor"> /// A <see cref="NoteEditor"/> /// </param> /// <param name="start"> /// A <see cref="Gtk.TextIter"/> /// </param> /// <param name="end"> /// A <see cref="Gtk.TextIter"/> /// </param> /// <returns> /// A <see cref="System.Boolean"/> /// </returns> protected override bool OnActivate(NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { calendar = new Calendar (); range = new TextRange (start, end); this.editor = editor; Dialog dialog = new Dialog (); dialog.Modal = true; dialog.VBox.Add (calendar); dialog.VBox.ShowAll (); dialog.AddButton ("OK", ResponseType.Ok); dialog.AddButton ("Cancel", ResponseType.Cancel); dialog.Response += new ResponseHandler (OnDialogResponse); dialog.Run (); dialog.Destroy (); return true; }
private void OnAdvancedSyncConfigButton (object sender, EventArgs args) { // Get saved behavior SyncTitleConflictResolution savedBehavior = SyncTitleConflictResolution.Cancel; object dlgBehaviorPref = Preferences.Get (Preferences.SYNC_CONFIGURED_CONFLICT_BEHAVIOR); if (dlgBehaviorPref != null && dlgBehaviorPref is int) // TODO: Check range of this int savedBehavior = (SyncTitleConflictResolution)dlgBehaviorPref; // Create dialog Gtk.Dialog advancedDlg = new Gtk.Dialog (Catalog.GetString ("Other Synchronization Options"), this, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator, Gtk.Stock.Close, Gtk.ResponseType.Close); // Populate dialog Gtk.Label label = new Gtk.Label (Catalog.GetString ("When a conflict is detected between " + "a local note and a note on the configured " + "synchronization server:")); label.Wrap = true; label.Xalign = 0; promptOnConflictRadio = new Gtk.RadioButton (Catalog.GetString ("Always ask me what to do.")); promptOnConflictRadio.Toggled += OnConflictOptionToggle; renameOnConflictRadio = new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Rename my local note.")); renameOnConflictRadio.Toggled += OnConflictOptionToggle; overwriteOnConflictRadio = new Gtk.RadioButton (promptOnConflictRadio, Catalog.GetString ("Replace my local note with the server's update.")); overwriteOnConflictRadio.Toggled += OnConflictOptionToggle; switch (savedBehavior) { case SyncTitleConflictResolution.RenameExistingNoUpdate: renameOnConflictRadio.Active = true; break; case SyncTitleConflictResolution.OverwriteExisting: overwriteOnConflictRadio.Active = true; break; default: promptOnConflictRadio.Active = true; break; } Gtk.VBox vbox = new Gtk.VBox (); vbox.BorderWidth = 18; vbox.PackStart (promptOnConflictRadio); vbox.PackStart (renameOnConflictRadio); vbox.PackStart (overwriteOnConflictRadio); advancedDlg.VBox.PackStart (label, false, false, 6); advancedDlg.VBox.PackStart (vbox, false, false, 0); advancedDlg.ShowAll (); // Run dialog advancedDlg.Run (); advancedDlg.Destroy (); }
public override void LaunchDialogue() { //the Type in the collection IList collection = (IList) parentRow.PropertyValue; string displayName = parentRow.PropertyDescriptor.DisplayName; //populate list with existing items itemStore = new ListStore (typeof (object), typeof (int), typeof (string)); for (int i=0; i<collection.Count; i++) { itemStore.AppendValues(collection [i], i, collection [i].ToString ()); } #region Building Dialogue //dialogue and buttons Dialog dialog = new Dialog (); dialog.Title = displayName + " Editor"; dialog.Modal = true; dialog.AllowGrow = true; dialog.AllowShrink = true; dialog.Modal = true; dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel); dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok); //three columns for items, sorting, PropGrid HBox hBox = new HBox (); dialog.VBox.PackStart (hBox, true, true, 5); //propGrid at end grid = new PropertyGrid (parentRow.ParentGrid.EditorManager); grid.CurrentObject = null; grid.WidthRequest = 200; grid.ShowHelp = false; hBox.PackEnd (grid, true, true, 5); //followed by item sorting buttons in ButtonBox VButtonBox sortButtonBox = new VButtonBox (); sortButtonBox.LayoutStyle = ButtonBoxStyle.Start; Button upButton = new Button (); Image upImage = new Image (Stock.GoUp, IconSize.Button); upImage.Show (); upButton.Add (upImage); upButton.Show (); sortButtonBox.Add (upButton); Button downButton = new Button (); Image downImage = new Image (Stock.GoDown, IconSize.Button); downImage.Show (); downButton.Add (downImage); downButton.Show (); sortButtonBox.Add (downButton); hBox.PackEnd (sortButtonBox, false, false, 5); //Third column is a VBox VBox itemsBox = new VBox (); hBox.PackStart (itemsBox, false, false, 5); //which at bottom has add/remove buttons HButtonBox addRemoveButtons = new HButtonBox(); addRemoveButtons.LayoutStyle = ButtonBoxStyle.End; Button addButton = new Button (Stock.Add); addRemoveButtons.Add (addButton); if (types [0].IsAbstract) addButton.Sensitive = false; Button removeButton = new Button (Stock.Remove); addRemoveButtons.Add (removeButton); itemsBox.PackEnd (addRemoveButtons, false, false, 10); //and at top has list (TreeView) in a ScrolledWindow ScrolledWindow listScroll = new ScrolledWindow (); listScroll.WidthRequest = 200; listScroll.HeightRequest = 320; itemsBox.PackStart (listScroll, true, true, 0); itemTree = new TreeView (itemStore); itemTree.Selection.Mode = SelectionMode.Single; itemTree.HeadersVisible = false; listScroll.AddWithViewport (itemTree); //renderers and attribs for TreeView CellRenderer rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1)); rdr = new CellRendererText (); itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2)); #endregion #region Events addButton.Clicked += new EventHandler (addButton_Clicked); removeButton.Clicked += new EventHandler (removeButton_Clicked); itemTree.Selection.Changed += new EventHandler (Selection_Changed); upButton.Clicked += new EventHandler (upButton_Clicked); downButton.Clicked += new EventHandler (downButton_Clicked); #endregion //show and get response dialog.ShowAll (); ResponseType response = (ResponseType) dialog.Run(); dialog.Destroy (); //if 'OK' put items back in collection if (response == ResponseType.Ok) { DesignerTransaction tran = CreateTransaction (parentRow.ParentGrid.CurrentObject); object old = collection; try { collection.Clear(); foreach (object[] o in itemStore) collection.Add (o[0]); EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, true); } catch { EndTransaction (parentRow.ParentGrid.CurrentObject, tran, old, collection, false); throw; } } //clean up so we start fresh if launched again itemTree = null; itemStore = null; grid = null; previousIter = TreeIter.Zero; }
void ShowLog(string text) { Dialog HistoryDialog = new Dialog("Лог работы модуля распознования.", this, Gtk.DialogFlags.DestroyWithParent); HistoryDialog.Modal = true; HistoryDialog.AddButton ("Закрыть", ResponseType.Close); TextView HistoryTextView = new TextView(); HistoryTextView.WidthRequest = 700; HistoryTextView.WrapMode = WrapMode.Word; HistoryTextView.Sensitive = false; HistoryTextView.Buffer.Text = text; Gtk.ScrolledWindow ScrollW = new ScrolledWindow(); ScrollW.HeightRequest = 500; ScrollW.Add (HistoryTextView); HistoryDialog.VBox.Add (ScrollW); HistoryDialog.ShowAll (); HistoryDialog.Run (); HistoryDialog.Destroy (); }
private void InteractiveDialogClicked (object o, EventArgs args) { Dialog dialog = new Dialog ("Interactive Dialog", this, DialogFlags.Modal | DialogFlags.DestroyWithParent, Gtk.Stock.Ok, ResponseType.Ok, "_Non-stock Button", ResponseType.Cancel); HBox hbox = new HBox (false, 8); hbox.BorderWidth = 8; dialog.VBox.PackStart (hbox, false, false, 0); Image stock = new Image (Stock.DialogQuestion, IconSize.Dialog); hbox.PackStart (stock, false, false, 0); Table table = new Table (2, 2, false); table.RowSpacing = 4; table.ColumnSpacing = 4; hbox.PackStart (table, true, true, 0); Label label = new Label ("_Entry1"); table.Attach (label, 0, 1, 0, 1); Entry localEntry1 = new Entry (); localEntry1.Text = entry1.Text; table.Attach (localEntry1, 1, 2, 0, 1); label.MnemonicWidget = localEntry1; label = new Label ("E_ntry2"); table.Attach (label, 0, 1, 1, 2); Entry localEntry2 = new Entry (); localEntry2.Text = entry2.Text; table.Attach (localEntry2, 1, 2, 1, 2); label.MnemonicWidget = localEntry2; hbox.ShowAll (); ResponseType response = (ResponseType) dialog.Run (); if (response == ResponseType.Ok) { entry1.Text = localEntry1.Text; entry2.Text = localEntry2.Text; } dialog.Destroy (); }
void DeadlineButton_Clicked(object sender, EventArgs e) { var dialog = new Dialog ("Sample", null, DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.AddButton ("Cancel", ResponseType.Cancel); dialog.AddButton ("OK", ResponseType.Ok); dialog.ContentArea.Add (calendar); calendar.Show (); if (dialog.Run () == (int)ResponseType.Ok) { deadlineButton.Label = calendar.Date.ToShortDateString (); } dialog.Destroy (); }
/// <summary> /// User is about to edit a cell. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event arguments</param> private void OnCellBeginEdit(object sender, EditingStartedArgs e) { this.userEditingCell = true; IGridCell where = GetCurrentCell; if (where.RowIndex >= DataSource.Rows.Count) { for (int i = DataSource.Rows.Count; i <= where.RowIndex; i++) { DataRow row = DataSource.NewRow(); DataSource.Rows.Add(row); } } this.valueBeforeEdit = this.DataSource.Rows[where.RowIndex][where.ColumnIndex]; Type dataType = this.valueBeforeEdit.GetType(); if (dataType == typeof(DateTime)) { Dialog dialog = new Dialog("Select date", gridview.Toplevel as Window, DialogFlags.DestroyWithParent); dialog.SetPosition(WindowPosition.None); VBox topArea = dialog.VBox; topArea.PackStart(new HBox()); Calendar calendar = new Calendar(); calendar.DisplayOptions = CalendarDisplayOptions.ShowHeading | CalendarDisplayOptions.ShowDayNames | CalendarDisplayOptions.ShowWeekNumbers; calendar.Date = (DateTime)this.valueBeforeEdit; topArea.PackStart(calendar, true, true, 0); dialog.ShowAll(); dialog.Run(); // What SHOULD we do here? For now, assume that if the user modified the date in the calendar dialog, // the resulting date is what they want. Otherwise, keep the text-editing (Entry) widget active, and // let the user enter a value manually. if (calendar.Date != (DateTime)this.valueBeforeEdit) { DateTime date = calendar.GetDate(); this.DataSource.Rows[where.RowIndex][where.ColumnIndex] = date; CellRendererText render = sender as CellRendererText; if (render != null) { render.Text = String.Format("{0:d}", date); if (e.Editable is Entry) { (e.Editable as Entry).Text = render.Text; (e.Editable as Entry).Destroy(); this.userEditingCell = false; if (this.CellsChanged != null) { GridCellsChangedArgs args = new GridCellsChangedArgs(); args.ChangedCells = new List<IGridCell>(); args.ChangedCells.Add(this.GetCell(where.ColumnIndex, where.RowIndex)); this.CellsChanged(this, args); } } } } dialog.Destroy(); } }
protected void OnButtonPickDatePeriodClicked(object sender, EventArgs e) { #region Widget creation Window parentWin = (Window)Toplevel; var selectDate = new Dialog ("Укажите период", parentWin, DialogFlags.DestroyWithParent); selectDate.Modal = true; selectDate.AddButton ("Отмена", ResponseType.Cancel); selectDate.AddButton ("Ok", ResponseType.Ok); periodSummary = new Label(); selectDate.VBox.Add(periodSummary); HBox hbox = new HBox (true, 6); StartDateCalendar = new Calendar (); StartDateCalendar.DisplayOptions = DisplayOptions; StartDateCalendar.Date = StartDateOrNull ?? DateTime.Today; StartDateCalendar.DaySelected += StartDateCalendar_DaySelected; EndDateCalendar = new Calendar (); EndDateCalendar.DisplayOptions = DisplayOptions; EndDateCalendar.Date = EndDateOrNull ?? DateTime.Today; EndDateCalendar.DaySelected += EndDateCalendar_DaySelected; hbox.Add (StartDateCalendar); hbox.Add (EndDateCalendar); selectDate.VBox.Add (hbox); selectDate.ShowAll (); #endregion int response = selectDate.Run (); if (response == (int)ResponseType.Ok) { startDate = StartDateCalendar.GetDate (); endDate = EndDateCalendar.GetDate (); OnPeriodChanged (); } #region Destroy EndDateCalendar.Destroy (); StartDateCalendar.Destroy (); hbox.Destroy (); selectDate.Destroy (); #endregion }
private EventHandler RemoveFolderFromSyncDelegate(string reponame) { return delegate { using( Dialog dialog = new Dialog (String.Format(CmisSync.Properties_Resources.RemoveSyncTitle), null, Gtk.DialogFlags.DestroyWithParent)) { dialog.Modal = true; using (var noButton = dialog.AddButton ("No, please continue synchronizing", ResponseType.No)) using (var yesButton = dialog.AddButton ("Yes, stop synchronizing permanently", ResponseType.Yes)) { dialog.Response += delegate (object obj, ResponseArgs args){ if(args.ResponseId == ResponseType.Yes) Controller.RemoveFolderFromSyncClicked(reponame); }; dialog.Run(); dialog.Destroy(); } } }; }
public void RunManager() { if (master == null) return; Widget container = ConstructUI (); if (container == null) return; Widget parent = master.Controller; if (parent != null) parent = parent.Toplevel; Dialog dialog = new Dialog (); dialog.Title = "Layout management"; dialog.TransientFor = parent as Window; dialog.AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close); dialog.SetDefaultSize (-1, 300); dialog.VBox.Add (container); dialog.Run (); dialog.Destroy (); }
private void modify_job(ArrayList al, string id) { string jobid = null; string number = null; string status = null; string user = null; string pages = null; string dials = null; object sendat = null; string error = null; IEnumerator enu = al.GetEnumerator(); while ( enu.MoveNext() ) { enu.MoveNext(); jobid = (string)enu.Current; enu.MoveNext(); number = (string)enu.Current; enu.MoveNext(); status = (string)enu.Current; enu.MoveNext(); user = (string)enu.Current; enu.MoveNext(); pages = (string)enu.Current; enu.MoveNext(); int idx = ((string)enu.Current).LastIndexOf(':'); dials = ((string)enu.Current).Substring(idx + 1); enu.MoveNext(); sendat = (object)enu.Current; enu.MoveNext(); error = (string)enu.Current; } #if DEBUG Console.WriteLine("[ModifyJob] Date is {0}", sendat); #endif Glade.XML xml = new Glade.XML (null, "gfax.glade","vbox74",null); Dialog mjd = new Dialog(); mjd.VBox.Add(xml.GetWidget("vbox74")); Gtk.Entry mje = (Gtk.Entry)xml.GetWidget("ModifyJobNumberEntry"); Gnome.DateEdit mjde = (Gnome.DateEdit)xml.GetWidget("ModifyJobDate"); Gtk.SpinButton mjmd = (Gtk.SpinButton)xml.GetWidget("MaxDialsSpinbutton"); mjd.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); mjd.AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok); // this is to re-enable the entry for editing so it won't be selected // to begin with??? Maybe something to do with re-parenting or something. mje.FocusInEvent += new FocusInEventHandler (on_ModifyJobNumberEntry_focus_in_event); mje.IsEditable = false; mje.Text = number.Trim(); mjde.Time = sendat == null ? new DateTime(): (DateTime)sendat; mjmd.Value = Convert.ToDouble(dials.Trim()); ResponseType result = (ResponseType)mjd.Run (); if (result == ResponseType.Ok) { DateTime newsend = (mjde.Time).ToUniversalTime(); // Format time to send - timezone is in UTC format. string tts = String.Format("{0}{1:00}{2:00}{3:00}{4:00}", newsend.Year, newsend.Month, newsend.Day, newsend.Hour, newsend.Minute); if (id == "sendq" ) Fax.modify_job(jobid, mje.Text, tts, (mjmd.ValueAsInt).ToString()); else // "doneq" Fax.resubmit_job(jobid, mje.Text, tts, (mjmd.ValueAsInt).ToString()); mjd.Destroy(); } else { mjd.Destroy(); } async_update_queue_status("sendq"); ModifyJobButton.Sensitive = false; DeleteJobButton.Sensitive = false; }
protected virtual void OnIconButtonClicked (object sender, System.EventArgs e) { IconSelection iconSelection = new IconSelection(); Dialog dialog = new Dialog("Select Icon", this, DialogFlags.DestroyWithParent); dialog.Modal = true; dialog.Add(iconSelection); //dialog.AddButton("Close", ResponseType.Close); dialog.Run(); dialog.Destroy(); }
void ShowLog() { if (RecognizeLog == null) return; string text = ""; foreach(string str in RecognizeLog.Logs) { text += str + Environment.NewLine; } Dialog HistoryDialog = new Dialog("Лог работы модуля распознования.", this, Gtk.DialogFlags.DestroyWithParent); HistoryDialog.Modal = true; HistoryDialog.AddButton ("Закрыть", ResponseType.Close); TextView HistoryTextView = new TextView(); HistoryTextView.WidthRequest = 700; HistoryTextView.WrapMode = WrapMode.Word; HistoryTextView.Sensitive = false; HistoryTextView.Buffer.Text = text; Gtk.ScrolledWindow ScrollW = new ScrolledWindow(); ScrollW.HeightRequest = 500; ScrollW.Add (HistoryTextView); HistoryDialog.VBox.Add (ScrollW); HistoryDialog.ShowAll (); HistoryDialog.Run (); HistoryDialog.Destroy (); }
public static void RunChangeLogDlg(Gtk.Window parent) { Dialog HistoryDialog = new Dialog ("История версий программы", parent, Gtk.DialogFlags.DestroyWithParent); HistoryDialog.Modal = true; HistoryDialog.AddButton ("Закрыть", ResponseType.Close); System.IO.StreamReader HistoryFile = new System.IO.StreamReader ("changes.txt"); TextView HistoryTextView = new TextView (); HistoryTextView.WidthRequest = 700; HistoryTextView.WrapMode = WrapMode.Word; HistoryTextView.Sensitive = false; HistoryTextView.Buffer.Text = HistoryFile.ReadToEnd (); Gtk.ScrolledWindow ScrollW = new ScrolledWindow (); ScrollW.HeightRequest = 500; ScrollW.Add (HistoryTextView); HistoryDialog.VBox.Add (ScrollW); HistoryDialog.ShowAll (); HistoryDialog.Run (); HistoryDialog.Destroy (); }
protected virtual void OnAddActionActivated(object sender, System.EventArgs e) { ResponseType result; if(SimpleMode) { NewNode = true; editNode = new Dialog("Новый " + nameNode, this, Gtk.DialogFlags.DestroyWithParent); BuildSimpleEditorDialog (); editNode.ShowAll(); result = (ResponseType) editNode.Run (); inputNameEntry.Destroy(); editNode.Destroy (); } else { //Вызываем событие в основном приложении для запуска диалога элемента справочника result = OnRunReferenceItemDlg (TableRef, true, -1, ParentId); } if (result == ResponseType.Ok) { UpdateList(); RefChanged = true; } }
public override void LaunchDialogue() { //dialogue and buttons Dialog dialog = new Dialog (); dialog.Title = "Expandable Object Editor "; dialog.Modal = true; dialog.AllowGrow = true; dialog.AllowShrink = true; dialog.Modal = true; dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel); dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok); //propGrid grid = new PropertyGrid (parentRow.ParentGrid.EditorManager); grid.CurrentObject = parentRow.PropertyValue; grid.WidthRequest = 200; grid.ShowHelp = false; dialog.VBox.PackStart (grid, true, true, 5); //show and get response dialog.ShowAll (); ResponseType response = (ResponseType) dialog.Run(); dialog.Destroy (); //if 'OK' put items back in collection if (response == ResponseType.Ok) { } //clean up so we start fresh if launched again }
protected virtual void OnEditActionActivated(object sender, System.EventArgs e) { ResponseType result; TreeIter iter; treeviewref.Selection.GetSelected(out iter); SelectedID = Convert.ToInt32(filter.GetValue(iter,0)); string NameOfNode = filter.GetValue(iter,1).ToString(); string DiscriptionOfNode; if(DescriptionField) DiscriptionOfNode = filter.GetValue(iter,2).ToString(); else DiscriptionOfNode = ""; if(SimpleMode) { NewNode = false; editNode = new Dialog("Редактирование " + nameNode, this, Gtk.DialogFlags.DestroyWithParent); BuildSimpleEditorDialog (); inputNameEntry.Text = NameOfNode; inputDiscriptionEntry.Text = DiscriptionOfNode; editNode.ShowAll(); result = (ResponseType)editNode.Run (); inputNameEntry.Destroy(); editNode.Destroy (); } else { //Вызываем событие в основном приложении для запуска диалога элемента справочника result = OnRunReferenceItemDlg (TableRef, false, SelectedID, ParentId); } if(result == ResponseType.Ok) { UpdateList(); RefChanged = true; } }
protected void OnButtonOkClicked (object sender, EventArgs e) { this.error = ""; this.challengePwd = oldChallengePwd; this.experimentPwd = oldExperimentPwd; //check challenge password if (!string.IsNullOrEmpty (challengePwdEntry.Text) || !string.IsNullOrEmpty (reinsChallengePwdEntry.Text)) { if (challengePwdEntry.Text.Length < 8) { error += "Challenge password must be at least 8 characters long\n"; } else if (string.IsNullOrEmpty (reinsChallengePwdEntry.Text)) { error += "Please reinsert the challenge password\n"; } else if (!challengePwdEntry.Text.Equals (reinsChallengePwdEntry.Text)) { error += "Challenge passwords must be the same\n"; } else { isChallengePwdOk = true; passwordChanged = true; this.challengePwd = challengePwdEntry.Text; } } else { if (!challengePwdEntry.Text.Equals (oldChallengePwd)) { this.challengePwd = challengePwdEntry.Text; passwordChanged = true; } } //check experiment password if (!string.IsNullOrEmpty (experimentPwdEntry.Text) || !string.IsNullOrEmpty (this.reinsExperimentPwdEntry.Text)) { if (experimentPwdEntry.Text.Length < 8) { error += "Experiment password must be at least 8 characters long\n"; } else if (string.IsNullOrEmpty (reinsExperimentPwdEntry.Text)) { this.error += "Please reinsert the experiment password\n"; } else if (!experimentPwdEntry.Text.Equals (reinsExperimentPwdEntry.Text)) { this.error += "Experiment passwords must be the same\n"; } else { //pwds are the same this.isExperimentPwdOk = true; this.passwordChanged = true; this.experimentPwd = experimentPwdEntry.Text; } } else { if (!experimentPwdEntry.Text.Equals (oldExperimentPwd)) { this.experimentPwd = experimentPwdEntry.Text; passwordChanged = true; } } if (this.challengePwdEntry.Text.Equals (this.experimentPwdEntry.Text) && !string.IsNullOrEmpty (this.challengePwdEntry.Text)) { this.error += "Challenge and Experiment password cannot be the same\n"; } if (!string.IsNullOrEmpty (this.error)) { //in this there is an error so we show a Warning window to the user //to let him know Dialog dialog = null; ResponseType response = ResponseType.None; try { dialog = new Dialog ( "Warning", this, DialogFlags.DestroyWithParent | DialogFlags.Modal, "Ok", ResponseType.Yes ); dialog.VBox.Add (new Label ("\n\n " + this.error + " \n")); dialog.ShowAll (); response = (ResponseType)dialog.Run (); } finally { if (dialog != null) dialog.Destroy (); } return; } else if (string.IsNullOrEmpty (this.experimentPwdEntry.Text) && !string.IsNullOrEmpty (this.challengePwdEntry.Text)) { //there is only a Challenge password so we warn the user he will not be able to modify the //challenge experiment any more Dialog dialog = null; ResponseType response = ResponseType.None; try { dialog = new Dialog ( "Warning", this, DialogFlags.DestroyWithParent | DialogFlags.Modal, "Ok", ResponseType.Yes , "Cancel", ResponseType.No ); dialog.VBox.Add (new Label (WARNING_MESSAGE_ONLY_CHALLENGE_PASSWORD)); dialog.ShowAll (); response = (ResponseType)dialog.Run (); } finally { if (dialog != null) dialog.Destroy (); } if (response == ResponseType.Yes) this.Destroy (); else return; } else { this.Destroy (); } }
/// <summary> /// Activated when the user clicks the "Configure" button. Opens a new dialog containing the configuration /// widget of the selected plugin /// </summary> /// <param name="sender"> /// A <see cref="System.Object"/> -- not used /// </param> /// <param name="e"> /// A <see cref="EventArgs"/> -- not used /// </param> void OnConfigureButtonClicked(object sender, EventArgs e) { LiveRadioPluginListModel model = plugin_view.Model as LiveRadioPluginListModel; ILiveRadioPlugin plugin = model[plugin_view.Model.Selection.FocusedIndex]; Dialog dialog = new Dialog (); dialog.Title = String.Format ("LiveRadio Plugin {0} configuration", plugin.Name); dialog.IconName = "gtk-preferences"; dialog.Resizable = false; dialog.BorderWidth = 6; dialog.ContentArea.Spacing = 12; dialog.ContentArea.PackStart (plugin.ConfigurationWidget, false, false, 0); Button save_button = new Button (Stock.Save); Button cancel_button = new Button (Stock.Cancel); dialog.AddActionWidget (cancel_button, 0); dialog.AddActionWidget (save_button, 0); cancel_button.Clicked += delegate { dialog.Destroy (); }; save_button.Clicked += delegate { plugin.SaveConfiguration (); dialog.Destroy (); }; dialog.ShowAll (); }