Esempio n. 1
0
        public DialogBox(String title, String texto)
        {
            this.nameEntryLabel = new LabelControl();
            this.okButton       = new ButtonControl();

            //
            // nameEntryLabel
            //
            this.nameEntryLabel.Text   = texto;
            this.nameEntryLabel.Bounds = new UniRectangle(10.0f, 30.0f, 110.0f, 24.0f);

            //
            // okButton
            //
            this.okButton.Bounds   = new UniRectangle(10.0f, 50.0f, 50.0f, 24.0f);
            this.okButton.Text     = "OK";
            this.okButton.Pressed += new EventHandler(okClicked);

            //
            // DialogBox
            //
            this.Bounds = new UniRectangle(200.0f, 200.0f, .0f, 384.0f);
            this.Title  = title;
            Children.Add(this.nameEntryLabel);
            Children.Add(this.okButton);
        }
Esempio n. 2
0
        private void IngresoNuevoUsuario(Screen mainScreen)
        {
            LabelControl  nameEntryLabel = new Nuclex.UserInterface.Controls.LabelControl();
            InputControl  nameEntryBox   = new Nuclex.UserInterface.Controls.Desktop.InputControl();
            ButtonControl okButton       = new Nuclex.UserInterface.Controls.Desktop.ButtonControl();
            WindowControl w = new WindowControl();

            //
            // nameEntryLabel
            //
            nameEntryLabel.Text   = "Por favor elija su nombre";
            nameEntryLabel.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 75, 200, 150, 50
                );
            mainScreen.Desktop.Children.Add(nameEntryLabel);

            //
            // nameEntryBox
            //
            nameEntryBox.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 150, 280, 300, 30
                );
            mainScreen.Desktop.Children.Add(nameEntryBox);

            //
            //okButton
            //
            okButton.Text   = "Guardar";
            okButton.Bounds = new UniRectangle(
                graphics.PreferredBackBufferWidth / 2 - 100, 360, 200, 30
                );

            mainScreen.Desktop.Children.Add(okButton);
            okButton.Pressed += delegate(object sender, EventArgs arguments)
            {
                if ((JugadorExistenteEnArchivo(nameEntryBox.Text)) || (nameEntryBox.Text.Trim() == ""))
                {
                    okButton.Enabled = false;

                    WindowControl window = new WindowControl();
                    window.Title = "Error";

                    LabelControl labelExiste = new LabelControl("El jugador ingresado ya existe o es invalido");
                    labelExiste.Bounds = new UniRectangle(10.0f, 30.0f, 120.0f, 15.0f);

                    ButtonControl aceptarButton = new ButtonControl();
                    aceptarButton.Text   = "Aceptar";
                    aceptarButton.Bounds = new UniRectangle(110, 60, 80, 30);

                    window.Bounds = new UniRectangle(graphics.PreferredBackBufferWidth / 2 - 150, 450, 300, 100);
                    window.Children.Add(labelExiste);
                    window.Children.Add(aceptarButton);

                    mainScreen.Desktop.Children.Add(window);

                    aceptarButton.Pressed += delegate(object senderWindow, EventArgs argumentsWindow)
                    {
                        okButton.Enabled = true;
                        window.Close();
                    };
                }
                else
                {
                    nombre = nameEntryBox.Text;
                    StreamWriter sw = new StreamWriter("Jugadores.txt", true);

                    sw.WriteLine(nameEntryBox.Text.Trim());

                    sw.Close();

                    mainScreen.Desktop.Children.Clear();
                    menuUsuarioNuevo = false;
                    menuGeneral      = true;
                }
            };
        }
        public void TestFullConstructor()
        {
            LabelControl label = new LabelControl("Hello World");

            Assert.AreEqual("Hello World", label.Text);
        }
        public void TestDefaultConstructor()
        {
            LabelControl label = new LabelControl();

            Assert.IsNotNull(label); // nonsense; avoids compiler warning
        }