private void PrintFloats(List <float> receivedFloats) { StringBuilder floatStringBuilder = new StringBuilder(receivedFloats.Count * 20); for (int i = 0; ; i += 2) { if (i < receivedFloats.Count - 1) { floatStringBuilder.AppendLine(receivedFloats[i] + " " + receivedFloats[i + 1]); } else if (i == receivedFloats.Count - 1) { floatStringBuilder.AppendLine(receivedFloats[i].ToString()); break; } else { break; } } string floatString = floatStringBuilder.ToString(); if (!String.IsNullOrEmpty(floatString)) { //Check se non supero MaxLegth. Se lo faccio rimuovo un numero di caratteri sufficient i dalla testa della stringa if (SerialTextBox.Text.Length + floatString.Length > SerialTextBox.MaxLength) { SerialTextBox.Text = SerialTextBox.Text.Remove(0, SerialTextBox.MaxLength - floatString.Length); } SerialTextBox.AppendText(floatString); //Piazza la scroll bar alla fine del testo per visualizzare i nuovi valori. SerialTextBox.ScrollToCaret(); } }
void GetWorkForm()// Инициализация компонентов рабочей формы { GB_Work.Visible = true; GB_Work.Location = new Point(12, 12); GB_Work.Size = new Size(1400, 800); GetGridSetting(); BaseC.control = this; BaseC.LoadWorkForm(); SetInfoGrid(); SerialTextBox.Select(); }
private void Clear_All() { AssetTagTextBox.Clear(); AssetTagSearchTextBox.Clear(); SerialTextBox.Clear(); SerialSearchTextBox.Clear(); CurrrentUserTextBox.Clear(); DescriptionTextBox.Clear(); ReplaceYearTextBox.Clear(); TrackablesCheckBox.Checked = false; HistoricalCheckBox.Checked = false; RefreshCombos(); }
private void InitDBControls() { DescriptionTextBox.SetDBInfo(DevicesBaseCols.Description, true); AssetTagTextBox.SetDBInfo(DevicesBaseCols.AssetTag, true); SerialTextBox.SetDBInfo(DevicesBaseCols.Serial, true); PurchaseDatePicker.SetDBInfo(DevicesBaseCols.PurchaseDate, true); ReplaceYearTextBox.SetDBInfo(DevicesBaseCols.ReplacementYear, false); LocationComboBox.SetDBInfo(DevicesBaseCols.Location, Attributes.DeviceAttributes.Locations, true); CurrentUserTextBox.SetDBInfo(DevicesBaseCols.CurrentUser, true); OSTypeComboBox.SetDBInfo(DevicesBaseCols.OSVersion, Attributes.DeviceAttributes.OSType, true); PhoneNumTextBox.SetDBInfo(DevicesBaseCols.PhoneNumber, false); EquipTypeComboBox.SetDBInfo(DevicesBaseCols.EQType, Attributes.DeviceAttributes.EquipType, true); StatusComboBox.SetDBInfo(DevicesBaseCols.Status, Attributes.DeviceAttributes.StatusType, true); TrackableCheckBox.SetDBInfo(DevicesBaseCols.Trackable, false); POTextBox.SetDBInfo(DevicesBaseCols.PO, false); HostnameTextBox.SetDBInfo(DevicesBaseCols.HostName, false); iCloudTextBox.SetDBInfo(DevicesBaseCols.iCloudAccount, false); }
private void InitDBControls() { //Required Fields AssetTagTextBox.SetDBInfo(DevicesBaseCols.AssetTag, true); SerialTextBox.SetDBInfo(DevicesBaseCols.Serial, true); CurrentUserTextBox.SetDBInfo(DevicesBaseCols.CurrentUser, true); DescriptionTextBox.SetDBInfo(DevicesBaseCols.Description, true); PurchaseDatePicker.SetDBInfo(DevicesBaseCols.PurchaseDate, true); EquipTypeComboBox.SetDBInfo(DevicesBaseCols.EQType, Attributes.DeviceAttributes.EquipType, true); LocationComboBox.SetDBInfo(DevicesBaseCols.Location, Attributes.DeviceAttributes.Locations, true); OSVersionComboBox.SetDBInfo(DevicesBaseCols.OSVersion, Attributes.DeviceAttributes.OSType, true); StatusComboBox.SetDBInfo(DevicesBaseCols.Status, Attributes.DeviceAttributes.StatusType, true); //Non-required and Misc Fields PONumberTextBox.SetDBInfo(DevicesBaseCols.PO, false); ReplaceYearTextBox.SetDBInfo(DevicesBaseCols.ReplacementYear, false); PhoneNumberTextBox.SetDBInfo(DevicesBaseCols.PhoneNumber, false); GuidLabel.SetDBInfo(DevicesBaseCols.DeviceGuid, ParseType.DisplayOnly, false); TrackableCheckBox.SetDBInfo(DevicesBaseCols.Trackable, false); HostnameTextBox.SetDBInfo(DevicesBaseCols.HostName, false); iCloudTextBox.SetDBInfo(DevicesBaseCols.iCloudAccount, false); }
//TODO: Iterate through properties and dynamically generate controls at runtime. private void InitDBControls() { EntryTimeTextBox.SetDBInfo(HistoricalDevicesCols.ActionDateTime, ParseType.DisplayOnly, false); ActionUserTextBox.SetDBInfo(HistoricalDevicesCols.ActionUser, ParseType.DisplayOnly, false); ChangeTypeTextBox.SetDBInfo(HistoricalDevicesCols.ChangeType, Attributes.DeviceAttributes.ChangeType, ParseType.DisplayOnly, false); DescriptionTextBox.SetDBInfo(HistoricalDevicesCols.Description, ParseType.DisplayOnly, false); GuidTextBox.SetDBInfo(HistoricalDevicesCols.DeviceGuid, ParseType.DisplayOnly, false); CurrentUserTextBox.SetDBInfo(HistoricalDevicesCols.CurrentUser, ParseType.DisplayOnly, false); LocationTextBox.SetDBInfo(HistoricalDevicesCols.Location, Attributes.DeviceAttributes.Locations, ParseType.DisplayOnly, false); PONumberTextBox.SetDBInfo(HistoricalDevicesCols.PO, ParseType.DisplayOnly, false); AssetTagTextBox.SetDBInfo(HistoricalDevicesCols.AssetTag, ParseType.DisplayOnly, false); PurchaseDateTextBox.SetDBInfo(HistoricalDevicesCols.PurchaseDate, ParseType.DisplayOnly, false); OSVersionTextBox.SetDBInfo(HistoricalDevicesCols.OSVersion, Attributes.DeviceAttributes.OSType, ParseType.DisplayOnly, false); SerialTextBox.SetDBInfo(HistoricalDevicesCols.Serial, ParseType.DisplayOnly, false); ReplaceYearTextBox.SetDBInfo(HistoricalDevicesCols.ReplacementYear, ParseType.DisplayOnly, false); EQTypeTextBox.SetDBInfo(HistoricalDevicesCols.EQType, Attributes.DeviceAttributes.EquipType, ParseType.DisplayOnly, false); NotesTextBox.SetDBInfo(HistoricalDevicesCols.Notes, ParseType.DisplayOnly, false); StatusTextBox.SetDBInfo(HistoricalDevicesCols.Status, Attributes.DeviceAttributes.StatusType, ParseType.DisplayOnly, false); EntryGuidTextBox.SetDBInfo(HistoricalDevicesCols.HistoryEntryGuid, ParseType.DisplayOnly, false); chkTrackable.SetDBInfo(HistoricalDevicesCols.Trackable, ParseType.DisplayOnly, false); PhoneNumberTextBox.SetDBInfo(HistoricalDevicesCols.PhoneNumber, ParseType.DisplayOnly, false); HostnameTextBox.SetDBInfo(HistoricalDevicesCols.HostName, ParseType.DisplayOnly, false); iCloudTextBox.SetDBInfo(HistoricalDevicesCols.iCloudAccount, ParseType.DisplayOnly, false); }
public WorkForm(BaseClass BC, int LOTID) { InitializeComponent(); BaseC = BC; //Приведение к типу BaseC.LOTID = LOTID; this.Text = BaseC.GetType().Name; //Заголовок формы называется именем модулем GetLoggin(); //Настройка форма ввода пароля Times.Enabled = true; LBPrintSN.Text = DateTime.Now.ToString("dd.MM.yyyy"); //Настройка времени Controllabel.Text = ""; TestGrid.Rows.Add(12); //Реализация загрузки определенного класса CloseApp.Click += (a, e) => { var Result = MessageBox.Show("Уверены, что хотите выйти?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.Yes) { Application.Exit(); } }; BackButton.Click += (a, e) => { var Result = MessageBox.Show("Уверены, что хотите вернуться в меню настройки?", "Предупреждение", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (Result == DialogResult.Yes) { Close(); } }; GETSNCH.Click += (a, e) => { if (GETSNCH.Checked) { BaseC.CheckGetSN = true; } if (!GETSNCH.Checked) { BaseC.CheckGetSN = false; } }; BTPrint.Click += (a, e) => { if (ListPrinter.SelectedIndex == -1) { MessageBox.Show("Принтер не выбран"); return; } BaseC.printName = ListPrinter.SelectedItem.ToString(); PrintLBName.Text = "Текущий принтер \n" + BaseC.printName; ListPrinter.ClearSelected(); }; ClearBT.Click += (a, e) => { //BaseC.cts.Cancel(); SerialTextBox.Enabled = true; SerialTextBox.Clear(); SerialTextBox.Select(); }; TB_RFIDIn.KeyDown += (a, e) => //Событие при вводе логина { if (e.KeyCode == Keys.Enter) { if (GetLoginData()) //Метод, которы проверяет логин и добавляет в ArrayList данные о пользователе { TB_RFIDIn.Clear(); TB_RFIDIn.Select(); } } }; SerialTextBox.KeyDown += (a, e) => //Событие скнирование номера { if (e.KeyCode == Keys.Enter) { TestGrid.Rows.Clear(); TestGrid.RowCount = 12; BaseC.KeyDownMethod(); if (BaseC.GetType() == typeof(UploadStation)) { return; } if (BaseC.GetType() == typeof(Desassembly_STB)) { return; } SerialTextBox.Clear(); SerialTextBox.Select(); } }; //Сохранение координат BT_SevePrintSettings.Click += (a, e) => { //var list = new List<string>() { IDX.Value.ToString(), SNX.Value.ToString(), IDY.Value.ToString(), SNY.Value.ToString()}; //foreach (var item in pathlist) //{ // var line = item.Substring(0, 22) + list[pathlist.IndexOf(item)] + ".txt"; // File.Move(item,line) ; //} if (BaseC.CheckPathPrinterSettings()) { BaseC.CreatePathPrinter(); } if (SNPRINT.Visible == true) { SaveSettingPrint(SNPRINT); } if (IDPrint.Visible == true) { SaveSettingPrint(IDPrint); } }; BT_PrinterSettings.Click += (a, e) => { GB_PrinterSettings.Visible = true; SettingDelay.Visible = true; foreach (Control item in SettingDelay.Controls) { if (item.Name.Contains("Delay")) { item.Enabled = true; } } }; BT_ClosePrintSet.Click += (a, e) => { GB_PrinterSettings.Visible = false; SettingDelay.Visible = false; SaveSettingBT.Text = ""; SerialTextBox.Select(); foreach (Control item in SettingDelay.Controls) { if (item.Name.Contains("Delay")) { item.Enabled = false; } } }; CB_ErrorCode.TextChanged += (a, e) => { CB_ErrorCode.MaxLength = 2; if (CB_ErrorCode.Text.Length == 2) { BT_Disassebly.Select(); } }; BT_Disassebly.Click += (a, e) => { if (string.IsNullOrEmpty(CB_ErrorCode.Text)) { MessageBox.Show("Укажите код ошибки"); CB_ErrorCode.Select(); return; } if (CheckErrocode(CB_ErrorCode.Text)) { MessageBox.Show("Не корректный код ошибки"); CB_ErrorCode.Select(); return; } var Dis = new Desassembly_STB(); var ErrorCodeID = Dis.GetErrorCodeID(CB_ErrorCode.Text); var serial = int.Parse(SerialTextBox.Text.Substring(15)); var smID = GetSmartCardID(serial); var fullStbsn = GetFullSTBSN(serial); var casid = GetCASID(serial); BaseC.WriteToDBDesis(serial, SerialTextBox.Text, ErrorCodeID); BaseC.UpdateToDBDesis(serial); BaseC.DeleteToDBWeight(serial); BaseC.DeleteToDBDesis(serial); BaseC.DeleteToUpload(serial); BaseC.AddLogDesis(serial, Dis.IDApp, smID, fullStbsn, casid); BaseC.LabelStatus(Controllabel, $"Серийный номер { SerialTextBox.Text } \n ОТКРЕПЛЁН УСПЕШНО", Color.Green); BaseC.ShiftCounter += 1; BaseC.LotCounter += 1; BaseC.ShiftCounterUpdate(); BaseC.LotCounterUpdate(); Label_ShiftCounter.Text = BaseC.ShiftCounter.ToString(); LB_LOTCounter.Text = BaseC.LotCounter.ToString(); SerialTextBox.Enabled = true; DG_UpLog.Rows.Add(int.Parse(Label_ShiftCounter.Text), SerialTextBox.Text, CB_ErrorCode.Text, DateTime.UtcNow.AddHours(2)); DG_UpLog.Sort(DG_UpLog.Columns[0], System.ComponentModel.ListSortDirection.Descending); SerialTextBox.Clear(); CB_ErrorCode.Text = ""; BT_Disassebly.Enabled = false; SerialTextBox.Select(); }; }
public Boolean validarCampos() { if (PlacaTextBox.Text == "Placa" || PlacaTextBox.Text == "") { PlacaTextBox.Focus(); return(false); } //-----Este campo no es obligatorio if (CorreoCorporativoTextBox.Text != "Correo Corporativo") { if (!IsValidEmail(CorreoCorporativoTextBox.Text)) { MessageBox.Show("El correo tiene un Formato email incorrecto"); return(false); } } //-----Este campo no es obligatorio //if (LanMessengerTextBox.Text == "Lan Messenger" || LanMessengerTextBox.Text == "") //{ // LanMessengerTextBox.Focus(); // return false; //} if (EstadoComboBox.Text == "- Seleccionar Estado -") { EstadoComboBox.Focus(); return(false); } if (SerialTextBox.Text == "Serial" || SerialTextBox.Text == "") { SerialTextBox.Focus(); return(false); } if (MarcaTextBox.Text == "Marca" || MarcaTextBox.Text == "") { MarcaTextBox.Focus(); return(false); } if (ModeloTextBox.Text == "Modelo" || ModeloTextBox.Text == "") { ModeloTextBox.Focus(); return(false); } if (NombreProveedortextBox.Text == "Nombre del Proveedor" || NombreProveedortextBox.Text == "") { NombreProveedortextBox.Focus(); return(false); } if (NitCompraTextbox.Text == "NIT" || NitCompraTextbox.Text == "") { NitCompraTextbox.Focus(); return(false); } if (ValorCompraTextBox.Text == "Valor de Compra" || ValorCompraTextBox.Text == "") { ValorCompraTextBox.Focus(); return(false); } return(true); //if (PlacaTextBox.Text == "Placa" || CorreoCorporativoTextBox.Text == "Correo Corporativo" || // LanMessengerTextBox.Text == "Lan Messenger" || EstadoComboBox.Text == "- Seleccionar Estado -" || // SerialTextBox.Text == "Serial" || MarcaTextBox.Text == "Marca" || // ModeloTextBox.Text == "Modelo" || NombreProveedortextBox.Text == "Nombre Proveedor") }