Dispose() 보호된 메소드

protected Dispose ( bool disposing ) : void
disposing bool
리턴 void
예제 #1
0
        public static void Main(string[] args)
        {
            Application.Initialize (ToolkitType.Gtk);

            var plotModel = new PlotModel
            {
                Title = "Trigonometric functions",
                Subtitle = "Example using the FunctionSeries",
                PlotType = PlotType.Cartesian,
                Background = OxyColors.White
            };
            plotModel.Series.Add(new FunctionSeries(Math.Sin, -10, 10, 0.1, "sin(x)") { Color = OxyColors.Black });
            plotModel.Series.Add(new FunctionSeries(Math.Cos, -10, 10, 0.1, "cos(x)") { Color = OxyColors.Green });
            plotModel.Series.Add(new FunctionSeries(t => 5 * Math.Cos(t), t => 5 * Math.Sin(t), 0, 2 * Math.PI, 0.1, "cos(t),sin(t)") { Color = OxyColors.Yellow });

            var plotView = new OxyPlot.Xwt.PlotView { Model = plotModel };
            plotView.Visible = true;
            plotView.MinWidth = 400;
            plotView.MinHeight = 400;

            Window w = new Window {
                Title = "OxyPlot Xwt Demo Application",
                Width = 600,
                Height = 600,
                Content = plotView
            };

            w.CloseRequested += (s, a) => Application.Exit ();

            w.Show ();
            Application.Run ();
            w.Dispose ();
            Application.Dispose ();
        }
예제 #2
0
파일: WidgetTests.cs 프로젝트: m13253/xwt
		public void ParentWindow ()
		{
			var w = CreateWidget ();
			var win = new Window ();
			win.Content = w;
			Assert.AreSame (win, w.ParentWindow);
			win.Dispose ();
		}
예제 #3
0
        public void Coordinates()
        {
            var win = new Window();
            var w   = CreateWidget();

            win.Content = w;
            win.Show();

            Application.DispatchPendingEvents();

            Assert.AreEqual(w.ScreenBounds, win.ScreenBounds);

            win.Dispose();
        }
예제 #4
0
        public void Focus()
        {
            var win = new Window();
            var w   = CreateWidget();

            Run(delegate {
                HBox box    = new HBox();
                TextEntry e = new TextEntry();
                box.PackStart(e);
                box.PackStart(w);
                win.Content = box;
                win.Show();
                win.Present();

//				for (int n=0; n < 500; n++) {
                Application.DispatchPendingEvents();
//					System.Threading.Thread.Sleep (10);
//				}

                e.SetFocus();

                Application.DispatchPendingEvents();

                Assert.IsFalse(w.HasFocus);
                //		Assert.IsTrue (w.CanGetFocus);

                int gotFocus = 0;
                w.GotFocus  += delegate {
                    gotFocus++;
                };

                w.SetFocus();
                Assert.IsTrue(w.HasFocus);
                Assert.AreEqual(1, gotFocus);

                int lostFocus = 0;
                w.LostFocus  += delegate {
                    lostFocus++;
                };

                e.SetFocus();

                Assert.IsFalse(w.HasFocus);
                //			Assert.AreEqual (1, lostFocus);

                win.Dispose();
            });
        }
예제 #5
0
        public static void Main(string[] args)
        {
            Mutex mutex = new System.Threading.Mutex(false, "OwnCloudCalendarConnerctor");
            try
            {
                if (mutex.WaitOne(0, false))
                {
                    string logConfigFile = AppDomain.CurrentDomain.BaseDirectory + @"config.log4net";
                    log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(logConfigFile));

                    Application.Initialize(ToolkitType.Gtk);
                    Xwt.Drawing.Image iconImage = Xwt.Drawing.Image.FromFile(@"D:\Vladimir Varagic\Privatno\Diplomski rad\svnVersion\ownCloudCalendar\trunk\ownCloudCalendarProject\ownCloudCalendar\ownCloudCalendarXWT\Images\20141129064955676_easyicon_net_32.ico");

                    var mainWindow = new Window()
                    {
                        Title = "ownCloud Calendar Client",
                        Width = 500,
                        Height = 250,
                        Icon = iconImage
                    };

                    mainWindow.Resizable = false;

                    LogIn logIn = new LogIn();

                    mainWindow.Content = logIn;

                    mainWindow.Show();
                    Application.Run();
                    mainWindow.Dispose();

                }
                else
                {
                    Application.Initialize(ToolkitType.Gtk);
                    MessageDialog.ShowMessage("An instance of the application is already running.");
                }
            }
            finally
            {
                if (mutex != null)
                {
                    mutex.Close();
                    mutex = null;
                }
            }
        }
