本文整理汇总了C#中Gtk.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Destroy方法的具体用法?C# Gtk.Destroy怎么用?C# Gtk.Destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.Destroy方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GrabWindow
public static void GrabWindow( Gtk.Window window )
{
window.GrabFocus();
Grab.Add(window);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(window.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success)
{
grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success)
{
Grab.Remove(window);
window.Destroy();
}
}
else
{
Grab.Remove(window);
window.Destroy();
}
}
示例2: ShowCustomDialog
public static int ShowCustomDialog (Gtk.Dialog dialog, Gtk.Window parent)
{
try {
return RunCustomDialog (dialog, parent);
} finally {
if (dialog != null)
dialog.Destroy ();
}
}
示例3: Fade
public static void Fade(Gtk.Window w)
{
//Fadein (w);
//Thread.Sleep (5000);
//Fadeout (w);
//w.HideAll ();
//w.Destroy ();
Thread th = new Thread (delegate() {
Thread.Sleep(5000);
w.HideAll ();
w.Destroy ();
});
th.Start ();
}
示例4: PopulateFixes
public void PopulateFixes (Gtk.Menu menu, ref int items)
{
int mnemonic = 1;
bool gotImportantFix = false, addedSeparator = false;
var fixesAdded = new List<string> ();
foreach (var fix_ in Fixes.OrderByDescending (i => Tuple.Create (IsAnalysisOrErrorFix(i), (int)i.Severity, GetUsage (i.IdString)))) {
// filter out code actions that are already resolutions of a code issue
if (fixesAdded.Any (f => fix_.IdString.IndexOf (f, StringComparison.Ordinal) >= 0))
continue;
fixesAdded.Add (fix_.IdString);
if (IsAnalysisOrErrorFix (fix_))
gotImportantFix = true;
if (!addedSeparator && gotImportantFix && !IsAnalysisOrErrorFix(fix_)) {
menu.Add (new Gtk.SeparatorMenuItem ());
addedSeparator = true;
}
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var thisInstanceMenuItem = new MenuItem (label);
thisInstanceMenuItem.Activated += new ContextActionRunner (fix, document, currentSmartTagBegin).Run;
thisInstanceMenuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (thisInstanceMenuItem);
items++;
}
bool first = true;
var settingsMenuFixes = Fixes
.OfType<AnalysisContextActionProvider.AnalysisCodeAction> ()
.Where (f => f.Result is InspectorResults)
.GroupBy (f => ((InspectorResults)f.Result).Inspector);
foreach (var analysisFixGroup_ in settingsMenuFixes) {
var analysisFixGroup = analysisFixGroup_;
var arbitraryFixInGroup = analysisFixGroup.First ();
var ir = (InspectorResults)arbitraryFixInGroup.Result;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
var subMenu = new Gtk.Menu ();
foreach (var analysisFix_ in analysisFixGroup) {
var analysisFix = analysisFix_;
if (analysisFix.SupportsBatchRunning) {
var batchRunMenuItem = new Gtk.MenuItem (string.Format (GettextCatalog.GetString ("Apply in file: {0}"), analysisFix.Title));
batchRunMenuItem.Activated += delegate {
ConfirmUsage (analysisFix.IdString);
menu.Destroy ();
};
batchRunMenuItem.Activated += new ContextActionRunner (analysisFix, document, this.currentSmartTagBegin).BatchRun;
subMenu.Add (batchRunMenuItem);
subMenu.Add (new Gtk.SeparatorMenuItem ());
}
}
var inspector = ir.Inspector;
if (inspector.CanSuppressWithAttribute) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with attribute"));
menuItem.Activated += delegate {
inspector.SuppressWithAttribute (document, arbitraryFixInGroup.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableWithPragma) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with #pragma"));
menuItem.Activated += delegate {
inspector.DisableWithPragma (document, arbitraryFixInGroup.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableOnce) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Disable Once"));
menuItem.Activated += delegate {
inspector.DisableOnce (document, arbitraryFixInGroup.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableAndRestore) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Disable _and Restore"));
menuItem.Activated += delegate {
inspector.DisableAndRestore (document, arbitraryFixInGroup.DocumentRegion);
};
subMenu.Add (menuItem);
}
var label = GettextCatalog.GetString ("_Options for \"{0}\"", InspectorResults.GetTitle (ir.Inspector));
var subMenuItem = new Gtk.MenuItem (label);
var optionsMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Configure Rule"));
optionsMenuItem.Activated += arbitraryFixInGroup.ShowOptions;
//.........这里部分代码省略.........
示例5: PopulateFixes
public void PopulateFixes (Gtk.Menu menu)
{
int mnemonic = 1;
foreach (var fix_ in fixes.OrderByDescending (i => GetUsage (i.IdString))) {
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var menuItem = new Gtk.MenuItem (label);
menuItem.Activated += new ContextActionRunner (fix, document, loc).Run;
menuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (menuItem);
}
var first = true;
var alreadyInserted = new HashSet<CodeIssueProvider> ();
foreach (var analysisFix_ in fixes.OfType <AnalysisContextActionProvider.AnalysisCodeAction>().Where (f => f.Result is InspectorResults)) {
var analysisFix = analysisFix_;
var ir = analysisFix.Result as InspectorResults;
if (ir == null)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (ir.Inspector))
continue;
alreadyInserted.Add (ir.Inspector);
var label = GettextCatalog.GetString ("_Inspection options for \"{0}\"", ir.Inspector.Title);
var menuItem = new Gtk.MenuItem (label);
menuItem.Activated += analysisFix.ShowOptions;
menuItem.Activated += delegate {
menu.Destroy ();
};
menu.Add (menuItem);
}
}
示例6: PopulateFixes
public void PopulateFixes (Gtk.Menu menu, ref int items)
{
int mnemonic = 1;
foreach (var fix_ in fixes.OrderByDescending (i => GetUsage (i.IdString))) {
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var menuItem = new Gtk.MenuItem (label);
menuItem.Activated += new ContextActionRunner (fix, document, loc).Run;
menuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (menuItem);
items++;
}
var first = true;
var alreadyInserted = new HashSet<CodeIssueProvider> ();
foreach (var analysisFix_ in fixes.OfType <AnalysisContextActionProvider.AnalysisCodeAction>().Where (f => f.Result is InspectorResults)) {
var analysisFix = analysisFix_;
var ir = analysisFix.Result as InspectorResults;
if (ir == null)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (ir.Inspector))
continue;
alreadyInserted.Add (ir.Inspector);
var label = GettextCatalog.GetString ("_Inspection options for \"{0}\"", ir.Inspector.Title);
var menuItem = new Gtk.MenuItem (label);
menuItem.Activated += analysisFix.ShowOptions;
menuItem.Activated += delegate {
menu.Destroy ();
};
menu.Add (menuItem);
items++;
}
foreach (var fix_ in fixes.Where (f => f.BoundToIssue != null)) {
var fix = fix_;
foreach (var inspector_ in RefactoringService.GetInspectors (document.Editor.MimeType).Where (i => i.GetSeverity () != ICSharpCode.NRefactory.CSharp.Severity.None)) {
var inspector = inspector_;
if (inspector.IdString.IndexOf (fix.BoundToIssue.FullName, StringComparison.Ordinal) < 0)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (inspector))
continue;
alreadyInserted.Add (inspector);
var label = GettextCatalog.GetString ("_Inspection options for \"{0}\"", inspector.Title);
var menuItem = new Gtk.MenuItem (label);
menuItem.Activated += delegate {
MessageService.RunCustomDialog (new CodeIssueOptionsDialog (inspector), MessageService.RootWindow);
menu.Destroy ();
};
menu.Add (menuItem);
break;
}
items++;
}
}
示例7: Destroy
public static void Destroy(ref Gtk.Window window)
{
#if DEBUG
Console.WriteLine("Window.Destroy");
#endif
if (window == null)
return;
if (window == Variables.Window.splash)
{
int counterIndex = (int)CounterType.COUNT_HINT_NUMBER;
Variables.Counters[counterIndex] = (Variables.Counters[counterIndex] + 1) % Variables.hints.list.Count;
SplashWindow.SaveHintNumber();
}
window.Destroy();
window = null;
}
示例8: Drop
public virtual void Drop (Gtk.Widget widget, object faultId)
{
widget.Destroy ();
}
示例9: ReplaceChild
internal protected void ReplaceChild (Gtk.Widget oldChild, Gtk.Widget newChild, bool destroyOld)
{
ReplaceChild (oldChild, newChild);
if (destroyOld)
oldChild.Destroy ();
}
示例10: Logout
static void Logout (object sender, EventArgs e, ref Gtk.Window window)
{
window.Destroy ();
Settings.SetSettings ("", "");
LoginRequest ();
}
示例11: PopulateFixes
public void PopulateFixes (Gtk.Menu menu, ref int items)
{
int mnemonic = 1;
bool gotImportantFix = false, addedSeparator = false;
var fixesAdded = new List<string> ();
foreach (var fix_ in fixes.OrderByDescending (i => Tuple.Create (IsAnalysisOrErrorFix(i), (int)i.Severity, GetUsage (i.IdString)))) {
// filter out code actions that are already resolutions of a code issue
if (fixesAdded.Any (f => fix_.IdString.IndexOf (f, StringComparison.Ordinal) >= 0))
continue;
fixesAdded.Add (fix_.IdString);
if (IsAnalysisOrErrorFix (fix_))
gotImportantFix = true;
if (!addedSeparator && gotImportantFix && !IsAnalysisOrErrorFix(fix_)) {
menu.Add (new Gtk.SeparatorMenuItem ());
addedSeparator = true;
}
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var thisInstanceMenuItem = new Gtk.MenuItem (label);
thisInstanceMenuItem.Activated += new ContextActionRunner (fix, document, loc).Run;
thisInstanceMenuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (thisInstanceMenuItem);
items++;
}
bool first = true;
var alreadyInserted = new HashSet<BaseCodeIssueProvider> ();
foreach (var analysisFix_ in fixes.OfType <AnalysisContextActionProvider.AnalysisCodeAction>().Where (f => f.Result is InspectorResults)) {
var analysisFix = analysisFix_;
var ir = analysisFix.Result as InspectorResults;
if (ir == null)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (ir.Inspector))
continue;
alreadyInserted.Add (ir.Inspector);
var subMenu = new Gtk.Menu ();
if (analysisFix.SupportsBatchRunning) {
var batchRunMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Fix all in this file"));
batchRunMenuItem.Activated += delegate {
ConfirmUsage (analysisFix.IdString);
menu.Destroy ();
};
batchRunMenuItem.Activated += new ContextActionRunner (analysisFix, document, loc).BatchRun;
subMenu.Add (batchRunMenuItem);
subMenu.Add (new Gtk.SeparatorMenuItem ());
}
var inspector = ir.Inspector;
if (inspector.CanSuppressWithAttribute) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with attribute"));
menuItem.Activated += delegate {
inspector.SuppressWithAttribute (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableWithPragma) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with #pragma"));
menuItem.Activated += delegate {
inspector.DisableWithPragma (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableOnce) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Disable once with comment"));
menuItem.Activated += delegate {
inspector.DisableOnce (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableAndRestore) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Disable _and restore with comments"));
menuItem.Activated += delegate {
inspector.DisableAndRestore (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
var label = GettextCatalog.GetString ("_Options for \"{0}\"", InspectorResults.GetTitle (ir.Inspector));
var subMenuItem = new Gtk.MenuItem (label);
var optionsMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Configure inspection"));
optionsMenuItem.Activated += analysisFix.ShowOptions;
optionsMenuItem.Activated += delegate {
menu.Destroy ();
};
//.........这里部分代码省略.........
示例12: PopulateFixes
public void PopulateFixes (Gtk.Menu menu, ref int items)
{
int mnemonic = 1;
foreach (var fix_ in fixes.OrderByDescending (i => GetUsage (i.IdString))) {
var fix = fix_;
var escapedLabel = fix.Title.Replace ("_", "__");
var label = (mnemonic <= 10)
? "_" + (mnemonic++ % 10).ToString () + " " + escapedLabel
: " " + escapedLabel;
var thisInstanceMenuItem = new Gtk.MenuItem (label);
thisInstanceMenuItem.Activated += new ContextActionRunner (fix, document, loc).Run;
thisInstanceMenuItem.Activated += delegate {
ConfirmUsage (fix.IdString);
menu.Destroy ();
};
menu.Add (thisInstanceMenuItem);
items++;
}
var first = true;
var alreadyInserted = new HashSet<BaseCodeIssueProvider> ();
foreach (var analysisFix_ in fixes.OfType <AnalysisContextActionProvider.AnalysisCodeAction>().Where (f => f.Result is InspectorResults)) {
var analysisFix = analysisFix_;
var ir = analysisFix.Result as InspectorResults;
if (ir == null)
continue;
if (first) {
menu.Add (new Gtk.SeparatorMenuItem ());
first = false;
}
if (alreadyInserted.Contains (ir.Inspector))
continue;
alreadyInserted.Add (ir.Inspector);
var subMenu = new Gtk.Menu ();
if (analysisFix.SupportsBatchRunning) {
var batchRunMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Fix all in this file"));
batchRunMenuItem.Activated += delegate {
ConfirmUsage (analysisFix.IdString);
menu.Destroy ();
};
batchRunMenuItem.Activated += new ContextActionRunner (analysisFix, document, loc).BatchRun;
subMenu.Add (batchRunMenuItem);
subMenu.Add (new Gtk.SeparatorMenuItem ());
}
var inspector = ir.Inspector;
if (inspector.CanSuppressWithAttribute) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with attribute"));
menuItem.Activated += delegate {
inspector.SuppressWithAttribute (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableWithPragma) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Suppress with #pragma"));
menuItem.Activated += delegate {
inspector.DisableWithPragma (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableOnce) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Disable once with comment"));
menuItem.Activated += delegate {
inspector.DisableOnce (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
if (inspector.CanDisableAndRestore) {
var menuItem = new Gtk.MenuItem (GettextCatalog.GetString ("Disable _and restore with comments"));
menuItem.Activated += delegate {
inspector.DisableAndRestore (document, analysisFix.DocumentRegion);
};
subMenu.Add (menuItem);
}
var label = GettextCatalog.GetString ("_Options for \"{0}\"", InspectorResults.GetTitle (ir.Inspector));
var subMenuItem = new Gtk.MenuItem (label);
var optionsMenuItem = new Gtk.MenuItem (GettextCatalog.GetString ("_Configure inspection severity"));
optionsMenuItem.Activated += analysisFix.ShowOptions;
optionsMenuItem.Activated += delegate {
menu.Destroy ();
};
subMenu.Add (optionsMenuItem);
subMenuItem.Submenu = subMenu;
menu.Add (subMenuItem);
items++;
}
foreach (var fix_ in fixes.Where (f => f.BoundToIssue != null)) {
var fix = fix_;
foreach (var inspector_ in RefactoringService.GetInspectors (document.Editor.MimeType).Where (i => i.GetSeverity () != Severity.None)) {
var inspector = inspector_;
if (inspector.IdString.IndexOf (fix.BoundToIssue.FullName, StringComparison.Ordinal) < 0)
continue;
if (first) {
//.........这里部分代码省略.........
示例13: OnDestroyWidget
protected virtual void OnDestroyWidget (Gtk.Widget w) { w.Destroy (); }