private void CreateWeightBtn_Click(object sender, EventArgs e) { if (WeightGridView.CurrentRow?.DataBoundItem is WeightVersionModel currentWeightVersion) { using (var fbd = new FolderBrowserDialog()) { DialogResult result = fbd.ShowDialog(); if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath)) { var waitForm = new WaitFormFunc(); waitForm.Show(); var isSuccess = _dataSetService.DownloadLogAndLoss(currentWeightVersion, fbd.SelectedPath); waitForm.Close(); if (isSuccess) { MessageBox.Show($@"Log save at: {fbd.SelectedPath}", @"Message", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Information); } else { MessageBox.Show(@"The log could not be downloaded. Please try again later.", @"Message", buttons: MessageBoxButtons.OK, icon: MessageBoxIcon.Error); } } } } else { MessageBox.Show(@"Please select class version"); } }
private void btnExec__Convertor_Click(object sender, EventArgs e) { string inputFile = txtInputFilePath_Convertor.Text; string outputFolder = txtOutputFolderPath_Convertor.Text; if (txtInputFilePath_Convertor.Text == "" || txtOutputFolderPath_Convertor.Text == "") { MessageBox.Show("phải chọn input và output folder để thực thi tác vụ này !"); return; } else { string command = $"-i {inputFile} {outputFolder}.{cbbOutputFormat__Convertor.SelectedItem.ToString()}"; try { WaitFormFunc wf = new WaitFormFunc(); wf.Show(this); RunCMD.Instance.runCMD(command); wf.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } List <string> temp = new List <string>(); temp.Add(txtInputFilePath_Convertor.Text); temp.Add($"{outputFolder}.{cbbOutputFormat__Convertor.SelectedItem.ToString()}"); this.listInOut.Add(temp); }
private void ImportDataBtn_Click(object sender, EventArgs e) { var waitForm = new WaitFormFunc(); waitForm.Show(this); ShowContainer("Import Data && Train", ImportData.Instance); waitForm.Close(); }
private void ManageCustomerBtn_Click(object sender, EventArgs e) { var waitForm = new WaitFormFunc(); waitForm.Show(this); Patient.Instance.LoadData(PagingConstant.PageIndex, PagingConstant.PageSize); ShowContainer("Customer Management", Patient.Instance); waitForm.Close(); }
private void btnExec_SpeedControl_Click(object sender, EventArgs e) { for (int i = 0; i < dgvInOutFile_SpeedControl.RowCount; i++) { string input = dgvInOutFile_SpeedControl.Rows[i].Cells[0].Value.ToString(); string output = dgvInOutFile_SpeedControl.Rows[i].Cells[1].Value.ToString(); string videoSpeed = string.Empty; try { if (dgvInOutFile_SpeedControl.Rows[i].Cells[2].Value == null) { MessageBox.Show("bạn chưa chọn tốc tộ mong muốn"); return; } videoSpeed = dgvInOutFile_SpeedControl.Rows[i].Cells[2].Value.ToString(); } catch (Exception ex) { if (ex.Message.Contains("not set")) { MessageBox.Show("bạn chưa chọn tốc tộ mong muốn"); } } string newfieName = Path.GetFileNameWithoutExtension(input) + $"_x{videoSpeed}" + Path.GetExtension(input); if (File.Exists($"{output+newfieName}")) { MessageBox.Show($"File kết quả {output+newfieName} đã tồn tại !"); continue; } if (input == "" || output == "") { continue; } string factSpeed = string.Empty; List <String> temp = new List <string>(); temp.Add(input); temp.Add(output + newfieName); listInOut.Add(temp); factSpeed = (1 / float.Parse(videoSpeed)).ToString(); string command = $"-i {input} -filter:v \"setpts={factSpeed}*PTS\" -filter:a \"atempo={videoSpeed}\" {output}{newfieName}"; WaitFormFunc wf = new WaitFormFunc(); wf.Show(this); RunCMD.Instance.runCMD(command); wf.Close(); dgvInOutFile_SpeedControl.Rows.Remove(dgvInOutFile_SpeedControl.Rows[i]); } }
private void ClassVersionGridView_CellClick(object sender, DataGridViewCellEventArgs e) { var waitForm = new WaitFormFunc(); waitForm.Show(); if (ClassVersionGridView.CurrentRow?.DataBoundItem is ClassVersionModel currentClassVersion) { LoadWeightVersionData(currentClassVersion.Id, _classVersionPageIndex, _classVersionPageSize); } waitForm.Close(); }
private void btnExe_AddingSub_Click(object sender, EventArgs e) { if (txtOutputFilePath_AddingSub.Text == "" || txtInputVideoFilePath_AddingSub.Text == "" || txtInputSubFilePath_AddingSub.Text == "") { MessageBox.Show("phải chọn input và output folder để thực thi tác vụ này !"); return; } string folderOutput = txtOutputFilePath_AddingSub.Text; // filepath video string fileVideoPath = txtInputVideoFilePath_AddingSub.Text; FileInfo fVideoInfor = new FileInfo(fileVideoPath); // lấy đuôi video string fileVideoExtention = fVideoInfor.Extension; // -> string outputFileName = Path.GetFileNameWithoutExtension(fileVideoPath) + "_sub" + fileVideoExtention; // copy file sub vào bebug string fileSubPath = txtInputSubFilePath_AddingSub.Text; string fileSubName = Path.GetFileName(fileSubPath); if (File.Exists("Subtitles2.srt")) { File.Delete("Subtitles2.srt"); } File.Copy(fileSubPath, @"Subtitles2.srt"); //Console.WriteLine(fileSubPath + "----->" + fileSubName); string command = $"-i {fileVideoPath} -vf subtitles=Subtitles2.srt:force_style='Borderstyle=4,Fontsize=16,BackColour=H80000000' {folderOutput}{outputFileName}"; if (File.Exists($"{folderOutput}{outputFileName}")) { MessageBox.Show($"đã tồn tại file {folderOutput}{outputFileName}"); return; } WaitFormFunc wf = new WaitFormFunc(); wf.Show(this); RunCMD.Instance.runCMD(command); wf.Close(); List <string> temp = new List <string>(); temp.Add(fileVideoPath); temp.Add(fileSubPath); temp.Add(folderOutput + outputFileName); listInOut.Add(temp); }
private void SendBtn_Click(object sender, EventArgs e) { try { if (_dataSetService.IsTraining()) { MessageBox.Show(@"Server is training! Please try later."); } else { if (_imageFiles.Any(w => !w.IsLabel)) { MessageBox.Show(@"There is still an image without a label."); } else { var waitForm = new WaitFormFunc(); waitForm.Show(); var isSuccess = _dataSetService.TransferData(_imageFiles, _labelFiles, _isClearData); _isClearData = false; waitForm.Close(); if (isSuccess) { MessageBox.Show(@"Data has been sent successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); _imageFiles.Clear(); _labelFiles.Clear(); BindingData(null, null); TrainBtn.Enabled = true; } else { TrainBtn.Enabled = false; MessageBox.Show(@"Failed to sent data. Please try again later", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception exception) { TrainBtn.Enabled = false; ExceptionLogging.SendErrorToText(exception, nameof(this.SendBtn_Click), nameof(ImportData)); MessageBox.Show(@"Failed to sent data. Please try again later", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnExe_RenderSub_Click(object sender, EventArgs e) { if (txtInputFilePath.Text == "" || txtOutputFilePath.Text == "") { MessageBox.Show("phải chọn input và output folder để thực thi tác vụ này !"); return; } WaitFormFunc wf = new WaitFormFunc(); wf.Show(); VideoController.SubCreate(txtInputFilePath.Text, txtOutputFilePath.Text); File.Copy(@"SubTranslated.srt", sfdChooseOutput_SubAddedVideoCreator.FileName.Replace(Path.GetExtension(sfdChooseOutput_SubAddedVideoCreator.FileName), ".srt")); wf.Close(); }
private void btnExec_GetAuido_Click(object sender, EventArgs e) { string inputFile = txtInputFilePath_GetAudio.Text; string outputFolder = txtOutputFilePath_GetAudio.Text; string outputFileName = Path.GetFileNameWithoutExtension(inputFile); if (txtInputFilePath_GetAudio.Text == "" || txtOutputFilePath_GetAudio.Text == "") { MessageBox.Show("phải chọn input và output folder để thực thi tác vụ này !"); return; } else { if (outputFolder.Contains(" ") || inputFile.Contains(" ")) { MessageBox.Show("Tên file không được phép chứa khoảng trắng"); return; } string command = $"-i {inputFile} -vn -ab 320 {outputFolder}.mp3"; try { WaitFormFunc wf = new WaitFormFunc(); wf.Show(this); RunCMD.Instance.runCMD(command); wf.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } List <string> temp = new List <string>(); temp.Add(txtInputFilePath_GetAudio.Text); temp.Add(txtOutputFilePath_GetAudio.Text + outputFileName + ".mp3"); this.listInOut.Add(temp); }
private void WeightBtn_Click(object sender, EventArgs e) { var waitForm = new WaitFormFunc(); waitForm.Show(this); var classVersionData = _classVersionService.GetAllClassVersion(PagingConstant.PageIndex, PagingConstant.PageSize); var firstClass = classVersionData?.Data?.FirstOrDefault(); PagingModel <WeightVersionModel> weightVersion = null; if (firstClass != null) { weightVersion = _weightService.GetAllWeightByClassId(firstClass.Id, PagingConstant.PageIndex, PagingConstant.PageSize); } Version.Instance.ClassVersions = classVersionData; Version.Instance.WeightVersions = weightVersion; Version.Instance.LoadClassVersionData(PagingConstant.PageIndex, PagingConstant.PageSize, pagingModel: classVersionData); Version.Instance.LoadWeightVersionData(firstClass?.Id, PagingConstant.PageIndex, PagingConstant.PageSize, pagingModel: weightVersion); ShowContainer("Model Management", Version.Instance); waitForm.Close(); }
private void TrainBtn_Click(object sender, EventArgs e) { var ofg = new OpenFileDialog { Filter = @"Configure Files (*.cfg)|*.cfg", Multiselect = false, //InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Title = @"My Configure Browser", RestoreDirectory = true, }; // Allow the user to select multiple images. var dr = ofg.ShowDialog(); if (dr == DialogResult.OK) { if (_dataSetService.IsTraining()) { MessageBox.Show(@"Server is training! Please try later"); } else { var waitForm = new WaitFormFunc(); waitForm.Show(); var isSuccess = _dataSetService.TrainData(ofg.FileName); waitForm.Close(); if (isSuccess) { MessageBox.Show(@"The system is processing. Please wait for the notification.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(@"An error occurred while training. Please try again later", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private async void Login() { var email = EmailTextBox.Text; var pass = PasswordTextBox.Text; string mess = null; if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(pass)) { mess = @"Please enter your email and password"; } else { //this.Visible = false; //Loading _load = new Loading(); //_load.Show(); var waitForm = new WaitFormFunc(); waitForm.Show(this); var auth = new FirebaseAuthProvider(new FirebaseConfig(apiKey)); try { var ab = await auth.SignInWithEmailAndPasswordAsync(email, pass); var user = ab.User; //var user = 0; if (user != null) { var authService = new AuthenticationService(); //var userLogin = authService.GetToken(user.LocalId); var userLogin = authService.GetToken(user.LocalId); if (userLogin != null) { if (string.IsNullOrEmpty(userLogin.ErrorMessage)) { UserLoginModel.AccessToken = userLogin.AccessToken; UserLoginModel.User = userLogin.User; if (RememberCheckbox.Checked) { Properties.Settings.Default.Username = email; Properties.Settings.Default.Password = pass; Properties.Settings.Default.Save(); } else { Properties.Settings.Default.Username = null; Properties.Settings.Default.Password = null; Properties.Settings.Default.Save(); } } else { var isAdmin = userLogin.User.Role == 2; mess = !isAdmin ? @"You don't have permission." : userLogin.ErrorMessage; } } else { mess = @"Can't login. Try again later."; } } } catch (Exception e) { mess = @"Invalid Email or password"; } waitForm.Close(); } if (!string.IsNullOrEmpty(mess)) { MessageBox.Show(mess, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.DialogResult = DialogResult.OK; this.Close(); } }