bool TermsOfServiceCheck(bool force) { bool show = force; if (show == false) { show = (Engine.Storage.GetBool("gui.tos") == false); } if (show) { WindowTosController tos = new WindowTosController(); tos.Window.ReleasedWhenClosed = true; NSApplication.SharedApplication.RunModalForWindow(tos.Window); tos.Window.Close(); if (tos.Accepted) { Engine.Storage.SetBool("gui.tos", true); return(true); } else { return(false); } } else { return(true); } }
public override void AwakeFromNib() { base.AwakeFromNib(); Window.Title = Constants.Name + " - " + Messages.WindowsSettingsTitle; TableRoutes.Delegate = new TableRoutingDelegate(this); TableAdvancedEvents.Delegate = new TableAdvancedEventsDelegate(this); LblLoggingHelp.StringValue = Messages.WindowsSettingsLoggingHelp; TableRoutingController = new TableRoutingController(this.TableRoutes); TableAdvancedEventsController = new TableAdvancedEventsController(this.TableAdvancedEvents); CmdSave.Activated += (object sender, EventArgs e) => { if (Check()) { SaveOptions(); Close(); } }; CmdCancel.Activated += (object sender, EventArgs e) => { Close(); }; CmdGeneralTos.Activated += (object sender, EventArgs e) => { WindowTosController tos = new WindowTosController(); tos.Window.ReleasedWhenClosed = true; NSApplication.SharedApplication.RunModalForWindow(tos.Window); tos.Window.Close(); }; /* * CboGeneralOsxInterfaceStyle.RemoveAllItems (); * CboGeneralOsxInterfaceStyle.AddItem ("Default"); * CboGeneralOsxInterfaceStyle.AddItem ("Dark"); */ // Modes string sshStatus = (Software.SshVersion != "" ? "" : "Not available"); if (sshStatus != "") { m_modeSshEnabled = false; } // TODO: disable ssh & ssl string sslStatus = (Software.SslVersion != "" ? "" : "Not available"); if (sslStatus != "") { m_modeSslEnabled = false; } CmdModeHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsProtocols(); }; ChkModeAutomatic.Activated += (object sender, EventArgs e) => { m_mode_protocol = "AUTO"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 80; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 80; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 53; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 53; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp2018.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp2018.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp443Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 443; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp80Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 80; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp53Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 53; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp2018Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 2018; m_mode_alternate = 1; ChangeMode(); }; ChkModeTcp2018Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 2018; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh22.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 22; m_mode_alternate = 0; ChangeMode(); }; ChkModeSsh22Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 22; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 80; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 53; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsl443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSL"; m_mode_port = 443; m_mode_alternate = 1; ChangeMode(); }; ChkModeTor.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TOR"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; CmdModeTorTest.Activated += (object sender, EventArgs e) => { string result = TorControl.Test(TxtModeTorHost.StringValue, Conversions.ToInt32(TxtModeTorControlPort.StringValue), TxtModeTorControlPassword.StringValue); GuiUtils.MessageBox(result); }; // Proxy CboProxyType.Activated += (object sender, EventArgs e) => { EnableIde(); }; CboProxyAuthentication.Activated += (object sender, EventArgs e) => { EnableIde(); }; // Routes CboRoutesOtherwise.RemoveAllItems(); CboRoutesOtherwise.AddItem(RouteDirectionToDescription("in")); CboRoutesOtherwise.AddItem(RouteDirectionToDescription("out")); CboRoutesOtherwise.Activated += (object sender, EventArgs e) => { EnableIde(); }; TableRoutes.DoubleClick += (object sender, EventArgs e) => { RouteEdit(); }; CmdRouteAdd.Activated += (object sender, EventArgs e) => { RouteAdd(); }; CmdRouteRemove.Activated += (object sender, EventArgs e) => { RouteRemove(); }; CmdRouteEdit.Activated += (object sender, EventArgs e) => { RouteEdit(); }; // Advanced CmdLockHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsLock(); }; CboLockMode.RemoveAllItems(); CboLockMode.AddItem("None"); CboLockMode.AddItem("Automatic"); foreach (NetworkLockPlugin lockPlugin in Engine.Instance.NetworkLockManager.Modes) { CboLockMode.AddItem(lockPlugin.GetName()); } LblRoutesNetworkLockWarning.StringValue = Messages.WindowsSettingsRouteLockHelp; LblLockRoutingOutWarning.StringValue = Messages.NetworkLockNotAvailableWithRouteOut; CboAdvancedManifestRefresh.RemoveAllItems(); CboAdvancedManifestRefresh.AddItem("Automatic"); CboAdvancedManifestRefresh.AddItem("Never"); CboAdvancedManifestRefresh.AddItem("Every minute"); CboAdvancedManifestRefresh.AddItem("Every ten minute"); CboAdvancedManifestRefresh.AddItem("Every one hour"); CmdAdvancedHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsAdvanced(); }; CmdAdvancedOpenVpnPath.Activated += (object sender, EventArgs e) => { GuiUtils.SelectFile(this.Window, TxtAdvancedOpenVpnPath); }; TxtLoggingPath.Changed += (object sender, EventArgs e) => { RefreshLogPreview(); }; TableAdvancedEvents.DoubleClick += (object sender, EventArgs e) => { AdvancedEventEdit(); }; CmdAdvancedEventsEdit.Activated += (object sender, EventArgs e) => { AdvancedEventEdit(); }; CmdAdvancedEventsClear.Activated += (object sender, EventArgs e) => { AdvancedEventClear(); }; ChkAdvancedPingerAlways.Hidden = true; // TOCLEAN ReadOptions(); EnableIde(); RefreshLogPreview(); }
public override void AwakeFromNib() { base.AwakeFromNib (); Window.Title = Constants.Name + " - " + Messages.WindowsSettingsTitle; ChkConnect.Title = Messages.WindowsSettingsConnect; ChkNetLock.Title = Messages.WindowsSettingsNetLock; ChkNetLock.Activated += (object sender, EventArgs e) => { if (GuiUtils.GetCheck (ChkNetLock)) { if ((Engine.Instance as UI.Osx.Engine).MainWindow.NetworkLockKnowledge () == false) GuiUtils.SetCheck (ChkNetLock, false); } }; TableRoutes.Delegate = new TableRoutingDelegate (this); LblDnsServers.StringValue = Messages.WindowsSettingsDnsServers; TableDnsServers.Delegate = new TableDnsServersDelegate (this); TableAdvancedEvents.Delegate = new TableAdvancedEventsDelegate (this); LblLoggingHelp.StringValue = Messages.WindowsSettingsLoggingHelp; TableRoutingController = new TableRoutingController (this.TableRoutes); TableDnsServersController = new TableDnsServersController (this.TableDnsServers); TableAdvancedEventsController = new TableAdvancedEventsController (this.TableAdvancedEvents); CmdSave.Activated += (object sender, EventArgs e) => { if(Check()) { SaveOptions (); Close (); } }; CmdCancel.Activated += (object sender, EventArgs e) => { Close (); }; CmdGeneralTos.Activated += (object sender, EventArgs e) => { WindowTosController tos = new WindowTosController (); tos.Window.ReleasedWhenClosed = true; NSApplication.SharedApplication.RunModalForWindow (tos.Window); tos.Window.Close (); }; // Modes string sshStatus = (Software.SshVersion != "" ? "" : "Not available"); if (sshStatus != "") { m_modeSshEnabled = false; } // TODO: disable ssh & ssl string sslStatus = (Software.SslVersion != "" ? "" : "Not available"); if (sslStatus != "") { m_modeSslEnabled = false; } CmdModeHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsProtocols(); }; ChkModeAutomatic.Activated += (object sender, EventArgs e) => { m_mode_protocol = "AUTO"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 443; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 80; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 80; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 53; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 53; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp2018.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; ChkModeTcp2018.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; ChkModeUdp443Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 443; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp80Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 80; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp53Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 53; m_mode_alternate = 1; ChangeMode(); }; ChkModeUdp2018Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "UDP"; m_mode_port = 2018; m_mode_alternate = 1; ChangeMode(); }; ChkModeTcp2018Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TCP"; m_mode_port = 2018; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh22.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 22; m_mode_alternate = 0; ChangeMode(); }; ChkModeSsh22Alt.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 22; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh80.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 80; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsh53.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSH"; m_mode_port = 53; m_mode_alternate = 1; ChangeMode(); }; ChkModeSsl443.Activated += (object sender, EventArgs e) => { m_mode_protocol = "SSL"; m_mode_port = 443; m_mode_alternate = 1; ChangeMode(); }; ChkModeTor.Activated += (object sender, EventArgs e) => { m_mode_protocol = "TOR"; m_mode_port = 2018; m_mode_alternate = 0; ChangeMode(); }; CmdModeTorTest.Activated += (object sender, EventArgs e) => { string result = TorControl.Test(TxtModeTorHost.StringValue, Conversions.ToInt32(TxtModeTorControlPort.StringValue), TxtModeTorControlPassword.StringValue); GuiUtils.MessageBox(result); }; // Proxy CboProxyType.Activated += (object sender, EventArgs e) => { EnableIde(); }; CboProxyAuthentication.Activated += (object sender, EventArgs e) => { EnableIde(); }; // Routes CboRoutesOtherwise.RemoveAllItems(); CboRoutesOtherwise.AddItem(RouteDirectionToDescription("in")); CboRoutesOtherwise.AddItem(RouteDirectionToDescription("out")); CboRoutesOtherwise.Activated += (object sender, EventArgs e) => { EnableIde (); }; TableRoutes.DoubleClick += (object sender, EventArgs e) => { RouteEdit(); }; CmdRouteAdd.Activated += (object sender, EventArgs e) => { RouteAdd(); }; CmdRouteRemove.Activated += (object sender, EventArgs e) => { RouteRemove(); }; CmdRouteEdit.Activated += (object sender, EventArgs e) => { RouteEdit(); }; // Advanced - General CboIpV6.RemoveAllItems (); CboIpV6.AddItem ("None"); CboIpV6.AddItem ("Disable"); CboAdvancedManifestRefresh.RemoveAllItems (); CboAdvancedManifestRefresh.AddItem ("Automatic"); CboAdvancedManifestRefresh.AddItem ("Never"); CboAdvancedManifestRefresh.AddItem ("Every minute"); CboAdvancedManifestRefresh.AddItem ("Every ten minute"); CboAdvancedManifestRefresh.AddItem ("Every one hour"); LblOpenVpnRcvBuf.StringValue = Messages.WindowsSettingsOpenVpnRcvBuf + ":"; LblOpenVpnSndBuf.StringValue = Messages.WindowsSettingsOpenVpnSndBuf + ":"; CboOpenVpnRcvBuf.RemoveAllItems(); CboOpenVpnRcvBuf.AddItem(Messages.WindowsSettingsOpenVpnDefault); CboOpenVpnRcvBuf.AddItem("8 KB"); CboOpenVpnRcvBuf.AddItem("16 KB"); CboOpenVpnRcvBuf.AddItem("32 KB"); CboOpenVpnRcvBuf.AddItem("64 KB"); CboOpenVpnRcvBuf.AddItem("128 KB"); CboOpenVpnRcvBuf.AddItem("256 KB"); CboOpenVpnRcvBuf.AddItem("512 KB"); CboOpenVpnSndBuf.RemoveAllItems(); CboOpenVpnSndBuf.AddItem(Messages.WindowsSettingsOpenVpnDefault); CboOpenVpnSndBuf.AddItem("8 KB"); CboOpenVpnSndBuf.AddItem("16 KB"); CboOpenVpnSndBuf.AddItem("32 KB"); CboOpenVpnSndBuf.AddItem("64 KB"); CboOpenVpnSndBuf.AddItem("128 KB"); CboOpenVpnSndBuf.AddItem("256 KB"); CboOpenVpnSndBuf.AddItem("512 KB"); CmdAdvancedOpenVpnPath.Activated += (object sender, EventArgs e) => { GuiUtils.SelectFile(this.Window, TxtAdvancedOpenVpnPath); }; CmdAdvancedHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsAdvanced(); }; // Advanced - DNS TableDnsServers.DoubleClick += (object sender, EventArgs e) => { DnsServersEdit(); }; CmdDnsAdd.Activated += (object sender, EventArgs e) => { DnsServersAdd(); }; CmdDnsRemove.Activated += (object sender, EventArgs e) => { DnsServersRemove(); }; CmdDnsEdit.Activated += (object sender, EventArgs e) => { DnsServersEdit(); }; // Advanced - Net Lock CmdLockHelp.Activated += (object sender, EventArgs e) => { Core.UI.Actions.OpenUrlDocsLock(); }; CboLockMode.RemoveAllItems (); CboLockMode.AddItem ("None"); CboLockMode.AddItem ("Automatic"); foreach (NetworkLockPlugin lockPlugin in Engine.Instance.NetworkLockManager.Modes) { CboLockMode.AddItem (lockPlugin.GetName ()); } LblRoutesNetworkLockWarning.StringValue = Messages.WindowsSettingsRouteLockHelp; LblLockRoutingOutWarning.StringValue = Messages.NetworkLockNotAvailableWithRouteOut; // Advanced - Logging TxtLoggingPath.Changed += (object sender, EventArgs e) => { RefreshLogPreview(); }; // Advanced - Events TableAdvancedEvents.DoubleClick += (object sender, EventArgs e) => { AdvancedEventEdit(); }; CmdAdvancedEventsEdit.Activated += (object sender, EventArgs e) => { AdvancedEventEdit(); }; CmdAdvancedEventsClear.Activated += (object sender, EventArgs e) => { AdvancedEventClear(); }; ReadOptions (); EnableIde (); RefreshLogPreview (); }
bool TermsOfServiceCheck(bool force) { bool show = force; if(show == false) show = (Engine.Storage.GetBool ("gui.tos") == false); if (show) { WindowTosController tos = new WindowTosController (); tos.Window.ReleasedWhenClosed = true; NSApplication.SharedApplication.RunModalForWindow (tos.Window); tos.Window.Close (); if (tos.Accepted) { Engine.Storage.SetBool ("gui.tos", true); return true; } else { return false; } } else { return true; } }