本文整理汇总了C#中Gtk.Window.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Destroy方法的具体用法?C# Window.Destroy怎么用?C# Window.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Window
的用法示例。
在下文中一共展示了Window.Destroy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNotficationWindow
public static void CreateNotficationWindow(string notification)
{
Gtk.Window nWin = new Gtk.Window(WindowType.Toplevel);
Gtk.VBox ctr = new Gtk.VBox();
ctr.Add( new Gtk.Label(notification));
Gtk.Button btn = new Gtk.Button();
btn.Label = "Close";
btn.Clicked += (sender, e) => nWin.Destroy();
ctr.Add(btn);
nWin.Add(ctr);
nWin.ShowAll();
}
示例2: Run
public void Run ()
{
var poof_file = DockServices.Paths.SystemDataFolder.GetChild ("poof.png");
if (!poof_file.Exists)
return;
poof = new Pixbuf (poof_file.Path);
window = new Gtk.Window (Gtk.WindowType.Toplevel);
window.AppPaintable = true;
window.Resizable = false;
window.KeepAbove = true;
window.CanFocus = false;
window.TypeHint = WindowTypeHint.Splashscreen;
window.SetCompositeColormap ();
window.Realized += delegate { window.GdkWindow.SetBackPixmap (null, false); };
window.SetSizeRequest (size, size);
window.ExposeEvent += HandleExposeEvent;
GLib.Timeout.Add (30, delegate {
if (AnimationState == 1) {
window.Hide ();
window.Destroy ();
poof.Dispose ();
return false;
} else {
window.QueueDraw ();
return true;
}
});
window.Move (x, y);
window.ShowAll ();
run_time = DateTime.UtcNow;
}
示例3: ShowCalendar
public void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = parent.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
//Requisition req = SizeRequest();
parent.GdkWindow.GetOrigin(out xPos, out yPos);
// popup.Move(x + Allocation.X, y + Allocation.Y + req.Height + 3);
popup.Move(xPos, yPos);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelected += OnCalendarDaySelected;
cal.MonthChanged += OnCalendarMonthChanged;
cal.Date = date;
}
示例4: ShowCalendar
private void ShowCalendar()
{
popup = new Window(WindowType.Popup);
popup.Screen = tree.Screen;
Frame frame = new Frame();
frame.Shadow = ShadowType.Out;
frame.Show();
popup.Add(frame);
VBox box = new VBox(false, 0);
box.Show();
frame.Add(box);
cal = new Calendar();
cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
| CalendarDisplayOptions.ShowDayNames
| CalendarDisplayOptions.ShowWeekNumbers;
cal.KeyPressEvent += OnCalendarKeyPressed;
popup.ButtonPressEvent += OnButtonPressed;
cal.Show();
Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);
calAlignment.Show();
calAlignment.SetPadding(4, 4, 4, 4);
calAlignment.Add(cal);
box.PackStart(calAlignment, false, false, 0);
// FIXME: Make the popup appear directly below the date
Gdk.Rectangle allocation = tree.Allocation;
// Gtk.Requisition req = tree.SizeRequest ();
int x = 0, y = 0;
tree.GdkWindow.GetOrigin(out x, out y);
// popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
popup.Move(x + allocation.X, y + allocation.Y);
popup.Show();
popup.GrabFocus();
Grab.Add(popup);
Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
Gdk.EventMask.ButtonPressMask
| Gdk.EventMask.ButtonReleaseMask
| Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);
if (grabbed == Gdk.GrabStatus.Success) {
grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
true, CURRENT_TIME);
if (grabbed != Gdk.GrabStatus.Success) {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
} else {
Grab.Remove(popup);
popup.Destroy();
popup = null;
}
cal.DaySelectedDoubleClick += OnCalendarDaySelected;
cal.ButtonPressEvent += OnCalendarButtonPressed;
cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
}
示例5: ShowClientUpgradeMessageBox
private void ShowClientUpgradeMessageBox()
{
if(this.NewClientVersion == null || this.ClientUpgradeStatus == null || this.NewClientDomainID == null)
{
return;
}
if (ClientUpgradeDialog != null)
return;
if(DomainController.upgradeStatus.statusCode == StatusCodes.ServerOld)
{
ClientUpgradeDialog = new iFolderMsgDialog(
null,
iFolderMsgDialog.DialogType.Info,
iFolderMsgDialog.ButtonSet.Ok,
Util.GS("iFolder Server Older"),
Util.GS("The server is running an older version."),
string.Format(Util.GS("The server needs to be upgraded to be connected from this client")));
}
else if(DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded)
{
ClientUpgradeDialog = new iFolderMsgDialog(
null,
iFolderMsgDialog.DialogType.Info,
iFolderMsgDialog.ButtonSet.AcceptDeny,
Util.GS("iFolder Client Upgrade"),
Util.GS("Would you like to download new iFolder Client?"),
string.Format(Util.GS("The client needs to be upgraded to be connected to the server")));
}
else
{
ClientUpgradeDialog = new iFolderMsgDialog(
null,
iFolderMsgDialog.DialogType.Info,
iFolderMsgDialog.ButtonSet.AcceptDeny,
Util.GS("iFolder Client Upgrade"),
Util.GS("Would you like to download new iFolder Client?"),
string.Format(Util.GS("A newer version \"{0}\" of the iFolder Client is available."), this.NewClientVersion));
}
int rc = ClientUpgradeDialog.Run();
ClientUpgradeDialog.Hide();
ClientUpgradeDialog.Destroy();
ClientUpgradeDialog = null;
if (rc == -8)
{
bool bUpdateRunning = false;
Gtk.Window win = new Gtk.Window("");
string initialPath = (string)System.IO.Path.GetTempPath();
Debug.PrintLine(String.Format("Initial Path: {0}", initialPath));
CopyLocation cp = new CopyLocation(win, (string)System.IO.Path.GetTempPath());
string selectedFolder = "";
int rc1 = 0;
do
{
rc1 = cp.Run();
cp.Hide();
if(rc1 ==(int)ResponseType.Ok)
{
selectedFolder = cp.iFolderPath.Trim();
cp.Destroy();
cp = null;
break;
}
}while( rc1 == (int)ResponseType.Ok);
if( cp != null)
{
cp.Destroy();
cp=null;
}
win.Hide();
win.Destroy();
win=null;
if( rc1 != (int) ResponseType.Ok)
{
Debug.PrintLine("OnClientUpgradeAvailableEvent return");
ClientUpgradeDialog = null;
return;
}
try
{
if(ifws !=null)
{
Debug.PrintLine("ifws.RunClientUpdate");
bUpdateRunning = ifws.RunClientUpdate(this.NewClientDomainID, selectedFolder);
}
}
catch(Exception e)
{
Debug.PrintLine(String.Format("ifws.RunClientUpdate exception :{0}", e.Message));
ClientUpgradeDialog = null;
return;
}
if (bUpdateRunning)
{
ClientUpgradeDialog = new iFolderMsgDialog(
null,
iFolderMsgDialog.DialogType.Info,
iFolderMsgDialog.ButtonSet.Ok,
Util.GS("Download Complete..."),
Util.GS("Download Finished "),
string.Format(Util.GS("The new client rpm's have been downloaded.")));
//.........这里部分代码省略.........
示例6: CheckWordDialog
public static void CheckWordDialog(object sender, EventArgs e)
{
var lab = new Gtk.Label("Zadejte slovo: ");
var ent = new Gtk.Entry();
var but = new Gtk.Button("OK");
var div = new Gtk.HBox(false, 1 );
div.PackStart( lab );
div.Add( ent );
div.PackEnd( but );
var checkWin = new Gtk.Window( Gtk.WindowType.Popup );
checkWin.Add ( div );
checkWin.BorderWidth = 0;
checkWin.Modal = true;
checkWin.CanFocus = true;
checkWin.SetPosition( WindowPosition.Mouse );
checkWin.ShowAll();
ent.Activated += delegate {
but.Click();
};
but.Clicked += delegate {
checkWin.HideAll();
if( game.dictionary.Content( ent.Text ) ) {
Gtk.MessageDialog ans = new Gtk.MessageDialog(
game.Window,
DialogFlags.DestroyWithParent,
MessageType.Info,
ButtonsType.Close,
"Slovo \""+ent.Text+"\" <b>je</b> ve slovníku"
);
ans.Run();
ans.Destroy();
}
else {
Gtk.MessageDialog ans = new Gtk.MessageDialog(
game.Window,
DialogFlags.DestroyWithParent,
MessageType.Info,
ButtonsType.Close,
"Slovo \""+ent.Text+"\" <b>není</b> ve slovníku"
);
ans.Run();
ans.Destroy();
}
checkWin.Dispose();
checkWin.Destroy();
};
checkWin.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
switch( args.Event.Key ) {
case Gdk.Key.Escape:
checkWin.HideAll();
checkWin.Dispose();
checkWin.Destroy();
break;
case Gdk.Key.ISO_Enter:
but.Click();
break;
}
};
}
示例7: CreateScopeWindow
private void CreateScopeWindow()
{
if(scope_window != null) {
return;
}
scope_window = new Window("Scope");
scope_window.DeleteEvent += delegate {
scope_window.Destroy();
scope_window = null;
GLib.Source.Remove(poll_timeout);
poll_timeout = 0;
};
scope_view = new ScopeView();
scope_window.Add(scope_view);
scope_window.SetSizeRequest(150, 80);
scope_window.ShowAll();
poll_timeout = GLib.Timeout.Add(150, PollScope);
}
示例8: AddNewWordToDic
public static void AddNewWordToDic(object sender, EventArgs e)
{
var win = new Gtk.Window("Přidej slovo");
win.SetPosition( WindowPosition.Mouse );
Label l = new Label();
l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";
Entry entry = new Entry();
Button b = new Button("Přidej");
VBox vbox = new VBox();
HBox hbox = new HBox();
vbox.BorderWidth = 10;
vbox.PackStart( l );
vbox.PackEnd( hbox );
hbox.PackStart( entry );
hbox.PackEnd( b );
b.Clicked += delegate {
game.dictionary.Add( entry.Text );
win.HideAll();
win.Destroy();
win.Dispose();
};
win.Add(vbox);
win.ShowAll();
}
示例9: NextPlayer
public static void NextPlayer(string name)
{
var but = new Gtk.Button( );
but.TooltipMarkup = "Po kliknutí bude hrát další hráč";
HBox hbox = new HBox();
global::Gtk.Image im = new global::Gtk.Image ();
Label l = new Label();
l.Markup = "Na tahu je hráč:\n <b>" + name + "</b>\n\nOK";
hbox.PackStart( im );
hbox.PackEnd( l );
but.Add( hbox );
var win = new Gtk.Window( Gtk.WindowType.Toplevel );
but.Clicked += delegate {
win.HideAll();
win.Dispose();
win.Destroy();
};
win.Add( but );
win.Fullscreen();
win.ShowAll();
}
示例10: ShowPopup
private void ShowPopup()
{
win = new Gtk.Window(Gtk.WindowType.Popup);
win.Screen = this.Screen;
win.WidthRequest = this.Allocation.Width;
cal = new Gtk.Calendar();
win.Add(cal);
if (validDate)
cal.Date = date;
// events
win.ButtonPressEvent += OnWinButtonPressEvent;
cal.DaySelectedDoubleClick += OnCalDaySelectedDoubleClick;
cal.KeyPressEvent += OnCalKeyPressEvent;
cal.ButtonPressEvent += OnCalButtonPressEvent;
int x, y;
GetWidgetPos(this, out x, out y);
win.Move(x, y + Allocation.Height + 2);
win.ShowAll();
win.GrabFocus();
Grab.Add(win);
Gdk.GrabStatus grabStatus;
grabStatus = Gdk.Pointer.Grab(win.GdkWindow, true, EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask, null, null, Gtk.Global.CurrentEventTime);
if (grabStatus == Gdk.GrabStatus.Success) {
grabStatus = Gdk.Keyboard.Grab(win.GdkWindow, true, Gtk.Global.CurrentEventTime);
if (grabStatus != Gdk.GrabStatus.Success) {
Grab.Remove(win);
win.Destroy();
win = null;
}
} else {
Grab.Remove(win);
win.Destroy();
win = null;
}
}
示例11: Clicked
public override void Clicked()
{
Treasure.Project = Project;
Chest.Project = Project;
Gtk.Window win = new Window(WindowType.Toplevel);
Alignment warningsContainer = new Alignment(0.1f,0.1f,0f,0f);
VBox vbox = new VBox();
var chestGui = new ChestEditorGui(manager);
chestGui.SetRoom(manager.GetActiveRoom().Index);
chestGui.Destroyed += (sender2, e2) => win.Destroy();
Frame chestFrame = new Frame();
chestFrame.Label = "Chest Data";
chestFrame.Add(chestGui);
var treasureGui = new TreasureEditorGui(manager);
Frame treasureFrame = new Frame();
treasureFrame.Label = "Treasure Data";
treasureFrame.Add(treasureGui);
System.Action UpdateWarnings = () => {
VBox warningBox = new VBox();
warningBox.Spacing = 4;
System.Action<string> AddWarning = (s) => {
Image img = new Image(Stock.DialogWarning, IconSize.Button);
HBox hb = new HBox();
hb.Spacing = 10;
hb.Add(img);
Gtk.Label l = new Gtk.Label(s);
l.LineWrap = true;
hb.Add(l);
Alignment a = new Alignment(0,0,0,0);
a.Add(hb);
warningBox.Add(a);
};
foreach (var c in warningsContainer.Children)
warningsContainer.Remove(c);
int index = chestGui.GetTreasureIndex();
if (index < 0)
return;
if (!Treasure.IndexExists(index)) {
AddWarning("Treasure " + Wla.ToWord(index) + " does not exist.");
}
else {
if (index != treasureGui.Index)
AddWarning("Your treasure index is different\nfrom the chest you're editing.");
int spawnMode = (Treasure.GetTreasureByte(index, 0) >> 4)&7;
if (spawnMode != 3) {
AddWarning("Treasure " + Wla.ToWord(index) + " doesn't have spawn\nmode $3 (needed for chests).");
}
int yx = Chest.GetChestByte(chestGui.RoomIndex, 0);
int x=yx&0xf;
int y=yx>>4;
Room r = Project.GetIndexedDataType<Room>(chestGui.RoomIndex);
if (x >= r.Width || y >= r.Height || r.GetTile(x,y) != 0xf1) {
AddWarning("There is no chest at coordinates (" + x + "," + y + ").");
}
}
warningsContainer.Add(warningBox);
win.ShowAll();
};
chestGui.SetTreasureEditor(treasureGui);
chestGui.ChestChangedEvent += () => {
UpdateWarnings();
};
treasureGui.TreasureChangedEvent += () => {
UpdateWarnings();
};
HBox hbox = new Gtk.HBox();
hbox.Spacing = 6;
hbox.Add(chestFrame);
hbox.Add(treasureFrame);
Button okButton = new Gtk.Button();
okButton.UseStock = true;
okButton.Label = "gtk-ok";
okButton.Clicked += (a,b) => {
win.Destroy();
};
Alignment buttonAlign = new Alignment(0.5f,0.5f,0f,0f);
buttonAlign.Add(okButton);
vbox.Add(hbox);
vbox.Add(warningsContainer);
vbox.Add(buttonAlign);
//.........这里部分代码省略.........
示例12: OpenFile
protected void OpenFile(object sender, EventArgs e)
{
FileChooserDialog fc = new FileChooserDialog ("Choose the directory containing the hives to open",
this,
FileChooserAction.SelectFolder,
"Cancel", ResponseType.Cancel,
"Open", ResponseType.Accept);
if (fc.Run () == (int)ResponseType.Accept) {
string dir = fc.Filename;
fc.Destroy();
List<Thread> threads = new List<Thread>();
Window window = new Gtk.Window(Gtk.WindowType.Toplevel);
VBox progressBox = new VBox(false, 5);
reading = new Label("Reading hives, please wait...");
pulseBar = new ProgressBar();
progressBox.PackStart(reading, true, true, 0);
progressBox.PackStart(pulseBar, true, true, 0);
reading.Show();
pulseBar.Show ();
progressBox.Show();
window.Add(progressBox);
window.SetPosition(Gtk.WindowPosition.CenterOnParent);
window.SetSizeRequest(500,100);
window.Title = "Loading...";
window.Show();
_hives = new List<RegistryHive>();
_filenames = new List<string>();
foreach (var file in System.IO.Directory.GetFiles(dir))
{
using (BinaryReader reader = new BinaryReader(File.OpenRead(file)))
{
reader.BaseStream.Position = 0;
if (reader.BaseStream.Length > 4)
{
byte[] magic = reader.ReadBytes(4);
if (magic[0] == 'r' && magic[1] == 'e' && magic[2] == 'g' && magic[3] == 'f')
{
_total += reader.BaseStream.Length;
_filenames.Add(file);
}
}
}
}
threads = GetReadThreads ();
foreach (Thread thread in threads)
thread.Start();
new Thread(new ThreadStart(delegate {
foreach (Thread thread in threads)
{
while (thread.IsAlive)
{
Application.Invoke(delegate {
pulseBar.Pulse();
});
System.Threading.Thread.Sleep(100);
}
}
Application.Invoke(delegate {
window.Destroy();
Populate();
});
})).Start();
}
else
fc.Destroy();
}