Example #1
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsConnectionRenameTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            TxtBody.StringValue = Body;

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Body = TxtBody.StringValue;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Body = "";

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsCommandTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Command = TxtCommand.StringValue;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Command = "";

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            LnkHelp.Activated += (object sender, EventArgs e) =>
            {
                GuiUtils.OpenUrl(UiClient.Instance.Data["links"]["help"]["openvpn-management"].Value as string);
            };
        }
Example #3
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsProviderNoBootstrapTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            GuiUtils.SetCheck(ChkDontShowAgain, false);
            LblBody.StringValue       = LanguageManager.GetText("WindowsProviderNoBootstrapBody", Provider.Title);
            TxtManualUrls.StringValue = Engine.Instance.Storage.Get("bootstrap.urls");

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Engine.Instance.Storage.SetBool("ui.skip.provider.manifest.failed", GuiUtils.GetCheck(ChkDontShowAgain));
                Engine.Instance.Storage.Set("bootstrap.urls", TxtManualUrls.StringValue);
                Engine.Instance.RefreshProvidersInvalidateConnections();

                Window.Close();
                NSApplication.SharedApplication.StopModal();
                Singleton = null;
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Engine.Instance.Storage.SetBool("ui.skip.provider.manifest.failed", GuiUtils.GetCheck(ChkDontShowAgain));

                Window.Close();
                NSApplication.SharedApplication.StopModal();
                Singleton = null;
            };
        }
Example #4
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsProviderEditOpenVPNTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            LblTitle.Title          = Provider.DefinitionTitle;
            LblSubtitle.StringValue = Provider.DefinitionSubTitle;

            GuiUtils.SetCheck(ChkEnabled, Provider.Enabled);
            TxtTitle.StringValue = Provider.Title;
            TxtPath.StringValue  = Provider.Path;

            ChkSupportIPv6.Title = LanguageManager.GetText("WindowsProviderEditOpenVPNSupportIPv6");
            GuiUtils.SetCheck(ChkSupportIPv6, Provider.SupportIPv6);

            TxtAuthPassUsername.StringValue = Provider.AuthPassUsername;
            TxtAuthPassPassword.StringValue = Provider.AuthPassPassword;

            LblTitle.Activated += (object sender, EventArgs e) =>
            {
                Core.Platform.Instance.OpenUrl(Provider.DefinitionHref);
            };

            CmdPathBrowse.Activated += (object sender, EventArgs e) =>
            {
                GuiUtils.SelectPath(this.Window, TxtPath);
            };

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Provider.Enabled     = GuiUtils.GetCheck(ChkEnabled);
                Provider.Title       = TxtTitle.StringValue;
                Provider.Path        = TxtPath.StringValue;
                Provider.SupportIPv6 = GuiUtils.GetCheck(ChkSupportIPv6);

                Provider.AuthPassUsername = TxtAuthPassUsername.StringValue;
                Provider.AuthPassPassword = TxtAuthPassPassword.StringValue;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Provider = null;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsSettingsRouteTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            LblHelp.StringValue = LanguageManager.GetText("WindowsSettingsRouteTitle");


            CboAction.RemoveAllItems();
            CboAction.AddItem(WindowPreferencesController.RouteDirectionToDescription("none"));
            CboAction.AddItem(WindowPreferencesController.RouteDirectionToDescription("in"));
            CboAction.AddItem(WindowPreferencesController.RouteDirectionToDescription("out"));

            TxtIP.Changed += (object sender, EventArgs e) =>
            {
                EnableIde();
            };
            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Accepted    = true;
                Item.Ip     = TxtIP.StringValue;
                Item.Action = WindowPreferencesController.RouteDescriptionToDirection(GuiUtils.GetSelected(CboAction));
                Item.Icon   = Item.Action;
                Item.Notes  = TxtNotes.StringValue;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Accepted = false;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            TxtIP.StringValue = Item.Ip;
            GuiUtils.SetSelected(CboAction, WindowPreferencesController.RouteDirectionToDescription(Item.Action));
            TxtNotes.StringValue = Item.Notes;

            EnableIde();
        }
Example #6
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsReportTitle");

            GuiUtils.SetButtonCancel(Window, CmdClose);
            GuiUtils.SetButtonDefault(Window, CmdSave);

            CmdClose.Activated += (object sender, EventArgs e) =>
            {
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCopyClipboard.Activated += (object sender, EventArgs e) =>
            {
                string t = TxtBody.Value;

                string[] pboardTypes = new string[] { "NSStringPboardType" };
                NSPasteboard.GeneralPasteboard.DeclareTypes(pboardTypes, null);
                NSPasteboard.GeneralPasteboard.SetStringForType(t, pboardTypes[0]);
                GuiUtils.MessageBoxInfo(LanguageManager.GetText("LogsCopyClipboardDone"));
            };

            CmdSave.Activated += (object sender, EventArgs e) =>
            {
                string t = TxtBody.Value;

                NSSavePanel panel = new NSSavePanel();
                panel.CanCreateDirectories = true;
                nint result = panel.RunModal();
                if (result == 1)
                {
                    Core.Platform.Instance.FileContentsWriteText(panel.Url.Path, t, System.Text.Encoding.UTF8);

                    GuiUtils.MessageBoxInfo(LanguageManager.GetText("LogsSaveToFileDone"));
                }
            };

            CmdCopyClipboard.ToolTip = LanguageManager.GetText("TooltipLogsCopy");
            CmdSave.ToolTip          = LanguageManager.GetText("TooltipLogsSave");
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsUnlockTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            if (AuthFailed)
            {
                LblMessage.StringValue = LanguageManager.GetText("WindowsUnlockFailedAuth");
                LblMessage.TextColor   = NSColor.Red;
            }
            else
            {
                LblMessage.StringValue = LanguageManager.GetText("WindowsUnlockFirstAuth");
            }

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Body = "";
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Body = TxtPassword.StringValue;
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            TxtPassword.Changed += (object sender, EventArgs e) =>
            {
                EnableIde();
            };

            EnableIde();
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsProviderAddTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            XmlElement xmlData = Engine.Instance.ProvidersManager.GetDataAddProviders();

            CboProvider.RemoveAllItems();
            foreach (XmlElement xmlProvider in xmlData.ChildNodes)
            {
                string code = xmlProvider.GetAttributeString("code", "");
                string t    = xmlProvider.GetAttributeString("title", "");
                t += " - " + xmlProvider.GetAttributeString("subtitle", "");
                t += " - " + xmlProvider.GetAttributeString("href", "");
                CboProvider.AddItem(t);
                m_choices.Add(code);
            }

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Provider = m_choices[(int)CboProvider.IndexOfSelectedItem];

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Provider = "";

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            EnableIde();
        }
