using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.ComponentModel; using System.Windows.Input; using System.Windows.Documents; using System.Threading; using System.Diagnostics; using System.Collections.ObjectModel; using System.IO; using GummingCommon; using System.Reflection; namespace Gumming { public class InputViewModule : ViewModelBase { #region base parameters public InputView View { get; set; } public bool IsConfirm { get; set; } #endregion #region constructor public InputViewModule(bool canCreateNewTargetField = true) { View = new InputView(); View.DataContext = this; InitializeCommands(); InitializeParameters(); } public void ShowDialog() { IsConfirm = false; View.ShowDialog(); } private void InitializeCommands() { CancelCommand = new DelegateCommand(OnCancelCommand); SaveCommand = new DelegateCommand(OnSaveCommand); } public override void InitializeParameters(object content = null) { WindowTitle = ""; } ~InputViewModule() { } #endregion #region Binding Properties public string WindowTitle { get; private set; } private string _InputText; public string InputText { get { return _InputText; } set { _InputText = value; OnPropertyChanged("InputText"); } } private string _InputTitle; public string InputTitle { get { return _InputTitle; } set { _InputTitle = value; OnPropertyChanged("InputTitle"); } } #endregion #region Binding Commands private ICommand _CancelCommand; public ICommand CancelCommand { get { return _CancelCommand; } set { _CancelCommand = value; OnPropertyChanged("CancelCommand"); } } private ICommand _SaveCommand; public ICommand SaveCommand { get { return _SaveCommand; } set { _SaveCommand = value; OnPropertyChanged("SaveCommand"); } } #endregion #region Private Methods private void OnCancelCommand(object sender) { View.DialogResult = true; } private void OnSaveCommand(object sender) { IsConfirm = true; View.DialogResult = true; } #endregion } }