本文整理汇总了C#中Gtk.Dialog.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Dialog.Run方法的具体用法?C# Dialog.Run怎么用?C# Dialog.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Dialog
的用法示例。
在下文中一共展示了Dialog.Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(string[] args)
{
Application.Init ();
try {
InfoManager.Init ();
} catch (Exception e) {
Dialog d = new Dialog ("Error", null, DialogFlags.Modal, new object [] {
"OK", ResponseType.Ok });
d.VBox.Add (new Label ("There was a problem while trying to initialize the InfoManager\n\n" + e.ToString ()));
d.VBox.ShowAll ();
d.Run ();
return;
}
string profile_path = null;
if (args.Length != 0 && args[0].StartsWith ("--profile-path="))
profile_path = args[0].Substring (15);
MainWindow win = new MainWindow (profile_path);
win.Show ();
if (args.Length == 2 && File.Exists (args [0]) && File.Exists (args [1])){
win.ComparePaths (args [0], args [1]);
}
Application.Run ();
}
示例2: onClick
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 ();
}
示例3: RunDialog
private bool RunDialog (Dialog dlg)
{
bool result = false;
try {
if (dlg.Run () == (int)ResponseType.Ok)
result = true;
} finally {
dlg.Destroy ();
}
return result;
示例4: buttonOKClickedHandler
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 ();
}
示例5: TakePwd
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;
}
示例6: RunDialog
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;
}
示例7: OnEditActionActivated
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;
}
}
示例8: OnActivate
/// <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;
}
示例9: OnAddActionActivated
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;
}
}
示例10: OnAdvancedSyncConfigButton
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 ();
}
示例11: InteractiveDialogClicked
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 ();
}
示例12: OnButtonPickDatePeriodClicked
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
}
示例13: RunChangeLogDlg
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 ();
}
示例14: OnIconButtonClicked
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();
}
示例15: LaunchDialogue
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
}