Beispiel #1
0
        public void Process()
        {
            if (!_productNumber.validateProductNumber())
            {
                MessageBox.Show("Invalid Product number.", "Invalid Entry", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            else if (!BomSelectionModel.HasSelectedItem())
            {
                MessageBox.Show("No BOM is selected.", "Invalid Entry", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            try {
                ConfigurationManager.RefreshSection("applicationConfiguration");

                BomFormat bomFormat = new BomFormat(_container.GetInstance <IFormatterConfiguration>(), BomSelectionModel.SelectedItem.Key, _productNumber);

                bomFormat.FormatBom();

                ProductNumber = "";
            } catch (Exception e) {
                MessageBox.Show("Error:\n\n" + ErrorFormating.FormatException(e), "Error Occured", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #2
0
        public BomFormatFormViewModel(IWindowManager windowManager, SimpleContainer container, IFactory <PopUpViewModel> popUpViewFactory)
        {
            this._windowManager    = windowManager;
            this._container        = container;
            _popUpViewModelFactory = popUpViewFactory;

            IFormatterConfiguration config = _container.GetInstance <IFormatterConfiguration>();

            _productNumber    = new ProductNumberModel(config);
            BomSelectionModel = new BomSelectionModel(config);

            Activated += (object sender, ActivationEventArgs e) => {
                IFormatterConfiguration configuration = _container.GetInstance <IFormatterConfiguration>();
                if (configuration.FileConfiguration.RootDirectory.Length == 0)
                {
                    FolderSelect();
                }
            };
        }