本文整理汇总了C#中Window.Destroy方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Destroy方法的具体用法?C# Window.Destroy怎么用?C# Window.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Window
的用法示例。
在下文中一共展示了Window.Destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Populate
protected void Populate()
{
this.SetDefaultSize(1024,768);
Window pingpong = new Window(Gtk.WindowType.Toplevel);
pingpong.SetDefaultSize(500,50);
pingpong.SetPosition(Gtk.WindowPosition.CenterOnParent);
pingpong.Title = "Loading...";
_pulseBar = new ProgressBar();
pingpong.Add(_pulseBar);
pingpong.ShowAll();
pingpong.Show();
while (_currentStrs == null)
{
Application.Invoke( delegate {
_pulseBar.Pulse();
});
Thread.Sleep(100);
}
Application.Invoke( delegate {
pingpong.Destroy();
this.Remove(_vbox);
_vbox = new VBox(false, 10);
MenuBar bar = new MenuBar ();
Menu fileMenu = new Menu ();
MenuItem fileMenuItem = new MenuItem ("File");
fileMenuItem.Submenu = fileMenu;
MenuItem exit = new MenuItem ("Exit");
exit.Activated += delegate(object sender, EventArgs e) {
Application.Quit ();
};
MenuItem openFile = new MenuItem ("Open file...");
openFile.Activated += OpenFile;
fileMenu.Append (openFile);
fileMenu.Append (exit);
bar.Append (fileMenuItem);
_vbox.PackStart(bar, false, false, 0);
_regxTitle = ComboBox.NewText();
_regxTitle.Changed += HandleChanged;
foreach (KeyValuePair<string, string> pair in _regexes)
_regxTitle.AppendText(pair.Key);
_regx = new Entry();
_regx.IsEditable = false;
_regx.CanFocus = false;
HBox comboRegexBox = new HBox(true, 10);
comboRegexBox.SetSizeRequest(768, 50);
comboRegexBox.PackStart(_regxTitle, false,false, 0);
comboRegexBox.PackStart(_regx, true, true, 0);
Button search = new Button("Search!");
search.Clicked += HandleClicked;
comboRegexBox.PackStart(search, false, false, 20);
_vbox.PackStart(comboRegexBox, true, true, 10);
ScrolledWindow sw = new ScrolledWindow();
_tv = new TreeView();
sw.Add(_tv);
CellRendererText tsText = new CellRendererText();
TreeViewColumn match = new TreeViewColumn();
match.Title = "Match";
match.PackStart(tsText, true);
match.AddAttribute(tsText, "text", 0);
_tv.AppendColumn(match);
TreeStore store = new TreeStore(typeof(string));
foreach (string str in _currentStrs)
store.AppendValues(str);
_tv.Model = store;
sw.SetSizeRequest(768,600);
_vbox.PackStart(sw, false, false, 0);
this.Add(_vbox);
this.ShowAll();
});
}
示例2: OnWarpsActionActivated
protected void OnWarpsActionActivated(object sender, EventArgs e)
{
if (openedWarpEditor)
return;
WarpEditor editor = new WarpEditor(Project);
editor.SetMap(roomSpinButton.ValueAsInt >> 8, roomSpinButton.ValueAsInt & 0xff);
Gtk.Window win = new Window(WindowType.Toplevel);
win.Modal = false;
win.Add(editor);
editor.Destroyed += delegate(object sender2, EventArgs e2) {
win.Destroy();
};
win.Destroyed += delegate(object sender2, EventArgs e2) {
openedWarpEditor = false;
};
openedWarpEditor = true;
win.ShowAll();
}
示例3: ChooseStation
void ChooseStation ()
{
Locations loc = new Locations ();
TreeStore store = new TreeStore (typeof (string), typeof (string), typeof (string));
List <Region> regions = loc.Regions;
foreach (Region r in regions) {
TreeIter iter = store.AppendValues (r.Name, GetTypeName (r), String.Empty);
AddTreeEntries (r, store, iter);
}
Window win = new Window ("Select your location");
win.SetDefaultSize (400,400);
VBox vbox = new VBox (false, 0);
win.Add (vbox);
ScrolledWindow sw = new ScrolledWindow ();
vbox.PackStart (sw, true, true, 0);
TreeView tv = new TreeView (store);
tv.HeadersVisible = true;
tv.EnableSearch = true;
tv.AppendColumn ("Location", new CellRendererText (), "text", 0);
tv.AppendColumn ("Type", new CellRendererText (), "text", 1);
tv.AppendColumn ("Code", new CellRendererText (), "text", 2);
sw.Add (tv);
sw.Show ();
HBox hbox = new HBox (true, 0);
Button closeBtn = new Button (Stock.Close);
closeBtn.Clicked += delegate {
TreeSelection sel = tv.Selection;
TreeModel model;
TreeIter iter;
string val = null;
if (sel.GetSelected (out model, out iter)) {
val = (string) model.GetValue (iter, 1);
if (val == "Location")
val = (string) model.GetValue (iter, 2);
else
val = null;
}
win.Hide ();
win.Destroy ();
if (!String.IsNullOrEmpty (val)) {
stationID.Text = val;
StoreConfig ();
UpdateData (null, null);
}
};
hbox.PackEnd (closeBtn, false, false, 0);
vbox.PackStart (hbox, false, false, 1);
win.ShowAll ();
}