예제 #6
0
파일: Windows.cs 프로젝트: joncham/xwt
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = b.ScreenBounds;
                w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height);
                w.Show ();
            };
            b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + r.Label;
                d.Dispose ();
            };
        }
예제 #7
0
        public static void Main(string [] args)
        {
            Application.Initialize("Xwt.GtkBackend.GtkEngine, Xwt.Gtk, Version=1.0.0.0");

            Window w = new Window();
            w.Title = "Xwt Demo Application";
            w.Width = 500;
            w.Height = 400;

            ReportViewer rv = new ReportViewer();
            rv.LoadReport(new Uri(@"C:\Users\Peter\Projects\My-FyiReporting\Examples\SqliteExamples\SimpleTest1.rdl"));

            w.Content = rv;

            w.Show();

            Application.Run();

            w.Dispose();
        }
예제 #8
0
 public Windows()
 {
     Button b = new Button ("Show borderless window");
     PackStart (b);
     b.Clicked += delegate {
         Window w = new Window ();
         w.Decorated = false;
         Button c = new Button ("This is a window");
     //				c.Margin.SetAll (10);
         w.Content = c;
         c.Clicked += delegate {
             w.Dispose ();
         };
         var bpos = b.ScreenBounds;
         w.Bounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Bounds.Width, w.Bounds.Height);
         w.Show ();
     };
     b = new Button ("Show message dialog");
     PackStart (b);
     b.Clicked += delegate {
         MessageDialog.ShowMessage (ParentWindow, "Hi there!");
     };
 }
