예제 #1
0
파일: AddCommand.cs 프로젝트: Abbas1546/WPF
        /// <summary>
        /// Validates the specified s.
        /// </summary>
        /// <param name="s">The s.</param>
        /// <param name="args">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        /// <returns></returns>
        private static ProductDetails Validate(object s, RoutedEventArgs args)
        {
            ManipulatorViewModel viewModel = new ManipulatorViewModel(new ProductDetails(), false);
            ManipulatorView      addView   = new ManipulatorView(viewModel);

            addView.Owner = Application.Current.MainWindow;

            if ((bool)addView.ShowDialog())
            {
                return(viewModel.ProductInfo);
            }
            return(null);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ManipulatorView"/> class.
 /// </summary>
 /// <param name="viewModel">The view model.</param>
 public ManipulatorView(ManipulatorViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }