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 (); }
public void Run() { ApplicationExtensions.InvokeInUIThread(() => { var window = new Window(); window.Width = 800; window.Height = 600; window.Content = new LogViewer(LuceneLoggerBackend.Instance); window.Show(); }); }
public void ShowWindow (Window win) { var ev = new ManualResetEvent (false); win.Shown += delegate { ev.Set (); }; win.Show (); ev.WaitForEvent (); Application.MainLoop.DispatchPendingEvents (); }
static void Main(string[] args) { string dataFolderPath = Directory.GetCurrentDirectory(); string database = String.Format("{0}\\data.db", dataFolderPath); dataSource = "data source=" + database; tableName = "product"; tableName = "product"; PlotHelper.createTable(dataSource,tableName); PlotHelper.TestConnection(dataSource); // TODO: add Xwt.WPF.dll to vendor directory Application.Initialize(ToolkitType.Gtk); Window MainWindow = new Window() { Title = "Xwt Demo Application", Width = 500, Height = 400 }; MainWindow.CloseRequested += (o, e) => { Application.Exit(); }; Menu MainMenu = new Menu(); RichTextView TextView = new RichTextView(); MenuItem FileOpenMenuItem = new MenuItem("???????"); Menu FileMenu = new Menu(); FileOpenMenuItem.Clicked += (o, e) => { OpenFileDialog Dialog = new OpenFileDialog("??????? ????"); if (Dialog.Run(MainWindow)) { TextView.LoadFile(Dialog.FileName, Xwt.Formats.TextFormat.Markdown); } }; MenuItem FileMenuItem = new MenuItem("????") { SubMenu = FileMenu }; FileMenu.Items.Add(FileOpenMenuItem); MainMenu.Items.Add(FileMenuItem); MainWindow.MainMenu = MainMenu; var n = new NotebookSample(); MainWindow.Content = n; MainWindow.Show(); Application.Run(); }
public void Focus() { using (var win = new Window ()) { var w = CreateWidget (); HBox box = new HBox (); TextEntry e = new TextEntry (); box.PackStart (e); box.PackStart (w); win.Content = box; win.Show (); win.Present (); Application.MainLoop.DispatchPendingEvents (); e.SetFocus (); Application.MainLoop.DispatchPendingEvents (); Assert.IsFalse (w.HasFocus); // Assert.IsTrue (w.CanGetFocus); int gotFocus = 0; w.GotFocus += delegate { gotFocus++; }; w.SetFocus (); if (w.CanGetFocus) { 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); } else { Assert.IsFalse (w.HasFocus); Assert.AreEqual (0, gotFocus); } } }
public virtual Xwt.Window ShowTooltipWindow(TextEditor editor, double offset, Xwt.ModifierKeys modifierState, Point mouse, TooltipItem item) { Xwt.Window tipWindow = CreateTooltipWindow(editor, offset, modifierState, item); if (tipWindow == null) { return(null); } var point = editor.ConvertToScreenCoordinates(mouse); double w; double xalign; GetRequiredPosition(editor, tipWindow, out w, out xalign); w += 10; Rectangle geometry = editor.ParentWindow.Screen.VisibleBounds; point.X -= (int)((double)w * xalign); point.Y += 10; if (point.X + w >= geometry.X + geometry.Width) { point.X = geometry.X + geometry.Width - w; } if (point.X < geometry.Left) { point.X = geometry.Left; } var h = tipWindow.Size.Height; if (point.Y + h >= geometry.Y + geometry.Height) { point.Y = geometry.Y + geometry.Height - h; } if (point.Y < geometry.Top) { point.Y = geometry.Top; } tipWindow.Location = point; tipWindow.Show(); return(tipWindow); }
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; } } }
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 (); }; }
public void ShowAnalyser(IAnalyzableBackendAnalyzer analyzer, string name) { var guiWidget = analyzer as IHasWidget; if(guiWidget == null) { throw new ArgumentException("Wrong analyzer provided, expected object of type 'IHasGUIWidget'"); } var window = new Window(); window.Title = name; window.Height = 600; window.Width = 800; window.Content = guiWidget.Widget; openedWindows.Add(analyzer, window); window.Closed += (sender, e) => openedWindows.Remove(analyzer); window.Show(); }
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(); }
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!"); }; }
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(); }; }
private void btnSyncCalendar_Click() { try { string validationMessage = ValidateControls(); if (!String.IsNullOrEmpty(validationMessage)) { MessageDialog.ShowError(this.ParentWindow, validationMessage); return; } IICalendarCollection iCalCollection = GetCalendarEventsData(); if (iCalCollection == null) { MessageDialog.ShowMessage(this.ParentWindow, "There is no calendar with the name " + txtCalendarName.Text.Trim()); } else { Hide(); int? syncTimerInterval = null; if (!String.IsNullOrEmpty(txtTimerInterval.Text)) { syncTimerInterval = Convert.ToInt32(txtTimerInterval.Text); } this.ParentWindow.Hide(); var eventListWindow = new Window() { Title = "ownCloud Calendar Client", Width = 500, Height = 500 }; eventListWindow.Resizable = false; eventListWindow.ShowInTaskbar = false; EventsList eventsList = new EventsList(iCalCollection, cbAutomaticSync.Active, syncTimerInterval, txtCalendarName.Text, serverUrl, username, password, serverAddress); eventListWindow.Content = eventsList; eventListWindow.Show(); if (eventsList.IsHiden) { HideForm(); } else { //this.ParentWindow.Show(); } } } catch (Exception ex) { HandleException(ex); } }
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 (); }
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 (); }; }
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 (); }
private void btnSettings_Click() { try { this.ParentWindow.Hide(); var syncCalendarWindow = new Window() { Title = "ownCloud Calendar Client", Width = 500, Height = 250 }; syncCalendarWindow.Resizable = false; SyncCalendar syncCalendar = new SyncCalendar(ServerAddress, Username, Password); syncCalendarWindow.Content = syncCalendar; syncCalendarWindow.Show(); } catch (Exception ex) { HandleException(ex); } }
private void btnLogOut_Click() { try { this.ParentWindow.Hide(); 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(); } catch (Exception ex) { HandleException(ex); } }
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 (); }); }
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(); }