private void RecreateNetworkActionsButtonItems() { NSMenuItem menuUntrusted = new NSMenuItem("", NetworkActionButton_Changed) { AttributedTitle = AttributedString.Create(GetActionName(WiFiActionTypeEnum.Untrusted), NSColor.SystemRedColor, NSTextAlignment.Center), Tag = (int)WiFiActionTypeEnum.Untrusted }; NSMenuItem menuTrusted = new NSMenuItem("", NetworkActionButton_Changed) { AttributedTitle = AttributedString.Create(GetActionName(WiFiActionTypeEnum.Trusted), NSColor.SystemBlueColor, NSTextAlignment.Center), Tag = (int)WiFiActionTypeEnum.Trusted }; NSMenuItem menuNoAction = new NSMenuItem("", NetworkActionButton_Changed) { AttributedTitle = AttributedString.Create(GetActionName(WiFiActionTypeEnum.None), NSColor.Black, NSTextAlignment.Center), Tag = (int)WiFiActionTypeEnum.None }; NSMenuItem menuDefaultAction = new NSMenuItem("", NetworkActionButton_Changed) { AttributedTitle = (__MainViewModel.WiFiActionType == WiFiActionTypeEnum.Default && __MainViewModel.Settings.NetworkActions.DefaultActionType == WiFiActionTypeEnum.None) ? AttributedString.Create(LocalizedStrings.Instance.LocalizedString("NetworkConfig_ActionNotSet"), NSColor.SystemGrayColor, NSTextAlignment.Center) : AttributedString.Create(GetActionName(WiFiActionTypeEnum.Default) + ": " + GetActionName(__MainViewModel.Settings.NetworkActions.DefaultActionType), NSColor.SystemGrayColor, NSTextAlignment.Center), Tag = (int)WiFiActionTypeEnum.Default }; GuiNetworkActionPopUpBtn.Menu.RemoveAllItems(); GuiNetworkActionPopUpBtn.Menu.AddItem(menuUntrusted); GuiNetworkActionPopUpBtn.Menu.AddItem(menuTrusted); //GuiNetworkActionPopUpBtn.Menu.AddItem(menuNoAction); // 'No action' available only for 'Default' action GuiNetworkActionPopUpBtn.Menu.AddItem(menuDefaultAction); GuiNetworkActionPopUpBtn.SelectItemWithTag((int)__MainViewModel.WiFiActionType); if (GuiNetworkActionPopUpBtn.Menu.Delegate == null) { GuiNetworkActionPopUpBtn.Menu.Delegate = new MenuDelegateInvertHighlitedItem(); } }
void GuiWiFiButton_Activated(object sender, EventArgs e) { GuiNetworkActionPopUpBtn.PerformClick(this); }
void ReleaseDesignerOutlets() { if (GuiConnectButtonImage != null) { GuiConnectButtonImage.Dispose(); GuiConnectButtonImage = null; } if (GuiConnectButtonText != null) { GuiConnectButtonText.Dispose(); GuiConnectButtonText = null; } if (GuiGeoLookupCityView != null) { GuiGeoLookupCityView.Dispose(); GuiGeoLookupCityView = null; } if (GuiGeoLookupDurationView != null) { GuiGeoLookupDurationView.Dispose(); GuiGeoLookupDurationView = null; } if (GuiGeoLookupErrorView != null) { GuiGeoLookupErrorView.Dispose(); GuiGeoLookupErrorView = null; } if (GuiGeoLookupPublicIpView != null) { GuiGeoLookupPublicIpView.Dispose(); GuiGeoLookupPublicIpView = null; } if (GuiGeoLookupUpdateView != null) { GuiGeoLookupUpdateView.Dispose(); GuiGeoLookupUpdateView = null; } if (GuiGeoLookupView != null) { GuiGeoLookupView.Dispose(); GuiGeoLookupView = null; } if (GuiInformationButton != null) { GuiInformationButton.Dispose(); GuiInformationButton = null; } if (GuiLabelToDoDescription != null) { GuiLabelToDoDescription.Dispose(); GuiLabelToDoDescription = null; } if (GuiNetworkActionPopUpBtn != null) { GuiNetworkActionPopUpBtn.Dispose(); GuiNetworkActionPopUpBtn = null; } if (GuiNotificationButtonBottom != null) { GuiNotificationButtonBottom.Dispose(); GuiNotificationButtonBottom = null; } if (GuiPauseButton != null) { GuiPauseButton.Dispose(); GuiPauseButton = null; } if (GuiPauseDlgCancelBtn != null) { GuiPauseDlgCancelBtn.Dispose(); GuiPauseDlgCancelBtn = null; } if (GuiPauseDlgHoursTextBlock != null) { GuiPauseDlgHoursTextBlock.Dispose(); GuiPauseDlgHoursTextBlock = null; } if (GuiPauseDlgMinutesTextBlock != null) { GuiPauseDlgMinutesTextBlock.Dispose(); GuiPauseDlgMinutesTextBlock = null; } if (GuiPauseDlgOkBtn != null) { GuiPauseDlgOkBtn.Dispose(); GuiPauseDlgOkBtn = null; } if (GuiPauseLeftTimeText != null) { GuiPauseLeftTimeText.Dispose(); GuiPauseLeftTimeText = null; } if (GuiPausePopoverView != null) { GuiPausePopoverView.Dispose(); GuiPausePopoverView = null; } if (GuiPopoverConstLabelClientIP != null) { GuiPopoverConstLabelClientIP.Dispose(); GuiPopoverConstLabelClientIP = null; } if (GuiPopoverConstLabelDuration != null) { GuiPopoverConstLabelDuration.Dispose(); GuiPopoverConstLabelDuration = null; } if (GuiPopoverConstLabelServerIP != null) { GuiPopoverConstLabelServerIP.Dispose(); GuiPopoverConstLabelServerIP = null; } if (GuiPopoverLabelClientIP != null) { GuiPopoverLabelClientIP.Dispose(); GuiPopoverLabelClientIP = null; } if (GuiPopoverLabelDuration != null) { GuiPopoverLabelDuration.Dispose(); GuiPopoverLabelDuration = null; } if (GuiPopoverLabelServerIP != null) { GuiPopoverLabelServerIP.Dispose(); GuiPopoverLabelServerIP = null; } if (GuiPopoverView != null) { GuiPopoverView.Dispose(); GuiPopoverView = null; } if (GuiSetPauseIntervalWindow != null) { GuiSetPauseIntervalWindow.Dispose(); GuiSetPauseIntervalWindow = null; } if (GuiWiFiButton != null) { GuiWiFiButton.Dispose(); GuiWiFiButton = null; } }