예제 #9
0
        public Windows()
        {
            Button b = new Button ("Show borderless window");
            PackStart (b);
            b.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = b.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + b.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Attach (new Label ("Some field:"), 0, 1, 0, 1);
                t.Attach (new TextEntry (), 1, 2, 0, 1);
                t.Attach (new Label ("Another field:"), 0, 1, 1, 2);
                t.Attach (new TextEntry (), 1, 2, 1, 2);
                d.Content = t;

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + r.Label;
                d.Dispose ();
            };

            b = new Button ("Show Open File dialog");
            PackStart (b);
            b.Clicked += delegate {
                OpenFileDialog dlg = new OpenFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Save File dialog");
            PackStart (b);
            b.Clicked += delegate {
                SaveFileDialog dlg = new SaveFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Select Folder dialog (Multi select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder");
                dlg.Multiselect = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder");
                dlg.Multiselect = false;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Color dialog");
            PackStart (b);
            b.Clicked += delegate {
                SelectColorDialog dlg = new SelectColorDialog ("Select a color");
                dlg.SupportsAlpha = true;
                dlg.Color = Xwt.Drawing.Colors.AliceBlue;
                if (dlg.Run (ParentWindow))
                    MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ());
            };

            b = new Button("Show window shown event");
            PackStart(b);
            b.Clicked += delegate
            {
                Window w = new Window();
                w.Decorated = false;
                Button c = new Button("This is a window with events on");
                w.Content = c;
                c.Clicked += delegate
                {
                    w.Dispose();
                };
                w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown");
                w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden");

                w.Show();

            };
        }
예제 #10
0
파일: Windows.cs 프로젝트: nite2006/xwt
        public Windows()
        {
            Button bp = new Button ("Show borderless window");
            PackStart (bp);
            bp.Clicked += delegate {
                Window w = new Window ();
                w.Decorated = false;
                Button c = new Button ("This is a window");
            //				c.Margin.SetAll (10);
                w.Content = c;
                c.Clicked += delegate {
                    w.Dispose ();
                };
                var bpos = bp.ScreenBounds;
                w.ScreenBounds = new Rectangle (bpos.X, bpos.Y + bp.Size.Height, w.Width, w.Height);
                w.Show ();
            };
            Button b = new Button ("Show message dialog");
            PackStart (b);
            b.Clicked += delegate {
                MessageDialog.ShowMessage (ParentWindow, "Hi there!");
            };

            Button db = new Button ("Show custom dialog");
            PackStart (db);
            db.Clicked += delegate {
                Dialog d = new Dialog ();
                d.Title = "This is a dialog";
                Table t = new Table ();
                t.Add (new Label ("Some field:"), 0, 0);
                t.Add (new TextEntry (), 1, 0);
                t.Add (new Label ("Another field:"), 0, 1);
                t.Add (new TextEntry (), 1, 1);
                d.Content = t;
                d.CloseRequested += delegate(object sender, CloseRequestedEventArgs args) {
                    args.AllowClose = MessageDialog.Confirm ("Really close?", Command.Close);
                };

                Command custom = new Command ("Custom");
                d.Buttons.Add (new DialogButton (custom));
                d.Buttons.Add (new DialogButton ("Custom OK", Command.Ok));
                d.Buttons.Add (new DialogButton (Command.Cancel));
                d.Buttons.Add (new DialogButton (Command.Ok));

                var r = d.Run (this.ParentWindow);
                db.Label = "Result: " + (r != null ? r.Label : "(Closed)");
                d.Dispose ();
            };

            b = new Button ("Show Open File dialog");
            PackStart (b);
            b.Clicked += delegate {
                OpenFileDialog dlg = new OpenFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Save File dialog");
            PackStart (b);
            b.Clicked += delegate {
                SaveFileDialog dlg = new SaveFileDialog ("Select a file");
                dlg.InitialFileName = "Some file";
                dlg.Multiselect = true;
                dlg.Filters.Add (new FileDialogFilter ("Xwt files", "*.xwt"));
                dlg.Filters.Add (new FileDialogFilter ("All files", "*.*"));
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Files have been selected!", string.Join ("\n", dlg.FileNames));
            };

            b = new Button ("Show Select Folder dialog (Multi select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select some folder");
                dlg.Multiselect = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select a folder");
                dlg.Multiselect = false;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Folder dialog (Single select, allow creation)");
            PackStart (b);
            b.Clicked += delegate {
                SelectFolderDialog dlg = new SelectFolderDialog ("Select or create a folder");
                dlg.Multiselect = false;
                dlg.CanCreateFolders = true;
                if (dlg.Run ())
                    MessageDialog.ShowMessage ("Folders have been selected/created!", string.Join ("\n", dlg.Folders));
            };

            b = new Button ("Show Select Color dialog");
            PackStart (b);
            b.Clicked += delegate {
                SelectColorDialog dlg = new SelectColorDialog ("Select a color");
                dlg.SupportsAlpha = true;
                dlg.Color = Xwt.Drawing.Colors.AliceBlue;
                if (dlg.Run (ParentWindow))
                    MessageDialog.ShowMessage ("A color has been selected!", dlg.Color.ToString ());
            };

            b = new Button("Show window shown event");
            PackStart(b);
            b.Clicked += delegate
            {
                Window w = new Window();
                w.Decorated = false;
                Button c = new Button("This is a window with events on");
                w.Content = c;
                c.Clicked += delegate
                {
                    w.Dispose();
                };
                w.Shown += (sender, args) => MessageDialog.ShowMessage("My Parent has been shown");
                w.Hidden += (sender, args) => MessageDialog.ShowMessage("My Parent has been hidden");

                w.Show();

            };

            b = new Button("Show dialog with dynamically updating content");
            PackStart(b);
            b.Clicked += delegate
            {
                var dialog = new Dialog ();
                dialog.Content = new Label ("Hello World");
                Xwt.Application.TimeoutInvoke (TimeSpan.FromSeconds (2), () => {
                    dialog.Content = new Label ("Goodbye World");
                    return false;
                });
                dialog.Run ();
            };
        }
예제 #11
0
        public static void Main(string[] args)
        {
            Application.Initialize();

            var w = new Xwt.Window();

            w.Padding = 0;
            w.Title   = "Teststestse";
            w.Hidden += (object s, EventArgs ea) => {
                Application.Exit();
                w.Dispose();
            };

            var vb = new VBox();

            w.Content = vb;

            TooltipWindow ttw = null;
            var           b   = new Button("Show tooltip");

            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }

                ttw = new TooltipWindow();
                ttw.TransientFor = w;
                ttw.Show();
            };

            vb.PackStart(b);

            b          = new Button("Hide tooltip");
            b.Clicked += (object s, EventArgs ea) => {
                if (ttw != null)
                {
                    ttw.Dispose();
                }
            };

            vb.PackStart(b);

            var mc = new MyMainComponent();

            mc.LineColor        = Colors.Green;
            mc.ExpandHorizontal = true;
            vb.PackStart(mc);

            var scr = new HScrollbar();

            scr.ExpandHorizontal = true;
            vb.PackEnd(scr);

            scr.LowerValue    = 0;
            scr.UpperValue    = 1;
            scr.PageSize      = 0.05;
            scr.PageIncrement = 0.05;


            mc = new MyMainComponent {
                LineColor = Colors.Blue, WidthRequest = 400, HeightRequest = 40
            };
            vb.PackEnd(mc);
            mc.ExpandHorizontal = true;
            mc.ExpandVertical   = true;

            scr.ValueChanged += (object o, EventArgs ea) =>
            {
                mc.modValue = scr.Value;
                mc.QueueDraw();
            };

            var button = new Button("Hello");

            mc.AddChild(button, 50, 20);

            w.Show();



            Application.Run();
            Application.Dispose();
        }
