// // Copyright 2014 Perforce Software Inc. // using System.Windows; using System.Windows.Forms; namespace Perforce.View { /// /// Interaction logic for ChooseApplicationForm.xaml /// public partial class ChooseApplicationForm : System.Windows.Controls.UserControl { public ChooseApplicationForm() { InitializeComponent(); } private void BrowseButton_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Choose Application..."; ofd.DefaultExt = ".exe"; ofd.Filter = "Application Files (*.exe)|*.exe"; ofd.Multiselect = false; ofd.ShowDialog(); Executable.Text = ofd.FileName; CheckFields(); } public Technewlogic.WpfDialogManagement.Contracts.ICustomContentDialog ParentDialog { get; set; } private void Textfield_KeyUp(object sender, System.Windows.Input.KeyEventArgs e) { CheckFields(); } private void CheckFields() { if (Executable.Text.Trim().Length > 0) { ParentDialog.CanOk = true; } else { ParentDialog.CanOk = false; } } } }