public DatabaseOverviewWindow(Database db, string dbPath) : this(new Builder("DatabaseOverviewWindow.glade")) { this.db = db; this.dbPath = dbPath; if (db.syncWebDav) { syncBtn.Visible = true; } UpdateUI(); System.Timers.Timer uiUpdateCheck = new System.Timers.Timer(200); uiUpdateCheck.Elapsed += (delegate { if (updateUi) { updateUi = false; UpdateUI(); } }); uiUpdateCheck.Start(); aow = new AccountOverviewWindow(db, dbPath, 0, this); aow.Show(); this.SetPosition(WindowPosition.Center); this.Move(Screen.GetMonitorGeometry(Screen.PrimaryMonitor).Right - (Screen.GetMonitorGeometry(Screen.PrimaryMonitor).Width / 2) - 396 * 2, y: 200); }
private void accountList_ButtonPress(object o, ButtonPressEventArgs e) { if (e.Event.Button == 3) { Menu m = new Menu(); MenuItem openItem = new MenuItem("Open"); openItem.ButtonPressEvent += new ButtonPressEventHandler(delegate(object oo, ButtonPressEventArgs args) { Gtk.TreeIter selected; if (accountList.Selection.GetSelected(out selected)) { int account = (int)accountListStore.GetValue(selected, 2); aow.ac = account; aow.updateUi = true; if (!aow.IsVisible) { aow = new AccountOverviewWindow(db, dbPath, account, this); aow.Show(); } } }); MenuItem editItem = new MenuItem("Edit"); editItem.ButtonPressEvent += new ButtonPressEventHandler(accountList_EditBtnPress); m.Add(openItem); m.Add(editItem); m.ShowAll(); m.Popup(); } else if (((Gdk.EventButton)e.Event).Type == Gdk.EventType.DoubleButtonPress) { Gtk.TreeIter selected; if (accountList.Selection.GetSelected(out selected)) { int account = (int)accountListStore.GetValue(selected, 2); aow.ac = account; aow.updateUi = true; if (!aow.IsVisible) { aow = new AccountOverviewWindow(db, dbPath, account, this); aow.Show(); } } } }