public void createPrinterModel(MetroLabel catrogeModelIDLab, MetroTextBox modelName, MetroComboBox catrigeColor) { using (ContextModel db = new ContextModel()) { if (CatrigeModelID == 0) { CatrigeModel catrigeModel = new CatrigeModel { CatirgeModelName = modelName.Text.Trim(), ColorID = Convert.ToInt32(catrigeColor.SelectedValue) }; db.CatrigeModel.Add(catrigeModel); } else { var mpToUpdate = db.CatrigeModel.SingleOrDefault(pm => pm.CatrigeModelID == CatrigeModelID); if (mpToUpdate != null) { mpToUpdate.CatirgeModelName = modelName.Text; mpToUpdate.ColorID = Convert.ToInt32(catrigeColor.SelectedValue); } } db.SaveChanges(); } }
public HeroFilter(List <MetroCheckBox> group, List <MetroCheckBox> subgroup, List <MetroCheckBox> franchise, MetroTextBox textFilter) { foreach (var it in group) { it.CheckStateChanged += OnGroupCheckChanged; } this.group = group; foreach (var it in franchise) { it.CheckStateChanged += OnFranchiseCheckChanged; } this.franchise = franchise; foreach (var it in subgroup) { it.CheckStateChanged += OnSubGroupCheckChanged; } this.subgroup = subgroup; this.textFilter = textFilter; textFilter.TextChanged += TextFilter_TextChanged; }
public bool txtTurStringKontrol(string[] txtBoxAdlar, MetroPanel pnl, MetroForm frm) { int i = 0; while (i < txtBoxAdlar.Length) { MetroTextBox txtBox = (MetroTextBox)pnl.Controls.Find("txt" + txtBoxAdlar[i], true)[0]; double x; int y; if (int.TryParse(txtBox.Text, out y)) { i++; } else if (double.TryParse(txtBox.Text, out x)) { return(true); } else { MetroMessageBox.Show(frm, "Hata !", txtBoxAdlar[i] + " alanı metinsel ifade içeremez !", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } } if (txtBoxAdlar.Length == i) { return(true); } return(false); }
private void metroTextBox1_TextChanged(object sender, EventArgs e) { // Reset current script line ResetTopic(); float _currentScriptVelocityState = 0f; MetroTextBox metroTextBox = (MetroTextBox)sender; if (!float.TryParse(metroTextBox.Text, out _currentScriptVelocityState)) { scriptVelocity.WithError = true; } else { currentScriptVelocityState = _currentScriptVelocityState < Utils.MIN_SPEED ? Utils.MIN_SPEED : _currentScriptVelocityState; scriptVelocity.WithError = _currentScriptVelocityState <Utils.MIN_SPEED || _currentScriptVelocityState> Utils.MAX_SPEED; } timerScript.Interval = (int)currentScriptVelocityState * 1000; // Block start button based on this input validation if (Script.scriptTopics.Count > 0) { if (scriptVelocity.WithError) { handleButtonsActionState(); } else { btnStart.Style = MetroColorStyle.Yellow; btnStart.Enabled = true; } } }
MetroTextBox textbox__metro(Size size, Point point, string text, string name, bool passwordchar, bool Dark) { MetroTextBox textb = new MetroTextBox(); textb.Size = size; textb.Location = point; if (text != "") { textb.Text = text; } else { textb.Text = "Нет данных"; } textb.Name = name; if (passwordchar) { textb.UseSystemPasswordChar = true; } if (Dark) { textb.Theme = MetroFramework.MetroThemeStyle.Dark; } return(textb); }
private void addSlash(MetroTextBox textbox, int placeIndex) { string txtString = textbox.Text; textbox.Text = txtString.Insert(placeIndex, "/"); textbox.SelectionStart = textbox.Text.Length; }
private void Add_Btn_Click(object sender, EventArgs e) { fillLKMBox(); fillMPGBox(); // Input arguments for the DriveLogEntry class List <double> InputArguments = new List <double>(); // First ensure that all input values are of a valid format MetroTextBox[] TextBoxFields = new MetroTextBox[] { Milage_Box, DistanceDriven_Box, Consumption_Box, LiterKilometerBox, MilesGallonBox }; foreach (var textBox in TextBoxFields) { (bool, double)userInput = checkUserInput(textBox.Text); if (!userInput.Item1) { return; } else { InputArguments.Add(userInput.Item2); } } // Add the newly created log entry into the BindingLists DataManager.AddLogEntryFromUI(InputArguments); }
public LogicInventario(MetroTextBox txtCodigoProducto, NumericUpDown numInventario, List <Label> listLabel) { this.txtCodigoProducto = txtCodigoProducto; this.numInventario = numInventario; this.listLabel = listLabel; limpiarCampos(); }
public static void set4(double[] a, ref MetroTextBox txt1, ref MetroTextBox txt2, ref MetroTextBox txt3, ref MetroTextBox txt4) { txt1.Text = a[0].ToString(); txt2.Text = a[1].ToString(); txt3.Text = a[2].ToString(); txt4.Text = a[3].ToString(); }
public WorkInCatrigeModel(MetroTextBox catrigeModelName, MetroGrid dgv, MetroComboBox colorCB, MetroComboBox printerModelCB) { CatrigeModelName = catrigeModelName; Dgv = dgv; ColorCB = colorCB; PrinterModelCB = printerModelCB; }
private void SanitizeFolderPath(MetroTextBox textBox) { if (textBox.Text.EndsWith(@"\") == false) { textBox.Text += @"\"; } }
public void createPrinterModel(MetroLabel printerModelIDLab, MetroTextBox room, MetroComboBox titul) { LocationID = Convert.ToInt32(printerModelIDLab.Text); using (ContextModel db = new ContextModel()) { if (LocationID == 0) { LocationRoom location = new LocationRoom { Room = room.Text.Trim(), TitulID = Convert.ToInt32(titul.SelectedValue) }; db.LocationRoom.Add(location); } else { var mpToUpdate = db.LocationRoom.SingleOrDefault(pm => pm.LocationID == LocationID); if (mpToUpdate != null) { mpToUpdate.Room = room.Text; mpToUpdate.TitulID = Convert.ToInt32(titul.SelectedValue); } } db.SaveChanges(); } }
public CartrigeTest(MetroGrid dgvModel, MetroLabel catrigeID, MetroTextBox serialNumber, MetroTextBox catrigeModel) { DgvModel = dgvModel; SerialNumber = serialNumber; CatrigeModel = catrigeModel; CatrigeID = catrigeID; }
private void metroSearchRelationsButton_Click(object sender, EventArgs e) { if (metroGoTermsGrid.CurrentCell == null) { MessageBox.Show(@"Choose the term!"); } else { using (var unitOfWork = new UnitOWork(new GoDBContext())) { foreach (DataGridViewRow row in metroGoTermsGrid.Rows) { if (row.Selected) { var goTerms = unitOfWork.GoTerms. GetById(Int32.Parse(row.Cells[0].Value.ToString())); MetroTextBox txt = new MetroTextBox(); txt.Text = row.Cells[0].Value.ToString(); metroGoDBTabControl.SelectedTab = metroGoDBTabControl. TabPages["metroRelationsTabPage"]; SearchRelations(metroIsAGrid, txt); SearchRelations(metroPartOfGrid, txt); } } } } }
public bool MostarDiasA(MetroTextBox DiasAnt, MetroTextBox DiasM) { using (PLMContext db = new PLMContext()) { try { var datos = db.DiasAnticipacion.Select(x => x).ToList().FirstOrDefault(); if (datos != null) { DiasAnt.Text = datos.DiasA.ToString(); DiasM.Text = datos.DiasdeMargen.ToString(); return(true); } else { return(false); } } catch (Exception ex) { Dialogs.Show(ex.Message, DialogsType.Error); return(false); } } }
private void urlTextBox_KeyDown(object sender, KeyEventArgs e) { MetroTextBox edit = (MetroTextBox)sender; if (e.KeyCode == Keys.Enter && !String.IsNullOrWhiteSpace(edit.Text)) { var link = edit.Text; Regex reg = new Regex("htt(p|ps)://(.*)youtu(.*).(be|com)/(.*)"); Match math = reg.Match(link); if (math.Groups[1].Length > 0) { edit.Enabled = false; Functions.playlist.Clear(); if (edit.Text.IndexOf("&list") > 0 || edit.Text.IndexOf("?list") > 0 || edit.Text.IndexOf("videos") > 0) { loaderPic.Visible = true; } ready = false; metroProgressSpinner1.Visible = true; spinerTimer.Enabled = true; edit.Text = link; Thread general = new Thread(new ParameterizedThreadStart(generalThread)); general.Start(edit); Discord.SetText("Получениие данных...", ""); } else { MessageBox.Show("Поддерживаются только ссылки на видео или плейлист YouTube", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
public WorkInOperationPrinter(MetroGrid dgv, MetroTextBox printerIDTB, MetroComboBox statusCB, MetroDateTime date) { Dgv = dgv; PrinterIDTB = printerIDTB; StatusCB = statusCB; Date = date; }
public void createPrinterModel(MetroLabel printerModelIDLab, MetroTextBox modelName, MetroComboBox printerFirm) { PrinterModelID = Convert.ToInt32(printerModelIDLab.Text); using (ContextModel db = new ContextModel()) { if (PrinterModelID == 0) { PrinterModel printerModels = new PrinterModel { PrinterModelName = modelName.Text.Trim(), PrinterFirmID = Convert.ToInt32(printerFirm.SelectedValue) }; db.PrinterModel.Add(printerModels); } else { var mpToUpdate = db.PrinterModel.SingleOrDefault(pm => pm.PrinterModelID == PrinterModelID); if (mpToUpdate != null) { mpToUpdate.PrinterModelName = modelName.Text; mpToUpdate.PrinterFirmID = Convert.ToInt32(printerFirm.SelectedValue); } } db.SaveChanges(); } }
public static string ShowDialog(string text) { MetroForm prompt = new MetroForm { Width = 500, Height = 150, FormBorderStyle = FormBorderStyle.FixedDialog, StartPosition = FormStartPosition.CenterScreen, Theme = MetroThemeStyle.Dark, ShowInTaskbar = false, MinimizeBox = false, MaximizeBox = false }; MetroLabel textLabel = new MetroLabel() { Left = 50, Top = 20, Text = text, Width = 400, Theme = MetroThemeStyle.Dark }; MetroTextBox textBox = new MetroTextBox() { Left = 50, Top = 50, Width = 400, Theme = MetroThemeStyle.Dark }; MetroButton confirmation = new MetroButton() { Text = "Confirm", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK, Theme = MetroThemeStyle.Dark }; confirmation.Click += (sender, e) => { prompt.Close(); }; prompt.Controls.Add(textBox); prompt.Controls.Add(confirmation); prompt.Controls.Add(textLabel); prompt.AcceptButton = confirmation; return(prompt.ShowDialog() == DialogResult.OK ? textBox.Text : ""); }
internal MainForm_PluginHotkeys(IPlugin3[] plugins) { InitializeComponent(); StyleManager.Style = AxTools.Helpers.Settings2.Instance.StyleColor; Icon = Helpers.Resources.ApplicationIcon; for (int i = 0; i < plugins.Length; i++) { PictureBox pictureBox = new PictureBox { Parent = panel1, Image = plugins[i].TrayIcon, Location = new Point(23, 3 + sizeBetweenRows * i), Size = new Size(19, 19), SizeMode = PictureBoxSizeMode.StretchImage }; panel1.Controls.Add(pictureBox); MetroLabel label = new MetroLabel { Parent = panel1, AutoSize = false, CustomBackground = false, CustomForeColor = false, FontSize = MetroFramework.MetroLabelSize.Small, FontWeight = MetroFramework.MetroLabelWeight.Regular, LabelMode = MetroLabelMode.Default, Location = new Point(pictureBox.Location.X + pictureBox.Size.Width + 3, 5 + sizeBetweenRows * i), Size = new Size(174, 19), Text = plugins[i].Name, UseStyleColors = true }; panel1.Controls.Add(label); MetroTextBox textBox = new MetroTextBox { Parent = panel1, CustomBackground = false, CustomForeColor = false, FontSize = MetroFramework.MetroTextBoxSize.Small, FontWeight = MetroFramework.MetroTextBoxWeight.Regular, Location = new Point(label.Location.X + label.Size.Width + 3, 1 + sizeBetweenRows * i), Multiline = false, Text = AxTools.Helpers.Settings2.Instance.PluginHotkeys.ContainsKey(plugins[i].Name) ? AxTools.Helpers.Settings2.Instance.PluginHotkeys[plugins[i].Name].ToString() : "", Size = new Size(105, 23), UseStyleColors = true, Tag = plugins[i] }; textBox.KeyDown += TextBox_KeyDown; panel1.Controls.Add(textBox); MetroButton btn = new MetroButton { Parent = panel1, Highlight = true, Location = new Point(textBox.Location.X + textBox.Size.Width + 3, 1 + sizeBetweenRows * i), Size = new Size(75, 23), Text = "Clear" }; btn.Click += delegate { TextBox_KeyDown(textBox, new KeyEventArgs(Keys.None)); }; panel1.Controls.Add(btn); Invalidate(true); } }
void clearLst(Control.ControlCollection ctrln) { foreach (Control item in ctrln) { if (item is MetroTextBox) { MetroTextBox txt = (MetroTextBox)item; txt.Clear(); } else if (item is NumericUpDown) { NumericUpDown nmb = (NumericUpDown)item; nmb.Value = 0; } else if (item is MetroDateTime) { MetroDateTime dt = (MetroDateTime)item; dt.Value = DateTime.Now; } else if (item is MetroComboBox) { MetroComboBox mc = (MetroComboBox)item; mc.SelectedItem = default; } else if (item is GroupBox) { GroupBox gb = (GroupBox)item; clearLst(gb.Controls); } } }
private void TextBox_KeyDown(object sender, KeyEventArgs e) { MetroTextBox textBox = (MetroTextBox)sender; if (e.KeyCode != Keys.ControlKey && e.KeyCode != Keys.ShiftKey && e.KeyCode != Keys.Menu) { KeyExt key = new KeyExt(e.KeyCode, e.Alt, e.Shift, e.Control); textBox.Text = key.ToString(); string name = "Plugin_" + ((IPlugin3)textBox.Tag).Name; HotkeyManager.RemoveKeys(name); if (e.KeyCode == Keys.None) { AxTools.Helpers.Settings2.Instance.PluginHotkeys.Remove(((IPlugin3)textBox.Tag).Name); } else { AxTools.Helpers.Settings2.Instance.PluginHotkeys[((IPlugin3)textBox.Tag).Name] = key; Task.Run(() => { Thread.Sleep(1000); HotkeyManager.AddKeys(name, key); }); } AxTools.Helpers.Settings2.Instance.InvokePluginHotkeysChanged(); e.Handled = true; e.SuppressKeyPress = true; } }
private void OnKeyPress(object sender, KeyPressEventArgs e) { try { MetroTextBox txt = (MetroTextBox)sender; if (txt.Text.Contains('.')) { if (e.KeyChar == '.') { e.Handled = true; } } if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back & e.KeyChar != '.') { e.Handled = true; } base.OnKeyPress(e); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private bool dateTimeTextKeyDownBoxChecker(MetroTextBox textbox, char keyChar, Keys keycode) { bool cancelEVent = true; if (Char.IsNumber(keyChar) || Char.IsControl(keyChar) || (keycode >= Keys.NumPad0 && keycode <= Keys.NumPad9)) { Console.WriteLine("Key Not Blocked"); cancelEVent = false; if (Char.IsNumber(keyChar) || (keycode >= Keys.NumPad0 && keycode <= Keys.NumPad9)) { string textString = textbox.Text; int textlength = textbox.Text.Length; switch (textlength) { case 0: //do nothing break; case 1: int monthFirstDigit = Convert.ToInt32(textString.Substring(0, 1)); if (monthFirstDigit > 1) { textbox.Text = "0" + textString; addSlash(textbox, 2); } break; case 2: addSlash(textbox, 2); break; case 4: int dayFirstDigit = Convert.ToInt32(textString.Substring(3, 1)); if (dayFirstDigit > 3) { textbox.Text = textString.Insert(3, "0"); addSlash(textbox, 5); } break; case 5: addSlash(textbox, 5); break; case 9: Console.WriteLine("Checking"); //check if valid DateTime dt; if (!DateTime.TryParse(textbox.Text.ToString(), out dt)) { MessageBox.Show("Invalid Date Value"); } break; } } } return(cancelEVent); }
void Profile__setting() { MetroButton add_image = new MetroButton(); PictureBox user__image = new PictureBox(); MetroTextBox textb = new MetroTextBox(); MetroLabel label = new MetroLabel(); int width = 1576 / 2; int height = 849 / 2; // User Image user__image.Location = new Point(width, 30); user__image.Size = new Size(150, 150); user__image.SizeMode = PictureBoxSizeMode.Zoom; user__image.Image = Image.FromFile("C:\\Users\\isles\\Documents\\image\\default.png"); // Button add__image add_image.Location = new Point(width, 200); add_image.Size = new Size(150, 30); add_image.Text = "Изменить"; add_image.Theme = MetroFramework.MetroThemeStyle.Dark; add_image.Click += new_image; // Name metroPanel4.Controls.Add(user__image); metroPanel4.Controls.Add(add_image); metroPanel4.Controls.Add(label__metro(new Size(150, 20), new Point(width - 70, 270), "Ваше имя:", "Name", true)); metroPanel4.Controls.Add(textbox__metro(new Size(150, 20), new Point(width + 80, 270), main.get__name().Split(' ')[0], "Name__text", false, true)); metroPanel4.Controls.Add(label__metro(new Size(150, 20), new Point(width - 70, 310), "Ваша фамилия:", "Name", true)); metroPanel4.Controls.Add(textbox__metro(new Size(150, 20), new Point(width + 80, 310), main.get__name().Split(' ')[1], "Name__text", false, true)); metroPanel4.Controls.Add(label__metro(new Size(150, 20), new Point(width - 70, 350), "Ваше пароль:", "Password", true)); metroPanel4.Controls.Add(textbox__metro(new Size(150, 20), new Point(width + 80, 350), "Пароль", "Password__text", true, true)); }
public int IsQuanLi(MetroTextBox txtDangNhap, MetroTextBox txtMatKhau) { String dangNhap = txtDangNhap.Text.ToString().Trim(); String matKhau = txtMatKhau.Text.ToString().Trim(); return(QuanLiDAO.Instance.IsQuanli(dangNhap, matKhau)); }
private List <Control> InitControls() { inputFilePathTextBox = new MetroTextBox { Name = "Путь к входному файлу" }; outputFileTextBox = new MetroTextBox { Name = "Путь к выходному файлу", Text = @"test.png" }; widthSetter = new NumericUpDown { Name = "Ширина результата", Maximum = 2000, Minimum = 1, Value = 800 }; heightSetter = new NumericUpDown { Name = "Высота результата", Maximum = 2000, Minimum = 1, Value = 600 }; fontSelector = Elements.TypeBox(FontFamily.Families.Select(f => f.Name), "Arial", "Используемый шрифт"); formatSelector = Elements.TypeBox( typeof(ImageFormat).GetProperties().Select(p => p.Name).Where(name => name != "Guid"), "Png", "Формат результата"); colorSelector = new MetroTextBox { Name = "Используемые цвета", Text = @"Aqua Black" }; return(new List <Control> { inputFilePathTextBox, outputFileTextBox, widthSetter, heightSetter, fontSelector, formatSelector, colorSelector }); }
private void InitializeComponent() { m_rgbPicker = new RGBPickerControl(); m_rgbPicker.Top = Height; m_rgbPicker.Width = DEFAULT_HEIGHT; m_rgbPicker.Height = DEFAULT_HEIGHT; m_rgbPicker.Anchor = AnchorStyles.Top | AnchorStyles.Left; m_rgbPicker.Click += new EventHandler(m_rgbPicker_Click); m_rgbPicker.ColorChanged += new RGBPickerControl.ColorChangedDelegate(m_rgbPicker_ColorChanged); Controls.Add(m_rgbPicker); m_aTextBox = new MetroTextBox(); MetroSkinManager.ApplyMetroStyle(m_aTextBox); m_aTextBox.Top = Height + (m_rgbPicker.Height / 2) - (m_aTextBox.Height / 2); m_aTextBox.Left = m_rgbPicker.Right + 5; m_aTextBox.Width = 40; m_aTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left; m_aTextBox.TextChanged += new EventHandler(m_aTextBox_TextChanged); Controls.Add(m_aTextBox); m_aTrack = new MetroTrackBar(); MetroSkinManager.ApplyMetroStyle(m_aTrack); m_aTrack.Top = Height; m_aTrack.Left = m_aTextBox.Right; m_aTrack.Width = Width - m_aTextBox.Right; m_aTrack.Height = m_rgbPicker.Height; m_aTrack.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; m_aTrack.Maximum = 255; m_aTrack.ValueChanged += new EventHandler(m_aTrack_ValueChanged); Controls.Add(m_aTrack); Height += m_rgbPicker.Height; }
protected void txt_KeyPressMoney(object sender, KeyPressEventArgs e) { MetroTextBox txt = sender as MetroTextBox; if (txt.Text.Contains('.')) { if (!char.IsDigit(e.KeyChar)) { e.Handled = true; } if (e.KeyChar == '\b') { e.Handled = false; } } else { if (!char.IsDigit(e.KeyChar)) { e.Handled = true; } if (e.KeyChar == '.' || e.KeyChar == '\b') { e.Handled = false; } } }
public Boolean SaveEditProfileSeeker(Seeker r, MetroTextBox fname, MetroTextBox lname, MetroTextBox email, MetroTextBox mobile, MetroTextBox address, MetroTextBox designation, MetroTextBox organisation) { if (r != null) { var v = from a in db.TabSeekers where a.uname == r.Username select a; TabSeeker tab = v.First(); tab.fname = fname.Text; tab.lname = lname.Text; tab.email = email.Text; tab.mobile = mobile.Text; tab.address = address.Text; db.SubmitChanges(); return(true); } else { return(false); } }