internal static void TextChanged(MaterialSingleLineTextField textField, ListBox autocompleteList)
 {
     if (textField.Text.Length >= 3)
     {
         autocompleteList.Visible = true;
         List <Station> stationList;
         try
         {
             stationList = transport.GetStations(textField.Text).StationList;
         }
         catch (WebException ex)
         {
             return;
         }
         autocompleteList.Items.Clear();
         foreach (Station station in stationList.GetRange(0, Math.Min(stationList.Count, 4)))
         {
             autocompleteList.Items.Add(station.Name);
         }
     }
     else if (autocompleteList.Visible)
     {
         autocompleteList.Visible = false;
     }
 }
        private async void MaterialRaisedButton1_Click(object sender, EventArgs e)
        {
            MaterialSingleLineTextField[] temp = new MaterialSingleLineTextField[2] {
                Naziv, Sifra
            };
            if (ValidationHelper.ValidateTextBoxes(temp, errorProvider) &&
                ValidationHelper.IsValidInteger(StanjeNaLageru, errorProvider) &&
                ValidationHelper.IsValidDecimal(Cijena, errorProvider) &&
                ValidationHelper.IsComboBoxSelected(Kategorija, errorProvider) &&
                ValidationHelper.IsComboBoxSelected(Proizvodac, errorProvider))
            {
                var ComboBoxKategorija = Kategorija.SelectedItem;
                var ComboBoxProizvodac = Proizvodac.SelectedItem;
                var model = new Model.Requests.Proizvodi.ProizvodVM()
                {
                    Naziv          = Naziv.Text,
                    Sifra          = Sifra.Text,
                    Opis           = Opis.Text,
                    Cijena         = decimal.Parse(Cijena.Text),
                    StanjeNaLageru = int.Parse(StanjeNaLageru.Text),
                    KategorijaId   = ((Model.Requests.Proizvodi.Kategorije)ComboBoxKategorija).KategorijaId,
                    ProizvodacId   = ((Model.Requests.Proizvodi.ProizvodacPoklona)ComboBoxProizvodac).ProizvodacPoklonaId,
                    Slika          = _slika
                };

                await _apiServiceProizvodi.Insert <Model.Requests.Proizvodi.ProizvodVM>(model);

                MessageBox.Show("Uspješno ste dodali proizvod..", "Uspjeh!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Close();
            }
        }
Example #3
0
        /// <summary>
        /// 10 Checkboxen brauchen 10 antworten im Array bei der Karte CorrectSolution vom Typ boolean
        /// </summary>
        /// <param name="count"></param>
        private void generateCheckBoxes(int count)
        {
            this.picPattern.Visible = false;
            this.txtPattern.Visible = false;
            this.lblPattern.Visible = false;

            MaterialSingleLineTextField txt = null;
            PictureBox    box   = null;
            MaterialLabel label = null;

            for (int i = 0; i < count; i++)
            {
                txt          = new MaterialSingleLineTextField();
                txt.Size     = new Size(50, 24);
                txt.Location = new Point(this.txtPattern.Location.X, this.txtPattern.Location.Y + ((this.txtPattern.Height - 3) * i));
                this.Controls.Add(txt);

                label          = new MaterialLabel();
                label.Size     = new Size(100, 24);
                label.Location = new Point(this.lblPattern.Location.X, txt.Location.Y - 1);
                label.Text     = this.textBoxText[i];
                this.Controls.Add(label);

                box          = new PictureBox();
                box.Location = new Point(this.picPattern.Location.X, txt.Location.Y - 2);
                box.Size     = new Size(25, 25);
                box.SizeMode = PictureBoxSizeMode.StretchImage;
                this.Controls.Add(box);

                this.textBoxCollection.Add(txt);
                this.pictureBoxCollection.Add(box);
            }
        }
Example #4
0
 private void checkFocus(MaterialSingleLineTextField textBox)
 {
     if (textBox.Text.Equals(""))
     {
         textBox.Focus();
     }
 }
        public string ShowDialog(string caption)
        {
            
            Form2 prompt = new Form2()
            {
                Width = 181,
                Height = 145,
                Text = caption,
                StartPosition = FormStartPosition.CenterScreen
            };

            MaterialRaisedButton btnEnviar = new MaterialRaisedButton() { Text = "Entrar", DialogResult = DialogResult.OK };
            btnEnviar.Location = new Point(52, 96);
            btnEnviar.Click += (sender, e) => { prompt.Close(); };
            prompt.Controls.Add(btnEnviar);
            btnEnviar.TabIndex = 2;

            MaterialSingleLineTextField txtSenha = new MaterialSingleLineTextField() { Width=126 };
            txtSenha.Location = new Point(24,67);
            txtSenha.KeyDown += (sender, e) => { if (e.KeyData == Keys.Enter) btnEnviar.PerformClick(); };
            txtSenha.PasswordChar = '*';
            prompt.Controls.Add(txtSenha);
            txtSenha.TabIndex = 1;
            

            return prompt.ShowDialog() == DialogResult.OK ? txtSenha.Text : "";
        }
Example #6
0
        public static bool ValidTextInput(this MaterialSingleLineTextField textField, ErrorProvider errors, TextInputType textInputType = TextInputType.Letters, bool SetErrors = true)
        {
            if (errors == null)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(textField.Text))
            {
                if (SetErrors)
                {
                    errors.SetError(textField, Resources.RequiredField);
                }
                return(false);
            }

            if ((textInputType == TextInputType.Digits && textField.Text.Any(char.IsLetter)) ||
                (textInputType == TextInputType.Letters && textField.Text.Any(char.IsDigit)))
            {
                if (SetErrors)
                {
                    errors.SetError(textField, Resources.InvalidFormat);
                }
                return(false);
            }

            return(true);
        }
