Пример #1
0
        public MainViewModel()
        {
            mainModel = new MainModel();
              mainModel.SendMessage += mainModel_MessageSend;

              defaultPath = Environment.CurrentDirectory;

              FindCommand = new RelayCommand(param => Find(param));
              BuildCommand = new RelayCommand(param => Build(),
            delegate
            {
              return !string.IsNullOrWhiteSpace(CurrentWixout) && !string.IsNullOrWhiteSpace(CurrentXml)
            && !string.IsNullOrWhiteSpace(NewWixout) && !string.IsNullOrWhiteSpace(NewXml);
            });
              SelectDirectoryCommand = new RelayCommand(param => SelectDirectory());
        }
Пример #2
0
        public MainViewModel()
        {
            model = new MainModel();
              model.PropertyChanged += (@this, property) =>
              {
            // Если изменилось свойство "Product", то сигнализируем об изменении всех свойств.
            switch (property.PropertyName)
            {
              case "Product":
            NotifyPropertyChanged(null);
            break;
              default:
            NotifyPropertyChanged(property.PropertyName);
            break;
            }
              };

              defaultPath = Environment.CurrentDirectory;

              isEnabledControls = true;
              Predicate<object> checkIsEnabledControls = delegate { return isEnabledControls; };

              CloseCommand = new RelayCommand(param => CloseApplication(), checkIsEnabledControls);
              FindCommand = new RelayCommand(param => Find(param), checkIsEnabledControls);
              CreateCommand = new RelayCommand(param => CreateProduct(), checkIsEnabledControls);
              OpenCommand = new RelayCommand(param => OpenProduct(), checkIsEnabledControls);
              SaveCommand = new RelayCommand(param => SaveProduct(), checkIsEnabledControls);
              BuildCommand = new RelayCommand(param => Build(), checkIsEnabledControls);

              model.CreateProduct();
        }