public void Show(string[] userlist) { Console.WriteLine("showusersdialog.Show()"); if (showusersdialog != null) { showusersdialog.Destroy(); } Glade.XML app = new Glade.XML(EnvironmentHelper.GetExeDirectory() + "/metaverse.client.glade", "showusersdialog", ""); app.Autoconnect(this); btnclose.Clicked += new EventHandler(btnclose_Clicked); ListStore liststore = new ListStore(typeof(string)); userstreeview.Model = liststore; userstreeview.AppendColumn("User name:", new CellRendererText(), "text", 0); userstreeview.ShowAll(); foreach (string username in userlist) { liststore.AppendValues(username); } }
public static void GrabWindow(Gtk.Window window) { window.GrabFocus(); Grab.Add(window); Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(window.GdkWindow, true, Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME); if (grabbed == Gdk.GrabStatus.Success) { grabbed = Gdk.Keyboard.Grab(window.GdkWindow, true, CURRENT_TIME); if (grabbed != Gdk.GrabStatus.Success) { Grab.Remove(window); window.Destroy(); } } else { Grab.Remove(window); window.Destroy(); } }
private void on_window1_delete_event(object o, DeleteEventArgs args) { dosend = false; //((Gtk.Window) gxml["NewFaxDialog"]).Destroy(); NewFaxDialog.Destroy(); Application.Quit(); args.RetVal = true; }
public override void Destroy() { GLib.Source.Remove(timerId); gmapWidget.Destroy(); if (mapWindow != null) { mapWindow.Destroy(); } uow?.Dispose(); base.Destroy(); }
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; } }
void DestroyWindow() { if (window != null) { window.Destroy(); } }
public static bool CloseTopDialog() { if (windows.Count <= 1) { return(false); } Window window = windows.Peek(); Dialog dialog = window as Dialog; if (dialog != null) { dialog.Respond(ResponseType.DeleteEvent); } while (Application.EventsPending()) { Application.RunIteration(false); } window.Destroy(); PopModal(window); return(true); }
protected void _mainWidget_Destroyed(object sender, EventArgs e) { memo.MemoChange -= this.TextUpdate; if (keyPressObject != null) { (keyPressObject as HtmlElement).KeyPress -= OnKeyPress; } frame1.ExposeEvent -= OnWidgetExpose; hbox1.Realized -= Hbox1_Realized; if ((browser as TWWebBrowserIE) != null) { if (vbox2.Toplevel is Window) { (vbox2.Toplevel as Window).SetFocus -= MainWindow_SetFocus; } frame1.Unrealized -= Frame1_Unrealized; (browser as TWWebBrowserIE).socket.UnmapEvent -= (browser as TWWebBrowserIE).Socket_UnmapEvent; } if (browser != null) { browser.Dispose(); } if (popupWindow != null) { popupWindow.Destroy(); } memo.MainWidget.Destroy(); memo = null; _mainWidget.Destroyed -= _mainWidget_Destroyed; _owner = null; }
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(); }
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(); }
public Loader(PeriodicTableLogic logic, GtkWindow mainWindow) { GladeXml dlg_loading = new GladeXml(null, "loader.glade", "loaderWindow", null); dlg_loading.Autoconnect(this); this.logic = logic; loaderWindow.Hidden += new EventHandler(delegate(object sender, EventArgs e) { if (logic.IsInit) { Application.Invoke(delegate(object sender2, EventArgs e2) { mainWindow.ShowAll(); }); } else { MessageDialog md = new MessageDialog(mainWindow, DialogFlags.DestroyWithParent, MessageType.Error, ButtonsType.Close, "Periodic Table not loaded. Program will now exit."); md.Run(); md.Destroy(); Application.Quit(); } }); loaderWindow.DeleteEvent += new DeleteEventHandler(delegate(object sender, DeleteEventArgs e) { loaderThread.Abort(); }); cancelButton.Clicked += new EventHandler(delegate(object sender, EventArgs e) { loaderWindow.Destroy(); loaderThread.Abort(); }); }
public void ActionCancel(object sender, EventArgs args) { GlobalObj.CloseConnection(); MainWindow.Destroy(); MainWindow.Dispose(); Application.Quit(); }
public void Close() { if (IsShownModal) { Application.Quit(); } mainWindow.Destroy(); }
protected virtual void Cleanup() { System.Windows.Forms.Application.Idle -= HandleSystemWindowsFormsApplicationIdle; if (m_popupWindow != null) { m_popupWindow.Destroy(); m_popupWindow.Dispose(); } }
internal void ResetFloatMode() { if (floatingWindow != null) { floatingWindow.Remove(Widget); floatingWindow.Destroy(); floatingWindow = null; widget.UpdateBehavior(); } }
private void OnMigrationSlowStarted(string title, string message) { lock (this) { if (slow_window != null) { slow_window.Destroy(); } Gtk.Application.Init(); slow_window = new Gtk.Window(String.Empty); slow_window.BorderWidth = 10; slow_window.WindowPosition = Gtk.WindowPosition.Center; slow_window.DeleteEvent += delegate(object o, Gtk.DeleteEventArgs args) { args.RetVal = true; }; Gtk.VBox box = new Gtk.VBox(); box.Spacing = 5; Gtk.Label title_label = new Gtk.Label(); title_label.Xalign = 0.0f; title_label.Markup = String.Format("<b><big>{0}</big></b>", GLib.Markup.EscapeText(title)); Gtk.Label message_label = new Gtk.Label(); message_label.Xalign = 0.0f; message_label.Text = message; message_label.Wrap = true; slow_progress = new Gtk.ProgressBar(); box.PackStart(title_label, false, false, 0); box.PackStart(message_label, false, false, 0); box.PackStart(slow_progress, false, false, 0); slow_window.Add(box); slow_window.ShowAll(); IterateSlow(); } }
private void Close() { //Really Quit? if (!ChangeConfirm("quit")) { return; } Settings.Instance.Save(); MainWindow.Destroy(); Gtk.Application.Quit(); }
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(); }
void ShowServersCallback( string[] whoresults ) { if (availableserversdialog != null) { availableserversdialog.Destroy(); } List<string> serverlist = new List<string>(); foreach (string name in whoresults) { if (name.StartsWith( servernameprefix )) { serverlist.Add( name.Substring( servernameprefix.Length ) ); } } Glade.XML app = new Glade.XML( EnvironmentHelper.GetExeDirectory() + "/metaverse.client.glade", "availableserversdialog", "" ); app.Autoconnect( this ); btnclose.Clicked += new EventHandler( btnclose_Clicked ); btnconnect.Clicked += new EventHandler( btnconnect_Clicked ); btngetinfo.Clicked += new EventHandler( btngetinfo_Clicked ); liststore = new ListStore( typeof( string ) ); serverstreeview.Model = liststore; serverstreeview.AppendColumn( "Server:", new CellRendererText(), "text", 0 ); serverstreeview.ShowAll(); foreach (string name in whoresults) { if (name.StartsWith( servernameprefix )) { string worldname = name.Substring( servernameprefix.Length ); liststore.AppendValues( worldname ); } } }
void ResetFloatMode() { if (floatingWindow != null) { // The widgets have already been removed from the window in ResetMode floatingWindow.Destroy(); floatingWindow = null; if (titleTab != null) { titleTab.UpdateBehavior(); } } }
void on_selecciona_empleado_busqueda_clicked(object sender, EventArgs args) { TreeModel model; TreeIter iterSelected; if (lista_de_empleados.Selection.GetSelected(out model, out iterSelected)) { idempleadoseleccionado = (string)model.GetValue(iterSelected, 0); //Console.WriteLine (selcampo); busca_empleado.Destroy(); llena_empleado_debaja(); } }
protected virtual void SetView(PhotoImageView view) { if (controls != null) { controls.Destroy(); } controls = null; this.view = view; if (view == null) { return; } Widget w = CreateControls(); if (w != null) { #if false ControlOverlay c = new ControlOverlay(view); c.AutoHide = false; w.ShowAll(); c.Add(w); c.Visibility = ControlOverlay.VisibilityType.Full; controls = c; #else Window win = new Window(String.Format("{0}", GetTitle())); win.TransientFor = (Gtk.Window)view.Toplevel; win.Add(w); win.ShowAll(); win.DeleteEvent += delegate { Destroy(); }; controls = win; #endif } }
void on_button_cancela_folios_clicked(object sender, EventArgs args) { if ((bool)accesocancelafolio == true) { menu_admision.Destroy(); Glade.XML gxml = new Glade.XML(null, "registro_admision.glade", "cancelador_folios", null); gxml.Autoconnect(this); cancelador_folios.Show(); button_cancelar.Clicked += new EventHandler(on_button_cancelar_clicked); button_salir.Clicked += new EventHandler(on_cierraventanas_clicked); } else { MessageDialog msgBox = new MessageDialog(MyWin, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "No esta autorizado para esta opcion..."); msgBox.Run(); msgBox.Destroy(); } }
protected void _mainWidget_Destroyed(object sender, EventArgs e) { memoView1.MemoChange -= this.TextUpdate; frame1.ExposeEvent -= OnWidgetExpose; hbox1.Realized -= Hbox1_Realized; if ((browser as TWWebBrowserIE) != null) { if (vbox2.Toplevel is Window) { (vbox2.Toplevel as Window).SetFocus -= MainWindow_SetFocus; } frame1.Unrealized -= Frame1_Unrealized; (browser as TWWebBrowserIE).socket.UnmapEvent += (browser as TWWebBrowserIE).Socket_UnmapEvent; } if (popupWin != null) { popupWin.Destroy(); } }
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; }
public void Dispose() { window.ExposeEvent -= HandleWindowExposeEvent; DockServices.Theme.ThemeChanged -= DockyControllerThemeChanged; currentSurface = null; if (window != null) { window.Destroy(); window.Dispose(); window = null; } if (slices != null) { foreach (DockySurface s in slices) { s.Dispose(); } slices = null; } ResetBackgroundBuffer(); }
public void DetachPlayer() { bool isPlaying = Player.Playing; /* Pause the player here to prevent the sink drawing while the windows * are beeing changed */ Player.Pause(); if (!detachedPlayer) { Log.Debug("Detaching player"); ExternalWindow playerWindow = new ExternalWindow(); this.playerWindow = playerWindow; playerWindow.Title = Constants.SOFTWARE_NAME; int player_width = playercapturer.Allocation.Width; int player_height = playercapturer.Allocation.Height; playerWindow.SetDefaultSize(player_width, player_height); playerWindow.DeleteEvent += (o, args) => DetachPlayer(); playerWindow.Show(); playercapturer.Reparent(playerWindow.Box); // Hack to reposition video window in widget for OSX playerWindow.Resize(player_width + 10, player_height); videowidgetsbox.Visible = false; } else { Log.Debug("Attaching player again"); videowidgetsbox.Visible = true; playercapturer.Reparent(this.videowidgetsbox); playerWindow.Destroy(); } if (isPlaying) { Player.Play(); } detachedPlayer = !detachedPlayer; }
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; }
void imprime_reporte(object sender, EventArgs args) { if (this.checkbutton_impr_todo_proce.Active == true) { query_fechas = " "; rango1 = ""; rango2 = ""; } else { rango1 = entry_dia1.Text + "/" + entry_mes1.Text + "/" + entry_ano1.Text; rango2 = entry_dia2.Text + "/" + entry_mes2.Text + "/" + entry_ano2.Text; query_fechas = "AND to_char(osiris_erp_cobros_enca.fecha_alta_paciente,'yyyy-MM-dd') >= '" + entry_ano1.Text + "-" + entry_mes1.Text + "-" + entry_dia1.Text + "' " + "AND to_char(osiris_erp_cobros_enca.fecha_alta_paciente,'yyyy-MM-dd') <= '" + entry_ano2.Text + "-" + entry_mes2.Text + "-" + entry_dia2.Text + "' "; } rang_fech_pac_sin_alta.Destroy(); titulo = "Reporte Pacientes con Alta Medica"; print = new PrintOperation(); print.JobName = titulo; print.BeginPrint += new BeginPrintHandler(OnBeginPrint); print.DrawPage += new DrawPageHandler(OnDrawPage); print.EndPrint += new EndPrintHandler(OnEndPrint); print.Run(PrintOperationAction.PrintDialog, null); }
public void Close() { mainWindow.Destroy(); }
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; } }; }
protected virtual void Cleanup() { System.Windows.Forms.Application.Idle -= HandleSystemWindowsFormsApplicationIdle; m_popupWindow.Destroy(); }
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(); }
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); win.Add(vbox); UpdateWarnings(); win.ShowAll(); }
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; }
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; }
/// <summary> /// Close GtkWindows /// </summary> public void ActionCancel(object sender, EventArgs args) { AboutDialog.Destroy(); AboutDialog.Dispose(); }
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); }
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(); }
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(); }
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; } }
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."))); ClientUpgradeDialog.Run(); ClientUpgradeDialog.Hide(); ClientUpgradeDialog.Destroy(); } else { iFolderMsgDialog dialog = new iFolderMsgDialog( null, iFolderMsgDialog.DialogType.Error, iFolderMsgDialog.ButtonSet.None, Util.GS("Upgrade Failure"), Util.GS("The iFolder client upgrade failed."), Util.GS("Please contact your system administrator.")); dialog.Run(); dialog.Hide(); dialog.Destroy(); dialog = null; } if( DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded ) { if( domainController.GetDomain(this.NewClientDomainID) != null) domainController.RemoveDomain(this.NewClientDomainID, false); } } else { if(DomainController.upgradeStatus.statusCode == StatusCodes.ServerOld || DomainController.upgradeStatus.statusCode == StatusCodes.UpgradeNeeded ) { if( domainController.GetDomain(this.NewClientDomainID) != null) domainController.RemoveDomain(this.NewClientDomainID, false); } } ClientUpgradeDialog = null; this.ClientUpgradeStatus = null; this.NewClientVersion = null; this.NewClientDomainID = null; }