Inheritance: Xwt.Widget
Example #1
0
        public LoginView(LauncherWindow window)
        {
            Window = window;
            this.MinWidth = 250;

            ErrorLabel = new Label("Username or password incorrect")
            {
                TextColor = Color.FromBytes(255, 0, 0),
                TextAlignment = Alignment.Center,
                Visible = false
            };
            UsernameText = new TextEntry();
            PasswordText = new PasswordEntry();
            LogInButton = new Button("Log In");
            RegisterButton = new Button("Register");
            RememberCheckBox = new CheckBox("Remember Me");
            UsernameText.Text = UserSettings.Local.Username;
            if (UserSettings.Local.AutoLogin)
            {
                PasswordText.Password = UserSettings.Local.Password;
                RememberCheckBox.Active = true;
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft-logo.png"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream));

            UsernameText.PlaceholderText = "Username";
            PasswordText.PlaceholderText = "Password";
            PasswordText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            UsernameText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                    LogInButton_Clicked(sender, e);
            };
            RegisterButton.Clicked += (sender, e) =>
            {
                if (RegisterButton.Label == "Register")
                    Window.WebView.Url = "http://truecraft.io/register";
                else
                {
                    Window.User.Username = UsernameText.Text;
                    Window.User.SessionId = "-";
                    Window.MainContainer.Remove(this);
                    Window.MainContainer.PackEnd(Window.MainMenuView = new MainMenuView(Window));
                }
            };
            LogInButton.Clicked += LogInButton_Clicked;

            this.PackStart(TrueCraftLogoImage);
            this.PackEnd(RegisterButton);
            this.PackEnd(LogInButton);
            this.PackEnd(RememberCheckBox);
            this.PackEnd(PasswordText);
            this.PackEnd(UsernameText);
            this.PackEnd(ErrorLabel);
        }
Example #2
0
        public override Xwt.Widget Makeup(IXwtWrapper Parent)
        {
            Xwt.PasswordEntry Target = new Xwt.PasswordEntry()
            {
                PlaceholderText = this.PlaceholderText
            };

            //Binding
            if (Source != "")
            {
                Target.Password = (string)PathBind.GetValue(Source, Parent, "");
                Parent.PropertyChanged += (o, e) =>
                {
                    if (e.PropertyName == this.Source.Split('.')[0])
                        Xwt.Application.Invoke(() => Target.Password = (string)PathBind.GetValue(Source, Parent, ""));
                };
                Target.Changed += (o, e) =>
                {
                    PathBind.SetValue(Source, Parent, Target.Password);
                };
            }

            WindowController.TryAttachEvent(Target, "Changed", Parent, Changed);
            WindowController.TryAttachEvent(Target, "Activated", Parent, Activated);
            InitWidget(Target, Parent);
            return Target;
        }
Example #3
0
		public PasswordEntries ()
		{
			PasswordEntry te1 = new PasswordEntry ();
			PackStart (te1);
			Button b = new Button ("Show password");
			Label l = new Label ();
			b.Clicked += (sender, e) => {
				l.Text = ("Password is: " + te1.Password);
			};
			PackStart (b);
			PackStart (l);
		}
