当前位置: 首页>>代码示例>>C#>>正文


C# Window.Destroy方法代码示例

本文整理汇总了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();
        });
    }
开发者ID:brandonprry,项目名称:volatile_reader,代码行数:94,代码来源:MainWindow.cs

示例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();
    }
开发者ID:Drenn1,项目名称:LynnaLab,代码行数:21,代码来源:MainWindow.cs

示例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 ();
		}
开发者ID:dfr0,项目名称:moon,代码行数:62,代码来源:default.xaml.cs


注:本文中的Window.Destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。