Example #9
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Accepted = false;

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsTosTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdAccept);

            // TOCLEAN

            /*
             * TxtTos.Value = Core.UI.App.GetTos();
             */
            ChkTos1.Title         = LanguageManager.GetText("WindowsTosCheck1");
            ChkTos2.Title         = LanguageManager.GetText("WindowsTosCheck2");
            CmdAccept.Title       = LanguageManager.GetText("WindowsTosAccept");
            CmdCancel.StringValue = LanguageManager.GetText("WindowsTosReject");

            bool tosAccepted = Engine.Instance.Storage.GetBool("gui.tos");

            ChkTos1.State = (tosAccepted ? NSCellStateValue.On : NSCellStateValue.Off);
            ChkTos2.State = (tosAccepted ? NSCellStateValue.On : NSCellStateValue.Off);

            CmdAccept.Activated += (object sender, EventArgs e) =>
            {
                Accepted = true;
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsSettingsEventTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdSave);

            TxtFilename.StringValue  = Item.Filename;
            TxtArguments.StringValue = Item.Arguments;
            GuiUtils.SetCheck(ChkWaitEnd, Item.WaitEnd);

            CmdSave.Activated += (object sender, EventArgs e) =>
            {
                Accepted = true;

                Item.Filename  = TxtFilename.StringValue;
                Item.Arguments = TxtArguments.StringValue;
                Item.WaitEnd   = GuiUtils.GetCheck(ChkWaitEnd);

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Accepted = false;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdBrowse.Activated += (object sender, EventArgs e) =>
            {
                GuiUtils.SelectFile(this.Window, TxtFilename);
            };
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsConnectionTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdOk);

            m_connectionActive = Connection.BuildConnectionActive(true);

            TxtOvpnGenerated.Value = Core.Platform.Instance.NormalizeString(m_connectionActive.OpenVpnProfileStartup.Get());
            if (Connection.Path != "")
            {
                if (Core.Platform.Instance.FileExists(Connection.Path))
                {
                    string original = Core.Platform.Instance.FileContentsReadText(Connection.Path);
                    TxtOvpnOriginal.Value = original;
                }
            }
            else
            {
                TabMain.Remove(TabMain.Items[1]);
            }

            CmdOk.Activated += (object sender, EventArgs e) =>
            {
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Title = Constants.Name + " - " + LanguageManager.GetText("WindowsLoginTitle");

            GuiUtils.SetButtonCancel(Window, CmdCancel);
            GuiUtils.SetButtonDefault(Window, CmdLogin);

            CboRemember.RemoveAllItems();
            CboRemember.AddItem(LanguageManager.GetText("WindowsCredentialsRememberNo"));
            CboRemember.AddItem(LanguageManager.GetText("WindowsCredentialsRememberRun"));
            CboRemember.AddItem(LanguageManager.GetText("WindowsCredentialsRememberPermanent"));
            GuiUtils.SetSelected(CboRemember, LanguageManager.GetText("WindowsCredentialsRememberRun"));

            TxtUsername.Changed += (object sender, EventArgs e) =>
            {
                EnableIde();
            };
            TxtPassword.Changed += (object sender, EventArgs e) =>
            {
                EnableIde();
            };

            CmdLogin.Activated += (object sender, EventArgs e) =>
            {
                Credentials          = new Credentials();
                Credentials.UserName = TxtUsername.StringValue;
                Credentials.Password = TxtPassword.StringValue;
                string rememberText = GuiUtils.GetSelected(CboRemember);
                if (rememberText == LanguageManager.GetText("WindowsCredentialsRememberNo"))
                {
                    Credentials.Remember = "no";
                }
                else if (rememberText == LanguageManager.GetText("WindowsCredentialsRememberRun"))
                {
                    Credentials.Remember = "run";
                }
                else if (rememberText == LanguageManager.GetText("WindowsCredentialsRememberPermanent"))
                {
                    Credentials.Remember = "permanent";
                }
                else
                {
                    Credentials.Remember = "no";
                }

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            CmdCancel.Activated += (object sender, EventArgs e) =>
            {
                Credentials = null;

                Window.Close();
                NSApplication.SharedApplication.StopModal();
            };

            EnableIde();
        }