static bool HandleShouldSelectTabViewItem(NSTabView tabView, NSTabViewItem item) { var handler = ((EtoTabView)tabView).WeakHandler.Target as TabControlHandler; var tab = handler.Widget.Pages.FirstOrDefault(r => ((TabPageHandler)r.Handler).TabViewItem == item); return(tab == null || tab.Enabled); }
public override void DidFinishLaunching (NSNotification notification) { mainWindowController = new MainWindowController (); // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem () { View = new CustomDrawRectView (tabView.ContentRect), Label = "CustomDrawRectView" }; tabView.Add (firstTab); NSTabViewItem secondTab = new NSTabViewItem () { View = new CustomLayerBasedView (tabView.ContentRect), Label = "CustomLayerBasedView" }; tabView.Add (secondTab); mainWindowController.Window.ContentView.AddSubview (tabView); mainWindowController.Window.MakeKeyAndOrderFront (this); }
public override Id InitConnectionType(RoyalConnection data, NSTabViewItem tabViewItem, NSWindow parentWindow) { Data = data; TabViewItem = tabViewItem; return(this); }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController(); // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView(frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem() { View = new CustomDrawRectView(tabView.ContentRect), Label = "CustomDrawRectView" }; tabView.Add(firstTab); NSTabViewItem secondTab = new NSTabViewItem() { View = new CustomLayerBasedView(tabView.ContentRect), Label = "CustomLayerBasedView" }; tabView.Add(secondTab); mainWindowController.Window.ContentView.AddSubview(tabView); mainWindowController.Window.MakeKeyAndOrderFront(this); }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController(); // This is where we setup our visual tree. These could be setup in MainWindow.xib, but // this example is showing programmatic creation. // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView(frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem() { View = OutlineSetup.SetupOutlineView(frame), Label = "NSOutlineView" }; tabView.Add(firstTab); NSTabViewItem secondTab = new NSTabViewItem() { View = TableSetup.SetupTableView(frame), Label = "NSTableView" }; tabView.Add(secondTab); mainWindowController.Window.ContentView.AddSubview(tabView); mainWindowController.Window.MakeKeyAndOrderFront(this); }
public override void DidSelect(NSTabView tabView, NSTabViewItem item) { if (SetRootPersonMenuItem != null) { SetRootPersonMenuItem.Enabled = false; } if (App.Document == null) { return; // don't bother if we've not loaded a document yet } switch (Title) { case "MainListsController": MainLists(item.Label); break; case "ErrorsFixesController": ErrorsFixes(item.Label); break; case "LocationsController": Locations(item.Label); break; } }
public override void DidSelect(NSTabView tabView, NSTabViewItem item) { if (this.inhibitSelection) { return; } ViewModel.SelectedBrushType = ViewModel.BrushTypes[item.Label]; this.filterResource.Hidden = ViewModel.SelectedBrushType != CommonBrushType.Resource; if (!this.filterResource.Hidden) { if (Selected is TabButton tb) { tb.NextKeyView = this.filterResource; item.View.Window?.MakeFirstResponder(this.filterResource); if (item.View.Subviews.Length > 1 && item.View.Subviews[1].Subviews.Length > 0 && item.View.Subviews[1].Subviews[0] is NSOutlineView rov) { rov.NextKeyView = this.filterResource.NextKeyView; this.filterResource.NextKeyView = rov; } } } base.DidSelect(tabView, item); }
public void Add(DockablePanel panel) { if (panel == null) throw new ArgumentNullException("panel"); NSTabView tabControl; if (panel.Dock == DockStyle.Left || panel.Dock == DockStyle.Top) { tabControl = TabControl1; } else { tabControl = TabControl2; } if (tabControl == null) return; var tabPage = new NSTabViewItem(); tabPage.View = ((NSView)panel.InnerControl); tabPage.Identifier = NSObject.FromObject(panel.Key); tabPage.Label = panel.Caption; //tabPage.d += TabPageOnVisibleChanged; _allTabs.Add(panel.Key, tabPage); tabControl.Add(tabPage); OnPanelAdded(new DockablePanelEventArgs(panel.Key)); OnActivePanelChanged(new DockablePanelEventArgs(panel.Key)); }
public override void WillSelect(NSTabView tabView, NSTabViewItem item) { if (item is TabViewItem tabViewItem) { owner.viewModel.OnTabChanging(tabViewItem.id); } }
public override void DidSelect(NSTabView tabView, NSTabViewItem item) { base.DidSelect(tabView, item); var controller = item.ViewController as ColorComponentViewController; EditorType = controller.EditorType; }
public override void DidFinishLaunching(NSNotification notification) { mainWindowController = new MainWindowController (); // This is where we setup our visual tree. These could be setup in MainWindow.xib, but // this example is showing programmatic creation. // We create a tab control to insert both examples into, and set it to take the entire window and resize CGRect frame = mainWindowController.Window.ContentView.Frame; NSTabView tabView = new NSTabView (frame) { AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable }; NSTabViewItem firstTab = new NSTabViewItem () { View = OutlineSetup.SetupOutlineView (frame), Label = "NSOutlineView" }; tabView.Add (firstTab); NSTabViewItem secondTab = new NSTabViewItem () { View = TableSetup.SetupTableView (frame), Label = "NSTableView" }; tabView.Add (secondTab); mainWindowController.Window.ContentView.AddSubview (tabView); mainWindowController.Window.MakeKeyAndOrderFront (this); }
public void Add(IWidgetBackend widget, NotebookTab tab) { NSTabViewItem item = new NSTabViewItem(); item.Label = tab.Label; item.View = GetWidget(widget); Widget.Add(item); }
public override void WillSelect(NSTabView tabView, NSTabViewItem item) { var controller = item.ViewController as ColorComponentViewController; base.WillSelect(tabView, item); controller.ViewModel = ViewModel; EditorType = controller.EditorType; }
public override void WillSelect(NSTabView tabView, NSTabViewItem item) { var myItem = item as TabViewItem; if (myItem != null) { owner.viewEvents.OnTabChanging(myItem.id, myItem.tag); } }
public override void DidSelect(NSTabView tabView, NSTabViewItem item) { base.DidSelect(tabView, item); if (View?.Window?.WindowController is PreferencesWindowController windowController) { windowController.DidSelectTabViewItem(item); } }
public void NSTabViewControllerShouldAddTabViewItem() { var item = new NSTabViewItem { ViewController = new NSViewController() }; controller.AddTabViewItem(item); Assert.IsTrue(controller.TabViewItems.Contains(item), "NSTabViewControllerShouldAddTabViewItem - Failed to add TabViewItem"); }
public void Add(IViewWrapper viewWrapper) { Pages.Add(viewWrapper); var tabItem = new NSTabViewItem() { View = viewWrapper.NativeObject as NSView }; pages.Add(tabItem); tabView.Add(tabItem); }
public override void DidSelect(NSTabView tabView, NSTabViewItem item) { if (this.inhibitSelection) { return; } ViewModel.SelectedBrushType = ViewModel.BrushTypes[item.Label]; this.filterResource.Hidden = ViewModel.SelectedBrushType != CommonBrushType.Resource; base.DidSelect(tabView, item); }
public TabPageHandler() { TabViewItem = new MyTabViewItem { Handler = this, Identifier = new NSString(Guid.NewGuid().ToString()), View = new MacEventView { Handler = this } }; Control = TabViewItem.View; Enabled = true; }
public override Id InitConnectionType(RoyalConnection data, NSTabViewItem tabViewItem, NSWindow parentWindow) { Id ret = base.InitConnectionType(data, tabViewItem, parentWindow); m_nativeFrameworkHandle = ApiUtils.LoadPluginFramework(typeof(RdpConnection), "RdpView"); IntPtr funcSymbol = ApiUtils.GetSymbolFromHandle(m_nativeFrameworkHandle, "getRdpViewController"); NativeGetRdpViewController GetRdpViewController = (NativeGetRdpViewController)ApiUtils.GetDelegateFunctionFromFramework <NativeGetRdpViewController>(funcSymbol); m_nativeController = ObjectiveCRuntime.GetInstance <NSObject>(GetRdpViewController(this.NativePointer, parentWindow.NativePointer)); return(ret); }
public override void WillSelect(NSTabView tabView, NSTabViewItem item) { if (item.ViewController is NotifyingViewController <BrushPropertyViewModel> brushController) { brushController.ViewModel = ViewModel; } if (this.inhibitSelection) { return; } base.WillSelect(tabView, item); }
public void DidSelect(NSTabView tabView, NSTabViewItem item) { if (tabView != null && item != null) { switch (item.Label) { case "Logs": { tvPiiLogs.Value = string.Empty; tvPiiLogs.Value = _errorLog; } break; case "Raw Token": { tvRawToken.Value = string.Empty; //tvRawToken.Value = (_currentToken != null) ? _currentToken.Token : string.Empty; } break; case "Token": { } break; case "Cache": { } break; case "Keychain": { if (_currentEndpoint != null) { //_keychainTvDataSource.KeychainValues = KeychainService.Instance.GetRecordsFromKeychain($"{_currentEndpoint.TeamId}.{_currentEndpoint.KeychainSecurityGroup}"); //tvKeychain.ReloadData(); } } break; default: { //auth window - do nothing } break; } } }
private void UpdateSelectedTab() { var controller = ViewModel.CurrentSelectionVisual; var visual = controller.View; var pages = FeaturePagesTabView.Items; var selectedPage = pages.FirstOrDefault(p => p.View == visual); if (selectedPage == null) { _pageControllers.Add(controller); selectedPage = new NSTabViewItem(); selectedPage.View = visual; FeaturePagesTabView.Add(selectedPage); } FeaturePagesTabView.Select(selectedPage); }
protected virtual NSTabViewItem GetTabViewItem(Page page, IVisualElementRenderer pageRenderer) { var tvi = new NSTabViewItem { ViewController = pageRenderer.ViewController, Label = page.Title ?? "" }; if (!string.IsNullOrEmpty(page.Icon)) { var image = GetTabViewItemIcon(page.Icon); if (image != null) { tvi.Image = image; } } return(tvi); }
protected virtual NSTabViewItem GetTabViewItem(Page page, IVisualElementRenderer pageRenderer) { var tvi = new NSTabViewItem { ViewController = pageRenderer.ViewController, Label = page.Title ?? "" }; _ = this.ApplyNativeImageAsync(page, Page.IconImageSourceProperty, icon => { if (icon != null) { var image = GetTabViewItemIconImageSource(icon); if (image != null) { tvi.Image = image; } } }); return(tvi); }
public void NSTabViewControllerShouldInsertTabViewItem() { controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); var item = new NSTabViewItem { ViewController = new NSViewController() }; controller.InsertTabViewItem(item, 1); Assert.IsTrue(controller.TabViewItems [1] == item, "NSTabViewControllerShouldInsertTabViewItem - Failed to insert the item at the given position."); Assert.IsFalse(controller.TabViewItems [0] == item, "NSTabViewControllerShouldInsertTabViewItem - Inserted the item in the wrong position."); }
public void NSTabViewControllerShouldGetTabViewItem() { controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); controller.AddTabViewItem(new NSTabViewItem { ViewController = new NSViewController() }); var viewController = new NSViewController(); var item = new NSTabViewItem { ViewController = viewController }; controller.InsertTabViewItem(item, 1); var retrievedItem = controller.GetTabViewItem(viewController); Assert.IsTrue(retrievedItem == item, "NSTabViewControllerShouldGetTabViewItem - Failed to get TabViewItem from ViewController"); }
/// <summary> /// Mac-specific implementation /// </summary> /// <param name="pageName">Page name.</param> /// <param name="icon">The icon for the page.</param> /// <param name="page">Platform-specific page visual data.</param> partial void AddTab(string pageName, string icon, object page) { var pageController = page as NSViewController; PageControllers.Add(pageController); var tabViewItem = new NSTabViewItem(); tabViewItem.Label = pageName; tabViewItem.View = pageController.View; PropertyPages.Add(tabViewItem); NSToolbarItem item = null; if (!string.IsNullOrEmpty(icon)) { if (Toolbar.Items.Length < PropertyPages.Count) { var pageAsDependencyObject = page as IFakeDependencyObject; var id = pageAsDependencyObject.DataContext.GetType().FullName; item = new NSToolbarItem(id); item.Label = pageName.TrimEnd(new char[] { '.' }); item.Image = page.GetType().LoadImageResource(icon); var size = new CGSize(item.Image.Size.Width * 2, item.Image.Size.Height); item.MinSize = size; item.MaxSize = size; Toolbar.AddToolbarItem(item, id, Toolbar.Items.Length); } else { item = Toolbar.Items[PropertyPages.Count - 1]; } } else { item = Toolbar.Items[PropertyPages.Count - 1]; } SelectableItemIdentifiers.Add(item.Identifier); item.Activated += SettingsPageSelected; }
void SetControllers() { _updatingControllers = true; for (var i = 0; i < ElementController.LogicalChildren.Count; i++) { var child = ElementController.LogicalChildren[i]; var page = child as Page; if (page == null) { continue; } var pageRenderer = Platform.GetRenderer(page); if (pageRenderer != null) { pageRenderer.ViewController.Identifier = i.ToString(); NSTabViewItem newTvi = GetTabViewItem(page, pageRenderer); AddTabViewItem(newTvi); } } _updatingControllers = false; }
public void DidSelectTabViewItem(NSTabViewItem item) { Window.Title = item.Label; ResizeWindowForView(item.View); }
public override Id InitConnectionType(RoyalConnection data, NSTabViewItem tabViewItem, NSWindow parentWindow) { Id ret = base.InitConnectionType(data, tabViewItem, parentWindow); m_nativeFrameworkHandle = ApiUtils.LoadPluginFramework(typeof(RdpConnection), "RdpView"); IntPtr funcSymbol = ApiUtils.GetSymbolFromHandle(m_nativeFrameworkHandle, "getRdpViewController"); NativeGetRdpViewController GetRdpViewController = (NativeGetRdpViewController)ApiUtils.GetDelegateFunctionFromFramework<NativeGetRdpViewController>(funcSymbol); m_nativeController = ObjectiveCRuntime.GetInstance<NSObject>(GetRdpViewController(this.NativePointer, parentWindow.NativePointer)); return ret; }
public override void AwakeFromNib() { base.AwakeFromNib(); Window.Delegate = new MainWindowDelegate(this); Window.AcceptsMouseMovedEvents = true; TabProviders = TabMain.Items[1]; CreateMenuBarIcon(); LblVersion.StringValue = "Version " + Constants.VersionDesc; CmdUpdater.Hidden = true; MnuTrayUpdate.Hidden = true; ChkRemember.State = Engine.Storage.GetBool("remember") ? NSCellStateValue.On : NSCellStateValue.Off; ChkServersShowAll.State = NSCellStateValue.Off; GuiUtils.SetCheck(ChkServersLockCurrent, Engine.Storage.GetBool("servers.locklast")); GuiUtils.SetSelected(CboServersScoringRule, Engine.Storage.Get("servers.scoretype")); CboSpeedResolutions.RemoveAllItems(); CboSpeedResolutions.AddItem(LanguageManager.GetText("WindowsMainSpeedResolution1")); CboSpeedResolutions.AddItem(LanguageManager.GetText("WindowsMainSpeedResolution2")); CboSpeedResolutions.AddItem(LanguageManager.GetText("WindowsMainSpeedResolution3")); CboSpeedResolutions.AddItem(LanguageManager.GetText("WindowsMainSpeedResolution4")); CboSpeedResolutions.AddItem(LanguageManager.GetText("WindowsMainSpeedResolution5")); CboSpeedResolutions.SelectItem(0); CmdConnect.Title = LanguageManager.GetText("CommandConnect"); LblConnect.StringValue = LanguageManager.GetText("CommandConnectSubtitle"); CmdDisconnect.Title = LanguageManager.GetText("CommandDisconnect"); CmdCancel.Title = LanguageManager.GetText("CommandCancel"); CboServersScoringRule.ToolTip = LanguageManager.GetText("TooltipServersScoreType"); ChkServersLockCurrent.ToolTip = LanguageManager.GetText("TooltipServersLockCurrent"); ChkServersShowAll.ToolTip = LanguageManager.GetText("TooltipServersShowAll"); CmdServersConnect.ToolTip = LanguageManager.GetText("TooltipServersConnect"); CmdServersUndefined.ToolTip = LanguageManager.GetText("TooltipServersUndefined"); CmdServersBlackList.ToolTip = LanguageManager.GetText("TooltipServersBlackList"); CmdServersWhiteList.ToolTip = LanguageManager.GetText("TooltipServersWhiteList"); CmdServersRename.ToolTip = LanguageManager.GetText("TooltipServersRename"); CmdServersMore.ToolTip = LanguageManager.GetText("TooltipServersMore"); CmdServersRefresh.ToolTip = LanguageManager.GetText("TooltipServersRefresh"); CmdAreasUndefined.ToolTip = LanguageManager.GetText("TooltipAreasUndefined"); CmdAreasBlackList.ToolTip = LanguageManager.GetText("TooltipAreasBlackList"); CmdAreasWhiteList.ToolTip = LanguageManager.GetText("TooltipAreasWhiteList"); CmdLogsCommand.ToolTip = LanguageManager.GetText("TooltipLogsCommand"); CmdLogsClean.ToolTip = LanguageManager.GetText("TooltipLogsClean"); CmdLogsCopy.ToolTip = LanguageManager.GetText("TooltipLogsCopy"); CmdLogsSave.ToolTip = LanguageManager.GetText("TooltipLogsSave"); CmdLogsSupport.ToolTip = LanguageManager.GetText("TooltipLogsSupport"); if (Engine.Storage.GetBool("remember")) { ChkRemember.State = NSCellStateValue.On; TxtLogin.StringValue = Engine.Storage.Get("login"); TxtPassword.StringValue = Engine.Storage.Get("password"); } CmdMainMenu.Activated += (object sender, EventArgs e) => { CoreGraphics.CGPoint p = new CoreGraphics.CGPoint(this.Window.Frame.Left + 10, this.Window.Frame.Bottom - 40); //CoreGraphics.CGPoint p = new CoreGraphics.CGPoint(CmdMainMenu.Frame.Left + 10, CmdMainMenu.Frame.Top + 10); MnuTray.PopUpMenu(MnuTrayStatus, p, null); }; CmdUpdater.Activated += (object sender, EventArgs e) => { Core.Platform.Instance.OpenUrl(Constants.WebSite + "/" + Core.Platform.Instance.GetCode().ToLowerInvariant() + "/"); }; ChkRemember.Activated += (object sender, EventArgs e) => { Engine.Storage.SetBool("remember", ChkRemember.State == NSCellStateValue.On); }; CmdLogin.Activated += (object sender, EventArgs e) => { if (Engine.IsLogged() == false) { Login(); } else { Logout(); } }; TxtLogin.Activated += (object sender, EventArgs e) => { EnabledUI(); }; TxtPassword.Activated += (object sender, EventArgs e) => { EnabledUI(); }; CboKey.Activated += (object sender, EventArgs e) => { if (Engine.Instance.Storage.Get("key") != CboKey.SelectedItem.Title) { Engine.Instance.Storage.Set("key", CboKey.SelectedItem.Title); } }; CmdConnect.Activated += (object sender, EventArgs e) => { Connect(); }; CmdDisconnect.Activated += (object sender, EventArgs e) => { Disconnect(); }; CmdCancel.Activated += (object sender, EventArgs e) => { Disconnect(); }; CmdNetworkLock.Activated += (object sender, EventArgs e) => { if (Engine.Instance.NetworkLockManager.IsActive()) { NetworkLockDeactivation(); } else { NetworkLockActivation(); } }; TableProvidersController = new TableProvidersController(this.TableProviders); this.TableProviders.Delegate = new TableProvidersDelegate(this); CmdProviderAdd.Activated += (object sender, EventArgs e) => { ProviderAdd(); }; CmdProviderRemove.Activated += (object sender, EventArgs e) => { ProviderRemove(); }; CmdProviderEdit.Activated += (object sender, EventArgs e) => { ProviderEdit(); }; TableProviders.DoubleClick += (object sender, EventArgs e) => { ProviderEdit(); }; TableServers.DoubleClick += (object sender, EventArgs e) => { ConnectManual(); }; CmdServersConnect.Activated += (object sender, EventArgs e) => { ConnectManual(); }; CmdServersWhiteList.Activated += (object sender, EventArgs e) => { ServersWhiteList(); }; CmdServersBlackList.Activated += (object sender, EventArgs e) => { ServersBlackList(); }; CmdServersUndefined.Activated += (object sender, EventArgs e) => { ServersUndefinedList(); }; CmdServersRename.Activated += (object sender, EventArgs e) => { ServersRename(); }; CmdServersMore.Activated += (object sender, EventArgs e) => { ServersMore(); }; CmdServersRefresh.Activated += (object sender, EventArgs e) => { ServersRefresh(); }; MnuServersConnect.Activated += (object sender, EventArgs e) => { ConnectManual(); }; MnuServersWhitelist.Activated += (object sender, EventArgs e) => { ServersWhiteList(); }; MnuServersBlacklist.Activated += (object sender, EventArgs e) => { ServersBlackList(); }; MnuServersUndefined.Activated += (object sender, EventArgs e) => { ServersUndefinedList(); }; MnuServersRename.Activated += (object sender, EventArgs e) => { ServersRename(); }; MnuServersMore.Activated += (object sender, EventArgs e) => { ServersMore(); }; MnuServersRefresh.Activated += (object sender, EventArgs e) => { ServersRefresh(); }; CmdAreasWhiteList.Activated += (object sender, EventArgs e) => { AreasWhiteList(); }; CmdAreasBlackList.Activated += (object sender, EventArgs e) => { AreasBlackList(); }; CmdAreasUndefined.Activated += (object sender, EventArgs e) => { AreasUndefinedList(); }; MnuAreasWhitelist.Activated += (object sender, EventArgs e) => { AreasWhiteList(); }; MnuAreasBlacklist.Activated += (object sender, EventArgs e) => { AreasBlackList(); }; MnuAreasUndefined.Activated += (object sender, EventArgs e) => { AreasUndefinedList(); }; ChkServersShowAll.Activated += (object sender, EventArgs e) => { TableServersController.ShowAll = (ChkServersShowAll.State == NSCellStateValue.On); TableServersController.RefreshUI(); }; /* * Xamarin Bug: https://bugzilla.xamarin.com/show_bug.cgi?id=12467 * Resolved with delegate * * TableServers.SelectionDidChange += (object sender, EventArgs e) => { * EnabledUI(); * }; * * TableAreas.SelectionDidChange += (object sender, EventArgs e) => { * EnabledUI(); * }; */ ChkServersLockCurrent.Activated += (object sender, EventArgs e) => { Engine.Storage.SetBool("servers.locklast", ChkServersLockCurrent.State == NSCellStateValue.On); }; CboServersScoringRule.Activated += (object sender, EventArgs e) => { Engine.Storage.Set("servers.scoretype", GuiUtils.GetSelected(CboServersScoringRule)); RefreshUi(Engine.RefreshUiMode.Full); }; CboSpeedResolutions.Activated += (object sender, EventArgs e) => { (PnlChart as ChartView).Switch((int)CboSpeedResolutions.IndexOfItem(CboSpeedResolutions.SelectedItem)); }; CmdLogsClean.Activated += (object sender, EventArgs e) => { TableLogsController.Clear(); }; CmdLogsSave.Activated += (object sender, EventArgs e) => { LogsDoSave(false); }; CmdLogsCopy.Activated += (object sender, EventArgs e) => { LogsDoCopy(false); }; CmdLogsSupport.Activated += (object sender, EventArgs e) => { SupportReport(); }; MnuLogsCopyAll.Activated += (object sender, EventArgs e) => { LogsDoCopy(false); }; MnuLogsSaveAll.Activated += (object sender, EventArgs e) => { LogsDoSave(false); }; MnuLogsCopySelected.Activated += (object sender, EventArgs e) => { LogsDoCopy(true); }; MnuLogsSaveSelected.Activated += (object sender, EventArgs e) => { LogsDoSave(true); }; CmdLogsCommand.Activated += (object sender, EventArgs e) => { WindowCommandController w = new WindowCommandController(); NSApplication.SharedApplication.RunModalForWindow(w.Window); if (w.Command != "") { UiClient.Instance.Command(w.Command); } }; TableServersController = new TableServersController(this.TableServers); this.TableServers.Delegate = new TableServersDelegate(this); TableAreasController = new TableAreasController(this.TableAreas); this.TableAreas.Delegate = new TableAreasDelegate(this); TableLogsController = new TableLogsController(this.TableLogs); TableStatsController = new TableStatsController(this.TableStats); TableStats.DoubleClick += (object sender, EventArgs e) => { TableStatsController.DoubleClickItem(); }; // Topbar Menu MnuTrayStatus.Activated += (object sender, EventArgs e) => { Restore(sender); }; MnuTrayConnect.Activated += (object sender, EventArgs e) => { if (m_mainActionCommand == "") { Restore(sender); } else { UiClient.Instance.Command(m_mainActionCommand); } }; MnuTrayAbout.Activated += (object sender, EventArgs e) => { ShowAbout(); }; MnuTrayPreferences.Activated += (object sender, EventArgs e) => { ShowPreferences(); }; MnuTrayHome.Activated += (object sender, EventArgs e) => { ShowHome(); }; MnuTrayClientArea.Activated += (object sender, EventArgs e) => { ShowClientArea(); }; MnuTrayForwardingPorts.Activated += (object sender, EventArgs e) => { ShowForwardingPorts(); }; MnuTrayRestore.Activated += (object sender, EventArgs e) => { /* // 2.8 * if(Window.IsVisible) * Minimize(); * else */ if (Window.IsVisible) { Minimize(); } else { Restore(sender); } }; MnuTrayQuit.Activated += (object sender, EventArgs e) => { Shutdown(); }; CboServersScoringRule.ToolTip = LanguageManager.GetText("TooltipServersScoreType"); CmdAreasBlackList.ToolTip = LanguageManager.GetText("TooltipAreasBlackList"); Engine.OnRefreshUi(); SettingsChanged(); RequestAttention(); }
void IInspectorTabModule.Load(IInspectorWindow inspectorWindow, ITabWrapper tab) { this.inspectorWindow = inspectorWindow; var path = Path.GetDirectoryName(GetType().Assembly.Location); configFilePath = Path.Combine(path, "user.cfg"); config = ReadConfig(configFilePath); var toolbarTab = tab.NativeObject as NSTabView; var figmaStackView = NativeViewHelper.CreateVerticalStackView(translatesAutoresizingMaskIntoConstraints: true); var figmaTokenStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true); figmaStackView.AddArrangedSubview(figmaTokenStackView); figmaTokenStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("Your personal access token:", translatesAutoresizingMaskIntoConstraints: true)); tokenTextField = NativeViewHelper.CreateTextEntry(config.Token, translatesAutoresizingMaskIntoConstraints: true); figmaTokenStackView.AddArrangedSubview(tokenTextField); tokenTextField.Activated += DataChanged; var figmaDocumentStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true); figmaStackView.AddArrangedSubview(figmaDocumentStackView); figmaDocumentStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("File:", translatesAutoresizingMaskIntoConstraints: true)); fileTextField = NativeViewHelper.CreateTextEntry(config.File, translatesAutoresizingMaskIntoConstraints: true); fileTextField.Activated += DataChanged; figmaDocumentStackView.AddArrangedSubview(fileTextField); var figmaWindowNameStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true); figmaStackView.AddArrangedSubview(figmaWindowNameStackView); figmaWindowNameStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("Node Name:", translatesAutoresizingMaskIntoConstraints: true)); nodeTextField = NativeViewHelper.CreateTextEntry(config.NodeName, translatesAutoresizingMaskIntoConstraints: true); nodeTextField.Activated += DataChanged; figmaWindowNameStackView.AddArrangedSubview(nodeTextField); var figmaWindowContainerIdStackView = NativeViewHelper.CreateHorizontalStackView(translatesAutoresizingMaskIntoConstraints: true); figmaStackView.AddArrangedSubview(figmaWindowContainerIdStackView); figmaWindowContainerIdStackView.AddArrangedSubview(NativeViewHelper.CreateLabel("View Name:", translatesAutoresizingMaskIntoConstraints: true)); viewTextField = NativeViewHelper.CreateTextEntry(config.ViewName, translatesAutoresizingMaskIntoConstraints: true); viewTextField.Activated += DataChanged; figmaWindowContainerIdStackView.AddArrangedSubview(viewTextField); figmaCompute = new NSButton() { TranslatesAutoresizingMaskIntoConstraints = true }; figmaStackView.AddArrangedSubview(figmaCompute); figmaCompute.Title = "Load in selected view"; //Separator figmaStackView.AddArrangedSubview(new NSView()); ////// var tabFigmaPanel = new NSTabViewItem(); tabFigmaPanel.View = figmaStackView; tabFigmaPanel.Label = "Figma"; toolbarTab.Add(tabFigmaPanel); figmaCompute.Activated += FigmaCompute_Activated; }
public override void AwakeFromNib() { base.AwakeFromNib(); Window.Delegate = new MainWindowDelegate(this); Window.AcceptsMouseMovedEvents = true; TabProviders = TabMain.Items[1]; CreateMenuBarIcon(); ChkRemember.State = Engine.Storage.GetBool("remember") ? NSCellStateValue.On : NSCellStateValue.Off; ChkServersShowAll.State = NSCellStateValue.Off; GuiUtils.SetCheck(ChkServersLockCurrent, Engine.Storage.GetBool("servers.locklast")); GuiUtils.SetSelected(CboServersScoringRule, Engine.Storage.Get("servers.scoretype")); CboSpeedResolutions.RemoveAllItems(); CboSpeedResolutions.AddItem(Messages.WindowsMainSpeedResolution1); CboSpeedResolutions.AddItem(Messages.WindowsMainSpeedResolution2); CboSpeedResolutions.AddItem(Messages.WindowsMainSpeedResolution3); CboSpeedResolutions.AddItem(Messages.WindowsMainSpeedResolution4); CboSpeedResolutions.AddItem(Messages.WindowsMainSpeedResolution5); CboSpeedResolutions.SelectItem(0); CmdConnect.Title = Messages.CommandConnect; LblConnect.StringValue = Messages.CommandConnectSubtitle; CmdDisconnect.Title = Messages.CommandDisconnect; CmdCancel.Title = Messages.CommandCancel; CboServersScoringRule.ToolTip = Messages.TooltipServersScoreType; ChkServersLockCurrent.ToolTip = Messages.TooltipServersLockCurrent; ChkServersShowAll.ToolTip = Messages.TooltipServersShowAll; CmdServersConnect.ToolTip = Messages.TooltipServersConnect; CmdServersUndefined.ToolTip = Messages.TooltipServersUndefined; CmdServersBlackList.ToolTip = Messages.TooltipServersBlackList; CmdServersWhiteList.ToolTip = Messages.TooltipServersWhiteList; CmdServersRename.ToolTip = Messages.TooltipServersRename; CmdServersMore.ToolTip = Messages.TooltipServersMore; CmdServersRefresh.ToolTip = Messages.TooltipServersRefresh; CmdAreasUndefined.ToolTip = Messages.TooltipAreasUndefined; CmdAreasBlackList.ToolTip = Messages.TooltipAreasBlackList; CmdAreasWhiteList.ToolTip = Messages.TooltipAreasWhiteList; CmdLogsOpenVpnManagement.ToolTip = Messages.TooltipLogsOpenVpnManagement; CmdLogsClean.ToolTip = Messages.TooltipLogsClean; CmdLogsCopy.ToolTip = Messages.TooltipLogsCopy; CmdLogsSave.ToolTip = Messages.TooltipLogsSave; CmdLogsSupport.ToolTip = Messages.TooltipLogsSupport; if (Engine.Storage.GetBool("remember")) { ChkRemember.State = NSCellStateValue.On; TxtLogin.StringValue = Engine.Storage.Get("login"); TxtPassword.StringValue = Engine.Storage.Get("password"); } ChkRemember.Activated += (object sender, EventArgs e) => { Engine.Storage.SetBool("remember", ChkRemember.State == NSCellStateValue.On); }; CmdLogin.Activated += (object sender, EventArgs e) => { if (Engine.IsLogged() == false) { Login(); } else { Logout(); } }; TxtLogin.Activated += (object sender, EventArgs e) => { EnabledUI(); }; TxtPassword.Activated += (object sender, EventArgs e) => { EnabledUI(); }; CboKey.Activated += (object sender, EventArgs e) => { Engine.Instance.Storage.Set("key", CboKey.SelectedItem.Title); }; CmdConnect.Activated += (object sender, EventArgs e) => { Connect(); }; CmdDisconnect.Activated += (object sender, EventArgs e) => { Disconnect(); }; CmdCancel.Activated += (object sender, EventArgs e) => { Disconnect(); }; CmdNetworkLock.Activated += (object sender, EventArgs e) => { if (Engine.Instance.NetworkLockManager.IsActive()) { NetworkLockDeactivation(); } else { NetworkLockActivation(); } }; TableProvidersController = new TableProvidersController(this.TableProviders); this.TableProviders.Delegate = new TableProvidersDelegate(this); CmdProviderAdd.Activated += (object sender, EventArgs e) => { ProviderAdd(); }; CmdProviderRemove.Activated += (object sender, EventArgs e) => { ProviderRemove(); }; CmdProviderEdit.Activated += (object sender, EventArgs e) => { ProviderEdit(); }; TableProviders.DoubleClick += (object sender, EventArgs e) => { ProviderEdit(); }; TableServers.DoubleClick += (object sender, EventArgs e) => { ConnectManual(); }; CmdServersConnect.Activated += (object sender, EventArgs e) => { ConnectManual(); }; CmdServersWhiteList.Activated += (object sender, EventArgs e) => { ServersWhiteList(); }; CmdServersBlackList.Activated += (object sender, EventArgs e) => { ServersBlackList(); }; CmdServersUndefined.Activated += (object sender, EventArgs e) => { ServersUndefinedList(); }; CmdServersRename.Activated += (object sender, EventArgs e) => { ServersRename(); }; CmdServersMore.Activated += (object sender, EventArgs e) => { ServersMore(); }; CmdServersRefresh.Activated += (object sender, EventArgs e) => { ServersRefresh(); }; MnuServersConnect.Activated += (object sender, EventArgs e) => { ConnectManual(); }; MnuServersWhitelist.Activated += (object sender, EventArgs e) => { ServersWhiteList(); }; MnuServersBlacklist.Activated += (object sender, EventArgs e) => { ServersBlackList(); }; MnuServersUndefined.Activated += (object sender, EventArgs e) => { ServersUndefinedList(); }; MnuServersRename.Activated += (object sender, EventArgs e) => { ServersRename(); }; MnuServersMore.Activated += (object sender, EventArgs e) => { ServersMore(); }; MnuServersRefresh.Activated += (object sender, EventArgs e) => { ServersRefresh(); }; CmdAreasWhiteList.Activated += (object sender, EventArgs e) => { AreasWhiteList(); }; CmdAreasBlackList.Activated += (object sender, EventArgs e) => { AreasBlackList(); }; CmdAreasUndefined.Activated += (object sender, EventArgs e) => { AreasUndefinedList(); }; MnuAreasWhitelist.Activated += (object sender, EventArgs e) => { AreasWhiteList(); }; MnuAreasBlacklist.Activated += (object sender, EventArgs e) => { AreasBlackList(); }; MnuAreasUndefined.Activated += (object sender, EventArgs e) => { AreasUndefinedList(); }; ChkServersShowAll.Activated += (object sender, EventArgs e) => { TableServersController.ShowAll = (ChkServersShowAll.State == NSCellStateValue.On); TableServersController.RefreshUI(); }; /* * Xamarin Bug: https://bugzilla.xamarin.com/show_bug.cgi?id=12467 * Resolved with delegate * * TableServers.SelectionDidChange += (object sender, EventArgs e) => { * EnabledUI(); * }; * * TableAreas.SelectionDidChange += (object sender, EventArgs e) => { * EnabledUI(); * }; */ ChkServersLockCurrent.Activated += (object sender, EventArgs e) => { Engine.Storage.SetBool("servers.locklast", ChkServersLockCurrent.State == NSCellStateValue.On); }; CboServersScoringRule.Activated += (object sender, EventArgs e) => { Engine.Storage.Set("servers.scoretype", GuiUtils.GetSelected(CboServersScoringRule)); RefreshUi(Engine.RefreshUiMode.Full); }; CboSpeedResolutions.Activated += (object sender, EventArgs e) => { (PnlChart as ChartView).Switch((int)CboSpeedResolutions.IndexOfItem(CboSpeedResolutions.SelectedItem)); }; CmdLogsClean.Activated += (object sender, EventArgs e) => { TableLogsController.Clear(); }; CmdLogsSave.Activated += (object sender, EventArgs e) => { LogsDoSave(false); }; CmdLogsCopy.Activated += (object sender, EventArgs e) => { LogsDoCopy(false); }; CmdLogsSupport.Activated += (object sender, EventArgs e) => { SupportReport(); }; MnuLogsCopyAll.Activated += (object sender, EventArgs e) => { LogsDoCopy(false); }; MnuLogsSaveAll.Activated += (object sender, EventArgs e) => { LogsDoSave(false); }; MnuLogsCopySelected.Activated += (object sender, EventArgs e) => { LogsDoCopy(true); }; MnuLogsSaveSelected.Activated += (object sender, EventArgs e) => { LogsDoSave(true); }; CmdLogsOpenVpnManagement.Activated += (object sender, EventArgs e) => { if (Engine.IsConnected()) { WindowOpenVpnManagementCommandController w = new WindowOpenVpnManagementCommandController(); NSApplication.SharedApplication.RunModalForWindow(w.Window); if (w.Command != "") { Core.UI.Actions.SendOpenVpnManagementCommand(w.Command); } } }; TableServersController = new TableServersController(this.TableServers); this.TableServers.Delegate = new TableServersDelegate(this); TableAreasController = new TableAreasController(this.TableAreas); this.TableAreas.Delegate = new TableAreasDelegate(this); TableLogsController = new TableLogsController(this.TableLogs); TableStatsController = new TableStatsController(this.TableStats); TableStats.DoubleClick += (object sender, EventArgs e) => { TableStatsController.DoubleClickItem(); }; // Topbar Menu MnuTrayStatus.Activated += (object sender, EventArgs e) => { Restore(sender); }; MnuTrayConnect.Activated += (object sender, EventArgs e) => { if (Engine.IsWaiting()) { Disconnect(); } else if (Engine.IsConnected()) { Disconnect(); } else if (Engine.CanConnect()) { Connect(); } else { Restore(sender); } }; MnuTrayAbout.Activated += (object sender, EventArgs e) => { ShowAbout(); }; MnuTrayPreferences.Activated += (object sender, EventArgs e) => { ShowPreferences(); }; MnuTrayHome.Activated += (object sender, EventArgs e) => { ShowHome(); }; MnuTrayClientArea.Activated += (object sender, EventArgs e) => { ShowClientArea(); }; MnuTrayForwardingPorts.Activated += (object sender, EventArgs e) => { ShowForwardingPorts(); }; MnuTraySpeedTest.Activated += (object sender, EventArgs e) => { ShowSpeedTest(); }; MnuTrayRestore.Activated += (object sender, EventArgs e) => { /* // 2.8 * if(Window.IsVisible) * Minimize(); * else */ Restore(sender); }; MnuTrayQuit.Activated += (object sender, EventArgs e) => { Shutdown(); }; CboServersScoringRule.ToolTip = Messages.TooltipServersScoreType; CmdAreasBlackList.ToolTip = Messages.TooltipAreasBlackList; Engine.MainWindow = this; Engine.UiStart(); Engine.OnRefreshUi(); SettingsChanged(); RequestAttention(); }