Example #7
0
        private async void MaterialRaisedButton1_Click(object sender, EventArgs e)
        {
            MaterialSingleLineTextField[] temp = new MaterialSingleLineTextField[7] {
                Ime, Prezime, Drzava, Grad, ZipCode, Adresa, BrojTelefona
            };

            if (ValidationHelper.ValidateTextBoxes(temp, errorProvider))
            {
                var model = new Model.Requests.Korisnici.KorisniciDetailsGetRequest()
                {
                    Ime              = Ime.Text,
                    Prezime          = Prezime.Text,
                    DrzavaStanovanja = Drzava.Text,
                    GradStanovanja   = Grad.Text,
                    PostalCode       = ZipCode.Text,
                    AdresaStanovanja = Adresa.Text,
                    BrojTelefona     = BrojTelefona.Text
                };

                if (_id.HasValue)
                {
                    await _apiService.Update <Model.Requests.Korisnici.KorisniciDetailsGetRequest>(model, _id);

                    MessageBox.Show("Uspješno ste ažurirali korisnika..", "Uspjeh!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
        }
Example #8
0
        private bool validDigit(MaterialSingleLineTextField tb)
        {
            // \b\d{2,6}[.]\d{2,6}\b 22.22
            Regex expresion = new Regex(@"(?:\d*\.)?\d+");

            return(expresion.IsMatch(tb.Text));
        }
        private async void Register_Click(object sender, EventArgs e)
        {
            MaterialSingleLineTextField[] temp = new MaterialSingleLineTextField[4] {
                Username, Email, Password, PasswordConfirmation
            };
            if (ValidationHelper.ValidateTextBoxes(temp, errorProvider1) && ValidationHelper.PasswordCheck(Password.Text, PasswordConfirmation.Text, Password, errorProvider1) && ValidationHelper.EmailCheck(Email.Text, Email, errorProvider1))
            {
                var model = new Model.Requests.KorisniciInsertRequest()
                {
                    Username             = Username.Text,
                    Email                = Email.Text,
                    Password             = Password.Text,
                    PasswordConfirmation = PasswordConfirmation.Text,
                    UlogaId              = 3,
                    Status               = true,
                };

                await _apiService.Insert <Model.Requests.KorisniciInsertRequest>(model);

                MessageBox.Show("Uspješno ste dodali korisnika..", "Uspjeh!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                frmLogin frm = new frmLogin();
                frm.Show();
                this.Close();
            }
        }
        public void FazerLogin(MaterialSingleLineTextField identificacao, MaterialSingleLineTextField senha, Form loginView)
        {
            Usuario usuario = new Usuario();

            usuario.Senha = senha.Text;
            usuario       = usuario.FazerLogin(identificacao.Text);

            if (usuario.TipoUsuario == TipoUsuario.Administrador)
            {
                OpcoesAdministrador opcoesAdministrador = new OpcoesAdministrador(usuario);
                loginView.Hide();
                opcoesAdministrador.ShowDialog();
            }
            else if (usuario.TipoUsuario == TipoUsuario.Funcionario)
            {
                OpcoesFuncionario opcoesFuncionario = new OpcoesFuncionario(usuario);
                loginView.Hide();
                opcoesFuncionario.ShowDialog();
            }
            else if (usuario.TipoUsuario == TipoUsuario.ClienteEspecial || usuario.TipoUsuario == TipoUsuario.ClienteNormal)
            {
                OpcoesCliente opcoesCliente = new OpcoesCliente(usuario);
                loginView.Hide();
                opcoesCliente.ShowDialog();
            }
            else
            {
                MessageBox.Show("Email ou senha incorretos", "Erro ao autenticar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                senha.Text = "";
            }
        }
Example #11
0
        //ar is add/remove tab selection
        public void updatePrtList(object checkList, object textBox = null, string ar = "add")
        {
            DataGridView prtList = checkList as DataGridView;

            prtList.Rows.Clear();
            //prtList.Items.Clear();
            if (textBox != null && ar == "add")
            {
                MaterialSingleLineTextField prtSearch = textBox as MaterialSingleLineTextField;
                foreach (System.Printing.PrintQueue pq in pqc)
                {
                    if (pq.Name.ToLower().Contains(prtSearch.Text.ToLower()) || pq.QueuePort.Name.Contains(prtSearch.Text)) //performs case insensitive search
                    {
                        prtList.Rows.Add(false, pq.Name, pq.QueuePort.Name);
                    }
                }
            }

            //For getting printers from a remote PC
            else if (textBox != null && ar == "remove")
            {
                MaterialSingleLineTextField pcName = textBox as MaterialSingleLineTextField;
                RegistryKey   reg;
                RegistryKey   env;
                List <string> results = new List <string>();

                try
                {
                    reg = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, pcName.Text);
                    env = reg.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Connections");
                    foreach (string s in env.GetSubKeyNames())
                    {
                        RegistryKey printerKey = env.OpenSubKey(s);
                        results.Add(printerKey.GetValue("Printer") as string);
                    }
                }

                catch (Exception e)
                {
                    Console.WriteLine("error with registry");
                }

                foreach (string s in results)
                {
                    if (s != null && s != "" && !s.Contains("name") && !s.Contains("---"))
                    {
                        prtList.Rows.Add(false, s);
                    }
                }
            }

            else
            {
                foreach (String s in System.Drawing.Printing.PrinterSettings.InstalledPrinters)
                {
                    prtList.Rows.Add(false, s);
                }
            }
        }
Example #12
0
 private void CheckValid(MaterialSingleLineTextField textBox)
 {
     if (textBox.Text.Equals(""))
     {
         MessageBox.Show("bạn cần điền đủ thông tin");
         textBox.Focus();
     }
 }
Example #13
0
 private void pasarAMayuscula(MaterialSingleLineTextField control)
 {
     if (!String.IsNullOrEmpty(control.Text))
     {
         control.Text           = control.Text.ToUpper();
         control.SelectionStart = control.TextLength;
     }
 }
 internal static void AutocompletionListDoubleClick(MaterialSingleLineTextField textField, ListBox autocompleteList)
 {
     if (autocompleteList.SelectedItem != null)
     {
         textField.Text           = autocompleteList.SelectedItem.ToString();
         autocompleteList.Visible = false;
     }
 }
Example #15
0
        private void SearchBarLeave(MaterialSingleLineTextField txt_SearchBar)
        {
            string Query = txt_SearchBar.Text;

            if (Query == "")
            {
                txt_SearchBar.Text      = "Search...";
                txt_SearchBar.ForeColor = Color.Gray;
            }
        }
Example #16
0
        // END - Update Selected Survey | Attitude

        #endregion

        #region Search

        private void SearchBarEnter(MaterialSingleLineTextField txt_SearchBar)
        {
            string Query = txt_SearchBar.Text;

            if (Query == "Search...")
            {
                txt_SearchBar.Text      = "";
                txt_SearchBar.ForeColor = Color.Black;
            }
        }
Example #17
0
        void creaOggetti()
        {
            Program.query(new MySqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'esami ecdl' AND TABLE_NAME = '" + tabella + "'", Program.connection).ExecuteReader());
            campi.Clear();
            foreach (var item in Program.risQuery)
            {
                campi.Add(item);
            }

            Program.query(new MySqlCommand("SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = '" + tabella + "' AND TABLE_SCHEMA = 'esami ecdl'", Program.connection).ExecuteReader());
            key.Clear();
            for (int i = 0; i < Program.risQuery.Count; i++)
            {
                key.Add(Program.risQuery[i][0]);
            }

            for (int i = 0, j = 0; i < campi.Count; i++, j++)
            {
                if (!key.Contains(campi[j][0]))
                {
                    MaterialLabel nuova = new MaterialLabel();
                    nuova.Location  = new Point(5, panel3.Height / 5 * i + 5);
                    nuova.Name      = campi[j][0];
                    nuova.BackColor = Color.Green;
                    nuova.Size      = new Size(panel3.Width / 2 - 10, nuova.Height);
                    nuova.Text      = campi[j][0];
                    panel3.Controls.Add(nuova);
                    label.Add(nuova);

                    MaterialSingleLineTextField testo = new MaterialSingleLineTextField();
                    testo.Location  = new Point(panel3.Width / 2, panel3.Height / 5 * i + 5);
                    testo.Size      = new Size(panel3.Width / 2 - 10, panel3.Height / 5 - 10);
                    testo.Name      = campi[j][0] + "-txt";
                    testo.BackColor = Color.Blue;

                    panel3.Controls.Add(testo);
                    text.Add(testo);
                }
            }

            if (tabella == "esami" || tabella == "esaminandi")
            {
                int index = gerarchie.FindIndex(dato => dato == tabella);
                if (tabella == "esami")
                {
                    labelcmb.Text = "Aggiungi esame alla sessione: " + idPadre;
                }
                if (tabella == "esaminandi")
                {
                    labelcmb.Text = "Aggiungi esaminado all'esame: " + idPadre;
                }

                riempiCmb(cmbEsistente, lblSeleziona, index);
            }
        }
Example #18
0
        public static bool IsValidDecimal(MaterialSingleLineTextField temp, ErrorProvider errorProvider)
        {
            bool ok = decimal.TryParse(temp.Text, out var res);

            if (!ok)
            {
                errorProvider.SetError(temp, "Unesite numeričku vrijednost!");
                return(false);
            }
            return(true);
        }
Example #19
0
 public ChessBoardManager(Panel chess, MaterialSingleLineTextField playerName, PictureBox mark)
 {
     this.ChessBoard = chess;
     this.PlayerName = playerName;
     this.Mark       = mark;
     this.Player     = new List <Player>()
     {
         new Player("Vinh", Properties.Resources.o),
         new Player("Khánh", Properties.Resources.x)
     };
 }
Example #20
0
 public static bool isSavePathValid(MaterialSingleLineTextField savePathTxtBox)
 {
     if (savePathTxtBox.Text.Length == 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Example #21
0
 private void focusDefaultInputField(MaterialSingleLineTextField field, string defaultText, bool focus)
 {
     if (field.Text == defaultText && focus)
     {
         field.Text = "";
     }
     else if (field.Text == "" && !focus)
     {
         field.Text = defaultText;
     }
 }
Example #22
0
 public bool ControlVacio(MaterialSingleLineTextField txt1)
 {
     if (
         String.IsNullOrEmpty(txt1.Text) |
         txt1.Text.Trim() == ","
         )
     {
         return(false);
     }
     return(true);
 }
Example #23
0
        private void AttachModuleFace(IEnumerable <ModuleFaceCategory> moduleFaceInfo)
        {
            const int PADDING          = 10;
            const int LABEL_X_POSITION = 20;
            const int LABEL_X_SIZE     = 150;
            const int INPUT_X_POSITION = 170;
            const int INPUT_X_SIZE     = 250;
            const int CONTROL_HEIGHT   = 35;

            int Current_Y_Position = 0;

            if (moduleFaceInfo == null)
            {
                return;
            }
            foreach (var category in moduleFaceInfo)
            {
                // TODO: 탭 인댄트 정리
                var title = new MaterialLabel( );
                title.Text     = category.CategoryName;
                title.Location = new Point(LABEL_X_POSITION, Current_Y_Position * CONTROL_HEIGHT + PADDING);
                title.Size     = new Size(LABEL_X_SIZE, CONTROL_HEIGHT);
                this.Controls.Add(title);
                Current_Y_Position++;

                foreach (var item in category)
                {
                    var itemname = new MaterialLabel();
                    itemname.Text     = item.Item2;
                    itemname.Size     = new Size(LABEL_X_SIZE, CONTROL_HEIGHT);
                    itemname.Location = new Point(LABEL_X_POSITION, Current_Y_Position * CONTROL_HEIGHT + PADDING);
                    Control iteminput = null;
                    switch (item.Item1)
                    {
                    case ModuleFaceTypes.String:
                        iteminput = new MaterialSingleLineTextField( );
                        break;

                    case ModuleFaceTypes.Int:
                        iteminput = new NumericUpDown( );
                        (( NumericUpDown )iteminput).Maximum = decimal.MaxValue;
                        (( NumericUpDown )iteminput).Minimum = decimal.MinValue;
                        break;
                    }
                    iteminput.Location = new Point(INPUT_X_POSITION, Current_Y_Position * CONTROL_HEIGHT + PADDING);
                    iteminput.Size     = new Size(INPUT_X_SIZE, CONTROL_HEIGHT);
                    Current_Y_Position++;
                    this.Controls.Add(itemname);
                    this.Controls.Add(iteminput);
                    InputFields.Add(iteminput);
                }
            }
        }
Example #24
0
 public bool ControlVaciosPorCalculos(MaterialSingleLineTextField txt1, MaterialSkin.Controls.MaterialSingleLineTextField txt2)
 {
     if (
         String.IsNullOrEmpty(txt1.Text.Trim()) |
         String.IsNullOrEmpty(txt2.Text.Trim()) |
         txt1.Text.Trim() == "," |            //.Contains(",")
         txt2.Text.Trim() == ","
         )
     {
         return(false);
     }
     return(true);
 }
        public List <Control> CreateView()
        {
            List <Control> controls = new List <Control>();
            var            font     = new Font(SystemFonts.DefaultFont, FontStyle.Bold);
            var            margin   = new Padding(10, 20, 10, 0);
            var            size     = new Size(400, 30);
            MaterialSingleLineTextField txtResolucion = new MaterialSingleLineTextField()
            {
                Name   = "txtResolucion",
                Hint   = "Ingrese la Resolucion",
                Margin = margin,
                Size   = size,
                Dock   = DockStyle.Fill
            };

            controls.Add(txtResolucion);

            MaterialSingleLineTextField txtCorreIni = new MaterialSingleLineTextField()
            {
                Name   = "txtCorrelativoInicial",
                Hint   = "Ingrese el correlativo Inicial",
                Size   = size,
                Margin = margin,
                Dock   = DockStyle.Fill
            };

            controls.Add(txtCorreIni);

            MaterialSingleLineTextField txtCorreFin = new MaterialSingleLineTextField()
            {
                Name   = "txtCorrelativoFinal",
                Hint   = "Ingrese el correlativo Final",
                Size   = size,
                Margin = margin,
                Dock   = DockStyle.Fill
            };

            controls.Add(txtCorreFin);

            MaterialSingleLineTextField txtCorrelativoAct = new MaterialSingleLineTextField()
            {
                Name   = "txtCorrelativoActual",
                Hint   = "Ingrese el correlativo Actual",
                Size   = size,
                Margin = margin,
            };

            controls.Add(txtCorrelativoAct);
            return(controls);
        }
Example #26
0
        private void TextBoxPlaceholderContent(MaterialSingleLineTextField textBox, string defaultText, bool isClicking)
        {
            string content = textBox.Text;

            if (isClicking)
            {
                content = content.Equals(defaultText) ? EMPTY_TEXT : content;
            }
            else
            {
                content = content.Equals(EMPTY_TEXT) ? defaultText : content;
            }
            textBox.Text = content;
        }
Example #27
0
 private bool event_ValidateTextboxControl(MaterialSingleLineTextField textbox, string message)
 {
     if (textbox.Enabled && textbox.Text.Length > 0)
     {
         return(true);
     }
     else if (!textbox.Enabled)
     {
         return(true);
     }
     else
     {
         MessageBox.Show(message); return(false);
     }
 }
 internal static void TextFieldKeyDown(MaterialSingleLineTextField textField, ListBox autocompleteList, Keys keyCode, Button acceptButton)
 {
     if (keyCode == Keys.Down && textField.Text.Length >= 3)
     {
         autocompleteList.Visible = true;
         autocompleteList.Focus();
         autocompleteList.SelectedIndex = 0;
     }
     // Workaround um mit Enter ein Button zu betätigen aber im
     // Autocomplete Dropdown auf Enter reagieren zu können
     else if (keyCode == Keys.Enter)
     {
         acceptButton.PerformClick();
     }
 }
Example #29
0
 // CAMPO MATERIALSINGLELINEtEXTFIELD
 public void LongitudMaximaDeCampo(MaterialSingleLineTextField control, int maxCaracteres, KeyPressEventArgs e)
 {
     if (control.TextLength > maxCaracteres)
     {
         if (Char.IsControl(e.KeyChar) || control.SelectedText.Length > 0)
         {
             e.Handled = false;
         }
         else
         {
             e.Handled = true;
         }
         control.SelectionStart = control.TextLength;
     }
 }
 internal static void AutocompletionListKeyDown(MaterialSingleLineTextField textField, ListBox autocompleteList, Keys keyCode)
 {
     if (keyCode == Keys.Enter)
     {
         if (autocompleteList.SelectedItem != null)
         {
             textField.Text           = autocompleteList.SelectedItem.ToString();
             autocompleteList.Visible = false;
         }
         textField.Focus();
     }
     else if (keyCode == Keys.Up && autocompleteList.SelectedIndex == 0)
     {
         textField.Focus();
     }
 }