Example #4
0
        public Login()
        {
            var table = new Table ();
            var image = new ImageView {
                Image = Icons.UserInfo.WithBoxSize (96),
            };
            userEntry = new TextEntry {
                PlaceholderText = Catalog.GetString ("User"),
            };
            passwordEntry = new PasswordEntry {
                PlaceholderText = Catalog.GetString ("Password"),
            };
            var userLabel = new Label {
                Text = Catalog.GetString ("User"),
                TextAlignment = Alignment.Center,
            };
            var passwordLabel = new Label {
                Text = Catalog.GetString ("Password"),
                TextAlignment = Alignment.Center,
            };
            info = new Label {
                TextAlignment = Alignment.Center,
                TextColor = new Color (1, 0, 0),
                Visible = false,
            };
            userEntry.Activated += delegate {
                passwordEntry.SetFocus ();
            };
            passwordEntry.Activated += OnAutenticate;

            table.Add (image, 0, 0, 4);
            table.Add (userLabel, 1, 0);
            table.Add (userEntry, 1, 1);
            table.Add (passwordLabel, 1, 2);
            table.Add (passwordEntry, 1, 3);
            table.Add (info, 0, 4, colspan: 2);

            Content = table;

            userEntry.SetFocus ();
            Resizable = false;
            ShowInTaskbar = false;
            Title = Catalog.GetString ("Login");
            Icon = Image.FromResource (GetType (), Resources.Icon);
        }
        public CompilanceTestDialog()
        {
            backgroundWorker = new BackgroundWorker ();
            backgroundWorker.WorkerReportsProgress = false;
            backgroundWorker.WorkerSupportsCancellation = true;
            backgroundWorker.DoWork += BackgroundWorker_DoWork;
            backgroundWorker.RunWorkerCompleted += BackgroundWorker_RunWorkerCompleted;

            Icon = Image.FromResource ("UbntTools.Resources.icon-64x64.png");
            Title = string.Empty;
            Table table = new Table ();

            EntryIp = new TextEntry { Text = "192.168.1.20" };
            EntryPasswd = new PasswordEntry { TooltipText = "Device Password" };
            EntryUser = new TextEntry { Text = "ubnt" };

            table.Add (new Label ("Ip Address:: ") { TextAlignment = Alignment.End }, 0, 0);
            table.Add (EntryIp, 1, 0);
            table.Add (new Label ("User: "******"Password: "******"_Connect");
            table.Add (BtnConnect, 2, 0);

            BtnClose = new Button ("_Salir");
            table.Add (BtnClose, 2, 1);

            BtnConnect.Clicked += (sender, e) => {
                this.Content.Sensitive = false;
                this.BtnClose.Sensitive = false;
                this.BtnConnect.Sensitive = false;
                _ip = this.EntryIp.Text;
                _user = this.EntryUser.Text;
                _pwd = this.EntryPasswd.Password;

                if (!backgroundWorker.IsBusy)
                    backgroundWorker.RunWorkerAsync ();
            };

            BtnClose.Clicked += (sender, e) => { Respond (Command.Close);};

            Content = table;
        }
Example #6
0
        /// <summary>
        /// Initialize window.
        /// </summary>
        public override void _initializeComponents()
        {
            // Server Name + URL + Periodicity window
            Frame f = new Frame();
            f.Label = Director.Properties.Resources.ServerSettings;
            f.Padding = 10;

            // Create VBOX
            VBox ServerSettings = new VBox();

            // Prepare text box
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerName
            });
            ServerName = new TextEntry();
            ServerName.Changed += ServerName_Changed;
            ServerSettings.PackStart(ServerName);

            // Add invalid server name
            ServerSettings.PackStart(InvalidServerName);

            // Server URL
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerURL
            });
            ServerURL = new TextEntry();
            ServerURL.Changed += ServerURL_Changed;
            ServerSettings.PackStart(ServerURL);

            // Invalid URL
            ServerSettings.PackStart(InvalidServerURL);

            // Frequency settings
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.RunningPeriodicity
            });
            FrequencyRunning = new ComboBox();
            FrequencyHelper.FillComboBox(FrequencyRunning);
            ServerSettings.PackStart(FrequencyRunning);
            FrequencyRunning.SelectedIndex = 0;
            FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged;

            // Add Frame to server settings
            f.Content = ServerSettings;
            PackStart(f);

            // Authorization
            AuthRequired = new CheckBox(Director.Properties.Resources.Authorization);
            AuthRequired.MarginLeft = 10;
            PackStart(AuthRequired);

            // Create Authentication Frame
            Authentication = new Frame()
            {
                Label = Director.Properties.Resources.AuthorizationSettings,
                Padding = 10
            };

            // Login and Password fields
            VBox AuthBox = new VBox();

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Username
            });
            AuthUserName = new TextEntry();
            AuthUserName.Changed += AuthUserName_Changed;
            AuthBox.PackStart(AuthUserName);

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Password
            });
            AuthUserPassword = new PasswordEntry();
            AuthUserPassword.Changed += AuthUserPassword_Changed;
            AuthBox.PackStart(AuthUserPassword);

            // Authentication content
            Authentication.Content = AuthBox;
            PackStart(Authentication);

            // Change value
            AuthRequired.Toggled += AuthRequired_Toggled;

            // Email settings
            Frame EmailFrame = new Frame()
            {
                Label = Director.Properties.Resources.EmailNotifications,
                Padding = 10,
                MinHeight = 180
            };

            // Create EmailList widget
            EmailWidget = new EmailList();
            EmailFrame.Content = EmailWidget;
            PackStart(EmailFrame, expand: true, fill: true);
        }
		void Build ()
		{
			Width = 400;
			Title = GettextCatalog.GetString ("Add Package Source");
			int labelWidth = 80;

			var mainVBox = new VBox ();
			Content = mainVBox;

			// Package source name.
			var packageSourceNameHBox = new HBox ();
			mainVBox.PackStart (packageSourceNameHBox);

			var packageSourceNameLabel = new Label ();
			packageSourceNameLabel.Text = GettextCatalog.GetString ("Name");
			packageSourceNameLabel.TextAlignment = Alignment.End;
			packageSourceNameLabel.WidthRequest = labelWidth;
			packageSourceNameHBox.PackStart (packageSourceNameLabel);

			packageSourceNameTextEntry = new TextEntry ();
			packageSourceNameHBox.PackEnd (packageSourceNameTextEntry, true);

			// Package source URL.
			var packageSourceUrlHBox = new HBox ();
			mainVBox.PackStart (packageSourceUrlHBox);

			var packageSourceUrlLabel = new Label ();
			packageSourceUrlLabel.Text = GettextCatalog.GetString ("URL");
			packageSourceUrlLabel.TextAlignment = Alignment.End;
			packageSourceUrlLabel.WidthRequest = labelWidth;
			packageSourceUrlHBox.PackStart (packageSourceUrlLabel);

			packageSourceUrlTextEntry = new TextEntry ();
			packageSourceUrlHBox.PackEnd (packageSourceUrlTextEntry, true);

			// Package source username.
			var packageSourceUserNameHBox = new HBox ();
			mainVBox.PackStart (packageSourceUserNameHBox);

			var packageSourceUserNameLabel = new Label ();
			packageSourceUserNameLabel.Text = GettextCatalog.GetString ("Username");
			packageSourceUserNameLabel.TextAlignment = Alignment.End;
			packageSourceUserNameLabel.WidthRequest = labelWidth;
			packageSourceUserNameHBox.PackStart (packageSourceUserNameLabel);

			packageSourceUserNameTextEntry = new TextEntry ();
			packageSourceUserNameTextEntry.PlaceholderText = GettextCatalog.GetString ("Private sources only");
			packageSourceUserNameHBox.PackEnd (packageSourceUserNameTextEntry, true);

			// Package source password.
			var packageSourcePasswordHBox = new HBox ();
			mainVBox.PackStart (packageSourcePasswordHBox);

			var packageSourcePasswordLabel = new Label ();
			packageSourcePasswordLabel.Text = GettextCatalog.GetString ("Password");
			packageSourcePasswordLabel.TextAlignment = Alignment.End;
			packageSourcePasswordLabel.WidthRequest = labelWidth;
			packageSourcePasswordHBox.PackStart (packageSourcePasswordLabel);

			packageSourcePasswordTextEntry = new PasswordEntry ();
			packageSourcePasswordTextEntry.PlaceholderText = GettextCatalog.GetString ("Private sources only");
			packageSourcePasswordHBox.PackEnd (packageSourcePasswordTextEntry, true);

			// Buttons at bottom of dialog.
			var cancelButton = new DialogButton (Command.Cancel);
			Buttons.Add (cancelButton);

			addPackageSourceButton = new DialogButton (Command.Ok);
			addPackageSourceButton.Label = GettextCatalog.GetString ("Add Source");
			addPackageSourceButton.Sensitive = false;
			Buttons.Add (addPackageSourceButton);

			savePackageSourceButton = new DialogButton (Command.Apply);
			savePackageSourceButton.Label = GettextCatalog.GetString ("Save");
			savePackageSourceButton.Visible = false;
			Buttons.Add (savePackageSourceButton);
		}