private void btnTargetControl_Click(object sender, RoutedEventArgs e) { WpfCustomFileDialog.SaveFileDialog <TargetControl> sfd = new WpfCustomFileDialog.SaveFileDialog <TargetControl>(); sfd.ValidateNames = true; sfd.FileDlgStartLocation = AddonWindowLocation.Bottom; sfd.Title = "Save as using a Control"; sfd.Filter = "wmv files (*.wmv)|*.wmv|avi files (*.avi)|*.avi|wma files (*.wma)|*.wma|All files (*.*)|*.*"; sfd.CheckPathExists = true; if (File.Exists(txtSourceCtrl.Text)) { sfd.FileName = System.IO.Path.GetFileNameWithoutExtension(this.txtSourceCtrl.Text) + "_converted"; } sfd.SetPlaces(new object[] { @"c:\", (int)Places.MyComputer, (int)Places.Favorites, (int)Places.All_Users_MyVideo, (int)Places.MyVideos }); bool?res = sfd.ShowDialog(); if (res.Value == true) { _encodeInfo = (sfd.ChildWnd as TargetControl).EncodeInfo; _encodeInfo.Destination = this.txtDestCtrl.Text = sfd.FileName; } }
void CreateEncodeInfo(object sender, System.ComponentModel.CancelEventArgs e) { _encodeInfo = new strucEncodeInfo(); try { _encodeInfo.Profile = ProfileFile.Text; if (ComboBox_PreProc.Text == "Standard") { _encodeInfo.Preproc = optSTANDARD; } else if (ComboBox_PreProc.Text == "Deinterlace") { _encodeInfo.Preproc = optDEINTERLACE; } else if (ComboBox_PreProc.Text == "Inverse Telecine Auto") { _encodeInfo.Preproc = optTELECINE_AUTO; } else if (ComboBox_PreProc.Text == "Inverse Telecine AA Top") { _encodeInfo.Preproc = optTELECINE_AA_TOP; } else if (ComboBox_PreProc.Text == "Inverse Telecine BB Top") { _encodeInfo.Preproc = optTELECINE_BB_TOP; } else if (ComboBox_PreProc.Text == "Inverse Telecine BC Top") { _encodeInfo.Preproc = optTELECINE_BC_TOP; } else if (ComboBox_PreProc.Text == "Inverse Telecine CD Top") { _encodeInfo.Preproc = optTELECINE_CD_TOP; } else if (ComboBox_PreProc.Text == "Inverse Telecine DD Top") { _encodeInfo.Preproc = optTELECINE_DD_TOP; } else if (ComboBox_PreProc.Text == "Inverse Telecine AA Bottom") { _encodeInfo.Preproc = optTELECINE_AA_BOTTOM; } else if (ComboBox_PreProc.Text == "Inverse Telecine BB Bottom") { _encodeInfo.Preproc = optTELECINE_BB_BOTTOM; } else if (ComboBox_PreProc.Text == "Inverse Telecine BC Bottom") { _encodeInfo.Preproc = optTELECINE_BC_BOTTOM; } else if (ComboBox_PreProc.Text == "Inverse Telecine CD Bottom") { _encodeInfo.Preproc = optTELECINE_CD_BOTTOM; } else if (ComboBox_PreProc.Text == "Inverse Telecine DD Bottom") { _encodeInfo.Preproc = optTELECINE_DD_BOTTOM; } else if (ComboBox_PreProc.Text == "Process Interlaced Auto") { _encodeInfo.Preproc = optINTERLACED_AUTO; } else if (ComboBox_PreProc.Text == "Process Interlaced Top First") { _encodeInfo.Preproc = optINTERLACED_TOP_FIRST; } else if (ComboBox_PreProc.Text == "Process Interlaced Bottom First") { _encodeInfo.Preproc = optINTERLACED_BOTTOM_FIRST; } _encodeInfo.DRMProfile = ComboBox_DRMProfile.Text; if (ComboBox_DRMProfile.Text.Length == 0) { _encodeInfo.DRMProfile = "None"; } _encodeInfo.Crop = CheckBox_Crop.IsChecked == true; _encodeInfo.CropTop = (Text_Top.Text.Length == 0) ? 0 : long.Parse(Text_Top.Text); _encodeInfo.CropLeft = (Text_Left.Text.Length == 0) ? 0 : long.Parse(Text_Left.Text); _encodeInfo.CropRight = (Text_Right.Text.Length == 0) ? 0 : long.Parse(Text_Right.Text); _encodeInfo.CropBottom = (Text_Bottom.Text.Length == 0) ? 0 : long.Parse(Text_Bottom.Text); _encodeInfo.TwoPass = CheckBox_TwoPass.IsChecked.Value; _encodeInfo.Title = TextBox_Title.Text; _encodeInfo.Description = TextBox_Description.Text; _encodeInfo.Author = TextBox_Author.Text; _encodeInfo.Copyright = TextBox_Copyright.Text; } catch (Exception ex) { MessageBox.Show(this, ex.Message, "error in the encoder parameters", MessageBoxButton.OK, MessageBoxImage.Stop); e.Cancel = true; } }