private bool ValidateInput() { bool valid = true; if (FormTools.IsBlank(txtKode)) { valid = false; goto finish; } if (FormTools.IsBlank(txtNama)) { valid = false; goto finish; } if (formMode == FormTools.enumFormMode.New) { if (FormTools.IsDataExist("usp_Bkl_mMekanikService_LIST", "@kd_mk", SqlDbType.VarChar, txtKode.Text)) { valid = false; goto finish; } } finish: return(valid); }
}// ----------------------------------------- // -- private void PanelCompress_Load(object sender, EventArgs e) { // -- Some Tooltips ToolTip tt = new ToolTip(); tt.SetToolTip(chk_encodedCue, "Encodes audio tracks and creates a .CUE file that handles data and encoded audio tracks. Doesn't create a final archive. This format can be used in some emulators."); tt.SetToolTip(pictureBox1, "You can optionally set an image cover for this CD and it will be stored in the archive."); // -- Initialize Audio Settings: foreach (string scodec in CDCRUSH.AUDIO_CODECS) { combo_audio_c.Items.Add(scodec); } combo_audio_c.SelectedIndex = 0; combo_audio_c_SelectedIndexChanged(null, null); // force first call? why FormTools.fileLoadDialogPrepare("cue", "CUE files (*.cue)|*.cue"); FormTools.fileLoadDialogPrepare("cover", "Image files (*.jpg)|*.jpg"); // -- form_lockSection("action", true); form_set_cover(null); // will also set preparedCover form_set_info_pre(null); form_set_crushed_size(); loadedCuePath = null; postCdInfo = null; // -- form_set_proper_action_name(); combo_data_c.SelectedIndex = 3; }// -----------------------------------------
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var model = new FindReplaceParams { FindWith = "Find test", ReplaceWith = "Replace test", IsMatchCase = true, IsUseRegex = true }; var control = new FindReplaceControl(); control.SetModel(model); var form = FormTools.GetFormForControl(control); form.ShowDialog(); var @params = control.GetModel(); //Application.Run(new Main()); }
}// ----------------------------------------- /// <summary> /// Sets an image on the cover image placeholder, /// It will default on a predefined graphic if any error or null /// </summary> /// <param name="file">If NULL will set default ICON</param> public void form_setCoverImage(string file) { if (!FormTools.imageSetFile(pictureBox1, file)) { pictureBox1.Image = Properties.Resources.cd128; } }// -----------------------------------------
/// <summary> /// Prompts the user for a location to save the data file. /// </summary> public void SaveAs() { DataTable table = ((DataSet)_tableData_DataGridView.DataSource).Tables[_tableData_DataGridView.DataMember]; if (table == null) { return; } String saveType = _dataFile.IsExcelFile ? "Cooked Excel Tables" : "Cooked String Tables"; String saveExtension = _dataFile.IsExcelFile ? "txt.cooked" : "uni.xls.cooked"; String saveInitialPath = Path.Combine(Config.HglDir, _dataFile.FilePath); String savePath = FormTools.SaveFileDialogBox(saveExtension, saveType, _dataFile.FileName, saveInitialPath); if (String.IsNullOrEmpty(savePath)) { return; } if (!_dataFile.ParseDataTable(table, _fileManager)) { MessageBox.Show("Error: Failed to parse data table!"); return; } byte[] data = _dataFile.ToByteArray(); if (FormTools.WriteFileWithRetry(savePath, data)) { MessageBox.Show("Table saved Successfully!", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private bool ValidateInput() { bool valid = true; if (FormTools.IsBlank(txtKode)) { valid = false; goto finish; } if (FormTools.IsBlank(txtNama)) { valid = false; goto finish; } if (FormTools.IsDataExist("usp_bkl_mMotor_LIST", "@kode", SqlDbType.VarChar, txtKode.Text)) { valid = false; goto finish; } finish: return(valid); }
}// ----------------------------------------- // -- private void PanelCompress_Load(object sender, EventArgs e) { // -- Some Tooltips ToolTip tt = new ToolTip(); //tt.SetToolTip(chk_encodedCue, "Encodes audio tracks and creates a .CUE file that handles data and encoded audio tracks. Doesn't create a final archive. This format can be used in some emulators."); tt.SetToolTip(pictureBox1, "You can optionally set an image cover for this CD and it will be stored in the archive."); // -- Initialize combobox Audio Compression foreach (var codecID in AudioMaster.codecs) { combo_audio_c.Items.Add(AudioMaster.getCodecIDName(codecID)); } combo_audio_c.SelectedIndex = 0; combo_audio_c_SelectedIndexChanged(null, null); // force first call? why // -- Initialize combobox Archive Compression foreach (var cs in ArchiveMaster.compressionStrings) { combo_data_c.Items.Add(cs); } combo_data_c.SelectedIndex = ArchiveMaster.DEFAULT_INDEX; // -- combo_method.SelectedIndex = 0; FormTools.fileLoadDialogPrepare("cue", "CUE files (*.cue)|*.cue"); FormTools.fileLoadDialogPrepare("cover", "Image files (*.jpg)|*.jpg"); // -- form_prepare_init(); }// -----------------------------------------
private void toolStripMenuItem12_Click(object sender, EventArgs e) { FrmOtherWeighing otherWeighingForm = new FrmOtherWeighing(); FormTools formTools = new FormTools(); formTools.showFrom(this, otherWeighingForm); }
private void dataGridHeader_SelectionRowChanged(object sender, EventArgs e) { if (FormTools.IsRowSelected(dgvHeader)) { RefreshDataPembelianDetail(); } }
private void MIDetectingRecords_Click(object sender, EventArgs e) { FrmDetectingRecords drform = new FrmDetectingRecords(); FormTools formTools = new FormTools(); formTools.showFrom(this, drform); }
private bool ValidateInput() { bool valid = true; if (FormTools.IsBlank(txtNoPol)) { valid = false; goto finish; } if (FormTools.IsBlank(txtCustName)) { valid = false; goto finish; } //if (formMode == FormTools.enumFormMode.New || (formMode == FormTools.enumFormMode.Update && txtNoPol.Text != this.oldNoPol)) //{ // if (FormTools.IsDataExist("usp_Bkl_mMotorService_LIST", "@no_pol", SqlDbType.VarChar, txtNoPol.Text)) // { // valid = false; // goto finish; // } //} finish: return(valid); }
// UN ARC private void button6_Click(object sender, EventArgs e) { var app = new FreeArc(); app.onComplete = (s) => { if (!s) { LOG.log(app.ERROR); } else { LOG.log("ARC COMPLETE"); } FormTools.invoke(this, () => { this.Enabled = true; }); }; string file = FormTools.fileLoadDialog("arc")[0]; if (file != null) { app.extractAll(file); this.Enabled = false; } }
}// ----------------------------------------- /// <summary> /// Locks/Unlocks the form /// Can be called from threads /// </summary> /// <param name="_lock"></param> public void form_lockAll(bool _lock) { FormTools.invoke(this, () => { tabControl1.Enabled = !_lock; }); }// -----------------------------------------
} // -- private void FormComponentsTest_Load(object sender, EventArgs e) { LOG.log("Components Form Load"); LOG.attachTextBox(textBox1); FormTools.fileLoadDialogPrepare("ecm", "ECM files (*.ecm)|*.ecm"); FormTools.fileLoadDialogPrepare("arc", "ARC files (*.arc)|*.arc"); }
// UNECM - UNECM // -- private void button4_Click(object sender, EventArgs e) { var app = new EcmTools(); app.onComplete = (s) => { if (!s) { LOG.log(app.ERROR); } else { LOG.log("ECM COMPLETE"); } FormTools.invoke(this, () => { this.Enabled = true; }); }; string file = FormTools.fileLoadDialog("ecm")[0]; if (file != null) { app.unecm(file + "1"); this.Enabled = false; } }
}// ----------------------------------------- /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_CRUSH_Click(object sender, EventArgs e) { // Start the job // Note, Progress updates are automatically being handled by the main FORM bool res = CDCRUSH.crushCD(preparedCue, input_out.Text, combo_audioq.SelectedIndex, preparedCover, info_cdtitle.Text, (complete, md5, newSize) => { FormTools.invoke(this, () => { form_lockSection("all", false); form_lockSection("action", true); form_set_info_post(new { md5, size0 = newSize }); }); if (complete) { FormMain.sendMessage("Complete", 2); } else { FormMain.sendMessage(CDCRUSH.ERROR, 3); } }); if (res) { form_lockSection("all", true); } else { FormMain.sendMessage(CDCRUSH.ERROR, 3); FormMain.FLAG_CLEAR_STATUS = true; } }// -----------------------------------------
private void DeleteDetail2() { if (FormTools.IsRowSelected(dgvDetail2)) { Guid rowID = (Guid)dgvDetail2.SelectedCells[0].OwningRow.Cells["RowID3"].Value; if (MessageBox.Show("Hapus record ini?", "DELETE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { using (Database db = new Database()) { DataTable dt = new DataTable(); db.Commands.Add(db.CreateCommand("usp_bkl_mMemberService_DELETE")); db.Commands[0].Parameters.Add(new Parameter("@RowID", SqlDbType.UniqueIdentifier, rowID)); dt = db.Commands[0].ExecuteDataTable(); } MessageBox.Show("Record telah dihapus"); this.RefreshData(FormTools.detailIndex.detail2); } catch (Exception ex) { Error.LogError(ex); } } } }
public UserRepository() { users = new List <User>(); users.Add(new User { ID = GetPrimaryKey(), Name = "Erik", Surname = "Vitelli", Username = "******", Password = FormTools.To256Hash("1234"), Type = UserType.ADMIN, }); users.Add(new User { ID = GetPrimaryKey(), Name = "Marcelo", Surname = "Fulaninho", Address = "Rua dos Bobos", Number = "0", Username = "******", Password = FormTools.To256Hash("1234"), Type = UserType.ADMIN }); }
private void MIProductionSchedule_Click(object sender, EventArgs e) { //FrmProductionSchedule fpsform = new FrmProductionSchedule(); //try //{ // FormTools formTools = new FormTools(); // formTools.showFrom(this, fpsform); //} //catch //{ // } FrmProductionScheduleMain fpsmform = new FrmProductionScheduleMain(); //try //{ FormTools formTools = new FormTools(); formTools.showFrom(this, fpsmform); //} //catch //{ //} }
private void menuRightClcik_About_Click(object sender, EventArgs e) { About aboutform = new About(); FormTools formTools = new FormTools(); formTools.showFrom(this, aboutform); }
/// <summary> /// Updates progress bar /// Can be called from threads /// </summary> /// <param name="per">Progress Percent</param> public void form_setProgress(int per) { FormTools.invoke(this, () => { if (per < 0) { progressBar1.Style = ProgressBarStyle.Marquee; progressBar1.MarqueeAnimationSpeed = 15; TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Indeterminate); return; } else if (per == 0) { progressBar1.Style = ProgressBarStyle.Blocks; progressBar1.Value = per; this.Text = windowTitle; TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal); TaskbarManager.Instance.SetProgressValue(0, 100); } else { if (per > 100) { per = 100; } progressBar1.Value = per; this.Text = $"[{per}%] " + windowTitle; TaskbarManager.Instance.SetProgressValue(per, 100); } }); }// -----------------------------------------
}// ----------------------------------------- // :: Initialize things: private void FormMain_Load(object sender, EventArgs e) { // -- Enable drag and drop FormTools.dragDropFormEnable(this, (string[] files) => { if (CDCRUSH.LOCKED) { return; } if (files == null) { return; } handle_dropped_file(files[0]); }); // - Init Form Things FormTools.fileLoadDialogPrepare("ffmpeg", "FFmpeg.exe|ffmpeg.exe"); form_setProgress(0); form_setText("Ready.", 1); // - Set Infos tab windowTitle = CDCRUSH.PROGRAM_NAME + " v" + CDCRUSH.PROGRAM_VERSION; this.Text = windowTitle; // - Links info_ver.Text = CDCRUSH.PROGRAM_VERSION; link_web.LinkClicked += new LinkLabelLinkClickedEventHandler((a, b) => { link_web.LinkVisited = true; System.Diagnostics.Process.Start(CDCRUSH.LINK_SOURCE); }); link_donate.LinkClicked += new LinkLabelLinkClickedEventHandler((a, b) => { link_donate.LinkVisited = true; System.Diagnostics.Process.Start(CDCRUSH.LINK_DONATE); }); // -- Init Engine if (!CDCRUSH.init()) { // For some reason the engine couldn't initialize form_setText(CDCRUSH.ERROR, 3); form_lockAll(true); return; } // -- FFmpeg form_updateFFmpegStatus(); // -- Settings tab loadAndSetupSettings(); // -- Set initial tab tabControl1.SelectedIndex = STARTING_TAB; // -- #if (!DEBUG) group_debug.Visible = false; #endif }// -----------------------------------------
private void toolStripMenuItem11_Click(object sender, EventArgs e) { FrmCostCount costCountForm = new FrmCostCount(); FormTools formTools = new FormTools(); formTools.showFrom(this, costCountForm); }
private void ToolStripCostbudget_Click(object sender, EventArgs e) { FrmExpenditureSubject formExpendSubject = new FrmExpenditureSubject(); FormTools formTools = new FormTools(); formTools.showFrom(this, formExpendSubject); }
private void MIProductionParameter_Click(object sender, EventArgs e) { FrmProductionParameter frm = new FrmProductionParameter(); FormTools formTools = new FormTools(); formTools.showFrom(this, frm); }
private void 配合比发送单ToolStripMenuItem_Click(object sender, EventArgs e) { FrmProportionSendQuery formProportionSendQuery = new FrmProportionSendQuery(); FormTools formTools = new FormTools(); formTools.showFrom(this, formProportionSendQuery); }
private void MISparePartOutRefund_Click(object sender, EventArgs e) { equipment.FrmSparePartOutStockRefund frm = new equipment.FrmSparePartOutStockRefund(); FormTools formTools = new FormTools(); formTools.showFrom(this, frm); }
private void toolStripMenuItem9_Click(object sender, EventArgs e) { FrmAlterBitumenCostCount formAlterBitumenCC = new FrmAlterBitumenCostCount(); FormTools formTools = new FormTools(); formTools.showFrom(this, formAlterBitumenCC); }
}// -- // -- private void PanelRestore_Load(object sender, EventArgs e) { FormTools.fileLoadDialogPrepare("arc", "ARC files (*.arc)|*.arc"); form_lockSection("action", true); form_setCdInfo(null); form_setCoverImage(null); preparedArcPath = null; }// -----------------------------------------
private void MISparePartStock_Click(object sender, EventArgs e) { FrmSparePartStock frm = new FrmSparePartStock(); FormTools formTools = new FormTools(); formTools.showFrom(this, frm); }