protected void AddButton(string stock_id, Gtk.ResponseType response, bool is_default) { Gtk.Button button = new Gtk.Button(stock_id); button.CanDefault = true; AddButton(button, response, is_default); }
private void ButtonOpen_Clicked(object sender, EventArgs a) { Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Выберете файл", null, Gtk.FileChooserAction.Open); fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); fcd.DefaultResponse = Gtk.ResponseType.Ok; fcd.SelectMultiple = true; Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run(); if (response == Gtk.ResponseType.Ok) { _playlist = fcd.Filenames.ToList(); if (_player != null) { _player.Stop(); _player = null; } new Task(() => LoadFile(_playlist.First())).Start(); _currentIndex = 0; fcd.Dispose(); treestore.Clear(); foreach (var item in _playlist) { treestore.AppendValues(item); } } }
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); } }
protected override void OnResponse(Gtk.ResponseType response_id) { if (Canceled != null) { Canceled(this, EventArgs.Empty); } }
void QuitEvent(object sender, EventArgs args) { if (autostarted) { HigMessageDialog dialog = new HigMessageDialog(win, DialogFlags.Modal, MessageType.Question, ButtonsType.YesNo, Catalog.GetString("Disable Searching"), Catalog.GetString("You are about to close the search tray. The search tray is automatically started at login-time. Would you like to disable it for future sessions?")); Gtk.ResponseType response = (Gtk.ResponseType)dialog.Run(); if (response == Gtk.ResponseType.Yes) { Conf.Searching.Autostart = false; Conf.Save(true); // If the user doesn't want to have Best autostart, he probably doesn't // want to keep the daemon around either. Bad call dude, bad call. Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.FileName = "beagle-shutdown"; try { p.Start(); } catch (Exception ex) {} } } win.StoreSettingsInConf(true); Application.Quit(); }
protected void LoadProbeClicked(object sender, EventArgs e) { Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.Open); fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); fcd.DefaultResponse = Gtk.ResponseType.Ok; fcd.SelectMultiple = false; Gtk.FileFilter filter = new FileFilter { Name = "NIRS probe" }; filter.AddMimeType("XML"); filter.AddMimeType("Matlab"); filter.AddPattern("*.SD"); filter.AddPattern("*.xml"); fcd.Filter = filter; fcd.SetCurrentFolder(MainClass.win.settings.PROBEDIR); Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run(); if (response == Gtk.ResponseType.Ok) { probe = nirs.io.LoadProbe(fcd.Filename); Sdgdraw(sender, e); } probefilename = fcd.Filename; fcd.Destroy(); }
protected override void OnResponse(Gtk.ResponseType type) { if (type != Gtk.ResponseType.Ok) { changeSet.GlobalComment = oldMessage; } base.OnResponse(type); }
void HandlePref_toolbuttonhandleClicked(object sender, EventArgs e) { PreferencesDialog d = new PreferencesDialog(this.session); //d.ShowAll(); Gtk.ResponseType resp = (Gtk.ResponseType)d.Run(); d.Destroy(); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); var plotView = new PlotView(); this.Add(plotView); plotView.ShowAll(); // Choose file Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.Open); fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); fcd.DefaultResponse = Gtk.ResponseType.Ok; fcd.SelectMultiple = false; Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run(); String DataFile = fcd.Filename; if (response == ResponseType.Ok) { // Run scan Matching ScanMatching.RunScanMatch(DataFile); Console.WriteLine($"{DataFile} selected"); } else { Console.WriteLine("no file selected"); } fcd.Destroy(); // Run Plot var model = new PlotModel { Title = "Scan Matching" }; var scatterSeries = new ScatterSeries { MarkerType = MarkerType.Circle }; var r = new Random(314); for (int i = 0; i < D_Scan_Matching_GUI.ScanMatching.rPNn.ColumnCount; i++) { var x = D_Scan_Matching_GUI.ScanMatching.rPNn[0, i]; var y = D_Scan_Matching_GUI.ScanMatching.rPNn[1, i]; var size = 5; var colorValue = 1500; scatterSeries.Points.Add(new ScatterPoint(x, y, size, colorValue)); } model.Series.Add(scatterSeries); model.Axes.Add(new LinearColorAxis { Position = AxisPosition.Right, Palette = OxyPalettes.Jet(200) }); plotView.Model = model; }
protected override void OnResponse(Gtk.ResponseType type) { if (type == Gtk.ResponseType.Ok) { // Update the change set ArrayList todel = new ArrayList(); foreach (ChangeSetItem it in changeSet.Items) { if (!selected.Contains(it.LocalPath)) { todel.Add(it.LocalPath); } } foreach (string file in todel) { changeSet.RemoveFile(file); } changeSet.GlobalComment = Message; // Perform the commit int n; for (n = 0; n < extensions.Count; n++) { CommitDialogExtension ext = (CommitDialogExtension)extensions [n]; bool res; try { res = ext.OnBeginCommit(changeSet); } catch (Exception ex) { MessageService.ShowException(ex); res = false; } System.Console.WriteLine("RES: " + res); if (!res) { // Commit failed. Rollback the previous extensions for (int m = 0; m < n; m++) { ext = (CommitDialogExtension)extensions [m]; try { ext.OnEndCommit(changeSet, false); } catch {} } return; } Hide(); } } else { changeSet.GlobalComment = oldMessage; } base.OnResponse(type); }
public bool PerformRetrySkip() { error_response = Gtk.ResponseType.None; RetrySkipVisible = true; error_response_event = new AutoResetEvent(false); error_response_event.WaitOne(); RetrySkipVisible = false; return(error_response == Gtk.ResponseType.Yes); }
protected override void OnResponse(Gtk.ResponseType type) { if (type != Gtk.ResponseType.Ok) { changeSet.GlobalComment = oldMessage; } else if (!ButtonCommitClicked()) { return; } base.OnResponse(type); }
void OnSelectLayoutClicked(object o, EventArgs args) { LayoutSelectionDialog lsd = new LayoutSelectionDialog(null); Gtk.ResponseType response = (Gtk.ResponseType)lsd.Run(); if (response == Gtk.ResponseType.Ok && lsd.SelectedLayout != null) { LayoutFileEntry.Text = lsd.SelectedLayout; } lsd.Destroy(); }
private void AddButton(string stock_id, Gtk.ResponseType response, bool is_default) { Gtk.Button button = new Gtk.Button(stock_id); button.CanDefault = true; button.Show(); AddActionWidget(button, response); if (is_default) { DefaultResponse = response; button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Return, 0, Gtk.AccelFlags.Visible); } }
private void getDataClicked(object sender, EventArgs e) { Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.Open); fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); fcd.DefaultResponse = Gtk.ResponseType.Ok; fcd.SelectMultiple = false; Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run(); if (response == Gtk.ResponseType.Ok) { dataSourceEntry.Text = fcd.Filename; } fcd.Destroy(); }
private void getOutputPath(object sender, EventArgs e) { Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Open File", null, Gtk.FileChooserAction.SelectFolder); fcd.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); fcd.AddButton(Gtk.Stock.Open, Gtk.ResponseType.Ok); fcd.DefaultResponse = Gtk.ResponseType.Ok; fcd.SelectMultiple = false; Gtk.ResponseType response = (Gtk.ResponseType)fcd.Run(); if (response == Gtk.ResponseType.Ok) { outputPathEntry.Text = fcd.CurrentFolder; } fcd.Destroy(); }
protected void AddButton(Gdk.Pixbuf pixbuf, string label_text, Gtk.ResponseType response, bool is_default) { Gtk.Button button = new Gtk.Button(); Gtk.Image image = new Gtk.Image(pixbuf); // NOTE: This property is new to GTK+ 2.10, but we don't // really need the line because we're just setting // it to the default value anyway. //button.ImagePosition = Gtk.PositionType.Left; button.Image = image; button.Label = label_text; button.UseUnderline = true; button.CanDefault = true; AddButton(button, response, is_default); }
public static bool ShowQuestion(string Msg) { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Question, ButtonsType.OkCancel, Msg); Gtk.ResponseType result = (ResponseType)md.Run(); md.Destroy(); if (result == Gtk.ResponseType.Ok) { return(true); } else { return(false); } }
private void AddButton(Gtk.Button button, Gtk.ResponseType response, bool is_default) { button.Show(); AddActionWidget(button, response); if (is_default) { DefaultResponse = response; button.AddAccelerator("activate", accel_group, (uint)Gdk.Key.Escape, 0, Gtk.AccelFlags.Visible); } }
protected override void OnResponse(Gtk.ResponseType response_id) { if (HoursEntry.Text == "") { HoursEntry.Text = "0"; } if (MinutesEntry.Text == "") { MinutesEntry.Text = "0"; } if (SecondsEntry.Text == "") { SecondsEntry.Text = "0"; } Time = HoursEntry.Text + ":" + MinutesEntry.Text + ":" + SecondsEntry.Text; }
void HandleMenuitem2ButtonPressEvent(object o, ButtonPressEventArgs args) { //Gdk.Color color=new Gdk.Color(); Gtk.ColorSelection selection; Console.Write("Menu Item 2"); Gtk.ColorSelectionDialog dlg = new Gtk.ColorSelectionDialog("Select path color"); Gtk.ResponseType result = (Gtk.ResponseType)dlg.Run(); if (result == Gtk.ResponseType.Ok) { selection = dlg.ColorSelection; PathColor = selection.CurrentColor; } //else Console.WriteLine("Cancelled"); dlg.Destroy(); }
protected void ResaveFile(object sender, EventArgs e) { // This function resaves the last data file to replace changes to the stimulus events and demographics MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "Replace Existing File?"); Gtk.ResponseType result = (ResponseType)md.Run(); md.Destroy(); if (result == Gtk.ResponseType.Yes) { SaveDataNow(0, Int32.MaxValue, 0, true); // this will make a new file with the same scan # } else { SaveDataNow(0, Int32.MaxValue, 0, false); // this will make a new file with the same scan # but a different time stamp } }
protected void OnAddSpecificWarpButtonClicked(object sender, EventArgs e) { // Check if a pointer warp already exists List <WarpSourceData> warps = sourceGroup.GetMapWarpSourceData(map); foreach (WarpSourceData sourceData in warps) { if (sourceData.WarpSourceType == WarpSourceType.PointerWarp) { // Warning dialog Gtk.MessageDialog d = new Gtk.MessageDialog(null, DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.YesNo, "This map already has specific-position warp data; adding another would be redundant. Continue anyway?"); Gtk.ResponseType response = (ResponseType)d.Run(); d.Destroy(); if (response == ResponseType.Yes) { break; } else { return; } } } WarpSourceData data = new WarpSourceData(Project, WarpSourceData.WarpCommands[(int)WarpSourceType.PointerWarp], WarpSourceData.DefaultValues[(int)WarpSourceType.PointerWarp], sourceGroup.FileParser, new List <int> { -1, 2 }); data.Map = map; sourceGroup.AddWarpSourceData(data); SetWarpIndex((int)indexSpinButton.Adjustment.Upper + 1); }
public static bool CloseProject() { if (Project.Modified) { string msg = Catalog.GetString("Do you want to save the project before closing?"); Gtk.MessageDialog dlg = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Question, ButtonsType.None, msg); dlg.AddButton(Catalog.GetString("Close without saving"), Gtk.ResponseType.No); dlg.AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dlg.AddButton(Gtk.Stock.Save, Gtk.ResponseType.Yes); Gtk.ResponseType res = (Gtk.ResponseType)dlg.Run(); dlg.Destroy(); if (res == Gtk.ResponseType.Cancel) { return(false); } if (res == Gtk.ResponseType.Yes) { if (!SaveProject()) { return(false); } } } object[] obs = new object [openWindows.Count]; openWindows.Values.CopyTo(obs, 0); foreach (Gtk.Widget page in obs) { WidgetNotebook.Remove(page); page.Destroy(); } openWindows.Clear(); Project.Close(); MainWindow.Title = "Stetic"; ProjectView.Clear(); return(true); }
protected override void OnResponse(Gtk.ResponseType type) { base.OnResponse(type); if (type != Gtk.ResponseType.Ok) { changeSet.GlobalComment = oldMessage; EndCommit(false); } else if (!ButtonCommitClicked()) { return; } if (type == Gtk.ResponseType.Ok) { VersionControlService.NotifyBeforeCommit(vc, changeSet); new CommitWorker(vc, changeSet, this).StartAsync(); return; } }
private bool RunInputTextDialog(string title, string button1, string originalcomment, out string comment) { Dialog d = new Dialog(); d.SetIconFromFile(DeskFlickrUI.ICON_PATH); d.Title = title; d.AddButton(button1, Gtk.ResponseType.Ok); d.AddButton(Stock.Cancel, Gtk.ResponseType.Cancel); ScrolledWindow swin = new ScrolledWindow(); swin.HscrollbarPolicy = Gtk.PolicyType.Never; swin.VscrollbarPolicy = Gtk.PolicyType.Automatic; swin.ShadowType = Gtk.ShadowType.EtchedIn; TextView tv = new TextView(); tv.WrapMode = Gtk.WrapMode.WordChar; tv.BorderWidth = 2; tv.Buffer.Text = originalcomment; swin.Add(tv); d.VBox.Add(swin); d.WidthRequest = 400; d.HeightRequest = 200; d.ShowAll(); Gtk.ResponseType response = (Gtk.ResponseType)d.Run(); comment = tv.Buffer.Text; d.Destroy(); if (response == Gtk.ResponseType.Cancel) { return(false); } else if (comment.Trim() == "") { return(false); } else { return(true); } }
void Install() { insSeparator.Visible = true; boxProgress.Visible = true; buttonOk.Sensitive = false; string txt; string errmessage; string warnmessage; ThreadStart oper; if (uninstallIds == null) { installMonitor = new InstallMonitor(globalProgressLabel, mainProgressBar, Catalog.GetString("Installing Add-ins")); oper = new ThreadStart(RunInstall); errmessage = Catalog.GetString("The installation failed!"); warnmessage = Catalog.GetString("The installation has completed with warnings."); } else { installMonitor = new InstallMonitor(globalProgressLabel, mainProgressBar, Catalog.GetString("Uninstalling Add-ins")); oper = new ThreadStart(RunUninstall); errmessage = Catalog.GetString("The uninstallation failed!"); warnmessage = Catalog.GetString("The uninstallation has completed with warnings."); } installing = true; oper(); installing = false; buttonCancel.Visible = false; buttonOk.Label = Gtk.Stock.Close; buttonOk.UseStock = true; if (installMonitor.Success && installMonitor.Warnings.Count == 0) { Respond(Gtk.ResponseType.Ok); return; } else if (installMonitor.Success) { txt = "<b>" + warnmessage + "</b>\n\n"; foreach (string s in installMonitor.Warnings) { txt += GLib.Markup.EscapeText(s) + "\n"; } response = Gtk.ResponseType.Ok; buttonOk.Sensitive = true; } else { buttonCancel.Label = Gtk.Stock.Close; buttonCancel.UseStock = true; txt = "<span foreground=\"red\"><b>" + errmessage + "</b></span>\n\n"; foreach (string s in installMonitor.Errors) { txt += GLib.Markup.EscapeText(s) + "\n"; } response = Gtk.ResponseType.Cancel; buttonOk.Sensitive = true; } ShowMessage(txt); }
protected override void OnResponse(Gtk.ResponseType response_id) { base.OnResponse(response_id); Destroy(); }
void Install () { insSeparator.Visible = true; boxProgress.Visible = true; buttonOk.Sensitive = false; string txt; string errmessage; string warnmessage; ThreadStart oper; if (uninstallIds == null) { installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Installing Add-ins")); oper = new ThreadStart (RunInstall); errmessage = Catalog.GetString ("The installation failed!"); warnmessage = Catalog.GetString ("The installation has completed with warnings."); } else { installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Uninstalling Add-ins")); oper = new ThreadStart (RunUninstall); errmessage = Catalog.GetString ("The uninstallation failed!"); warnmessage = Catalog.GetString ("The uninstallation has completed with warnings."); } installing = true; oper (); installing = false; buttonCancel.Visible = false; buttonOk.Label = Gtk.Stock.Close; buttonOk.UseStock = true; if (installMonitor.Success && installMonitor.Warnings.Count == 0) { Respond (Gtk.ResponseType.Ok); return; } else if (installMonitor.Success) { txt = "<b>" + warnmessage + "</b>\n\n"; foreach (string s in installMonitor.Warnings) txt += GLib.Markup.EscapeText (s) + "\n"; response = Gtk.ResponseType.Ok; buttonOk.Sensitive = true; } else { buttonCancel.Label = Gtk.Stock.Close; buttonCancel.UseStock = true; txt = "<span foreground=\"red\"><b>" + errmessage + "</b></span>\n\n"; foreach (string s in installMonitor.Errors) txt += GLib.Markup.EscapeText (s) + "\n"; response = Gtk.ResponseType.Cancel; buttonOk.Sensitive = true; } ShowMessage (txt); }
void HandleSkipClicked(object obj, EventArgs args) { error_response = Gtk.ResponseType.No; error_response_event.Set (); }
void HandleRetryClicked(object obj, EventArgs args) { error_response = Gtk.ResponseType.Yes; error_response_event.Set (); }
public bool PerformRetrySkip() { error_response = Gtk.ResponseType.None; RetrySkipVisible = true; error_response_event = new AutoResetEvent (false); error_response_event.WaitOne (); RetrySkipVisible = false; return (error_response == Gtk.ResponseType.Yes); }
void HandleRetryClicked(object obj, EventArgs args) { error_response = Gtk.ResponseType.Yes; error_response_event.Set(); }
void HandleSkipClicked(object obj, EventArgs args) { error_response = Gtk.ResponseType.No; error_response_event.Set(); }