예제 #12
0
파일: WidgetTests.cs 프로젝트: m13253/xwt
		public void Coordinates ()
		{
			var win = new Window ();
			var w = CreateWidget ();
			win.Content = w;
			win.Show ();

			Application.DispatchPendingEvents ();

			Assert.AreEqual (w.ScreenBounds, win.ScreenBounds);

			win.Dispose ();
		}
예제 #13
0
파일: WidgetTests.cs 프로젝트: m13253/xwt
		public void MinSize ()
		{
			var win = new Window ();
			var w = CreateWidget ();

			win.Content = w;
			win.Show ();

			Application.DispatchPendingEvents ();

			var defw = w.Size.Width;
			var defh = w.Size.Height;

			w.MinWidth = 300;
			Assert.AreEqual (300, w.MinWidth);
			Assert.AreEqual (300, w.Size.Width);

			w.MinHeight = 400;
			Assert.AreEqual (400, w.MinHeight);
			Assert.AreEqual (400, w.Size.Height);

			w.MinWidth = -1;
			Assert.AreEqual (-1, w.MinWidth);
			Assert.AreEqual (defw, w.Size.Width);

			w.MinHeight = -1;
			Assert.AreEqual (-1, w.MinHeight);
			Assert.AreEqual (defh, w.Size.Height);

			win.Dispose ();
		}
예제 #14
0
파일: WidgetTests.cs 프로젝트: m13253/xwt
		public void Focus ()
		{
			var win = new Window ();
			var w = CreateWidget ();

			Run (delegate {
				HBox box = new HBox ();
				TextEntry e = new TextEntry ();
				box.PackStart (e);
				box.PackStart (w);
				win.Content = box;
				win.Show ();
				win.Present ();

//				for (int n=0; n < 500; n++) {
					Application.DispatchPendingEvents ();
//					System.Threading.Thread.Sleep (10);
//				}

				e.SetFocus ();

				Application.DispatchPendingEvents ();

				Assert.IsFalse (w.HasFocus);
		//		Assert.IsTrue (w.CanGetFocus);

				int gotFocus = 0;
				w.GotFocus += delegate {
					gotFocus++;
				};

				w.SetFocus ();
				Assert.IsTrue (w.HasFocus);
				Assert.AreEqual (1, gotFocus);

				int lostFocus = 0;
				w.LostFocus += delegate {
					lostFocus++;
				};

				e.SetFocus ();

				Assert.IsFalse (w.HasFocus);
	//			Assert.AreEqual (1, lostFocus);

				win.Dispose ();
			});
		}