Пример #1
0
        public FolderSchemaViewModel(
            Models.MainSettings mainSettings,
            Models.FolderSchema schema,
            FolderSchemaViewModel parent,
            String log)
        {
            _log          = log;
            _mainSettings = mainSettings;

            _schema       = new Models.XmlAnything <Models.ISchema>();
            _schema.Value = schema;
            _parent       = parent;

            _schemasViewModels = new ObservableCollection <ISchemaViewModel>();
            foreach (Models.XmlAnything <Models.ISchema> xmlChild in (_schema.Value as Models.FolderSchema).Children)
            {
                if (typeof(Models.FolderSchema) == xmlChild.Value.GetType())
                {
                    _schemasViewModels.Add(
                        new FolderSchemaViewModel(
                            mainSettings,
                            xmlChild.Value as Models.FolderSchema,
                            this,
                            log
                            )
                        );
                }
                if (typeof(Models.FileSchema) == xmlChild.Value.GetType())
                {
                    _schemasViewModels.Add(
                        new FileSchemaViewModel(
                            _mainSettings,
                            xmlChild.Value as Models.FileSchema,
                            this,
                            log
                            )
                        );
                }
            }

            AddDataCommand         = new Commands.AddDataCommand(this);
            RemoveDataCommand      = new Commands.RemoveDataCommand(this);
            AddFileSchemaCommand   = new Commands.AddFileSchemaCommand(this);
            AddFolderSchemaCommand = new Commands.AddFolderSchemaCommand(this);
            RemoveSchemaCommand    = new Commands.RemoveSchemaCommand(this);
        }
        public FileSchemaViewModel(
            Models.MainSettings mainSettings,
            Models.FileSchema schema,
            FolderSchemaViewModel parent,
            String log)
        {
            _log          = log;
            _mainSettings = mainSettings;

            _schema       = new Models.XmlAnything <Models.ISchema>();
            _schema.Value = schema;
            _parent       = parent;

            _engine = new Models.AutoDossierEngine(_mainSettings, schema, parent, _log);

            AddDataCommand     = new Commands.AddDataCommand(this);
            RemoveDataCommand  = new Commands.RemoveDataCommand(this);
            EngineOnOffCommand = new Commands.EngineOnOffCommand(this);
        }
Пример #3
0
        public SettingsViewModel(Models.MainSettings mainSettings, Models.FolderSchema mvp, String log)
        {
            _log                  = log;
            _mainSettings         = mainSettings;
            _arborescence         = mvp;
            _arborescenceModified = new Models.FolderSchema();
            _arborescenceModified.Copy(_arborescence);
            _arborescenceViewModel = new FolderSchemaViewModel(_mainSettings, _arborescenceModified, null, _log);

            _pages = new ObservableCollection <Page> {
                new Views.Pages.GeneralSettings {
                    DataContext = this, Title = "General"
                },
                new Views.Pages.DatasPage {
                    DataContext = this, Title = "Schema"
                }
            };
            ChangesCommand = new Commands.ChangesCommand(this);
        }
        public MainViewModel()
        {
            _log          = "";
            _mainSettings = new Models.MainSettings()
            {
                ScanFolder = "C:\\Users\\MinMatth-Magi\\Desktop\\Input", ScanFile = "Fichier"
            };
            try {
                XmlSerializer xs = new XmlSerializer(typeof(Models.FolderSchema));
                using (StreamReader rd = new StreamReader("Resources/Settings/arborescence.xml")) {
                    _arborescence = xs.Deserialize(rd) as Models.FolderSchema;
                }
            } catch (Exception) {
                _arborescence = new Models.FolderSchema();
            }
            _settingsViewModel = _settingsViewModel = new SettingsViewModel(_mainSettings, _arborescence, _log);
            _errorCodes        = new ObservableCollection <Enums.ErrorCode> {
                Enums.ErrorCode.NO_ERROR
            };
            _arborescenceViewModel = new FolderSchemaViewModel(_mainSettings, _arborescence, null, _log);

            OpenWindowCommand = new Commands.OpenWindowCommand(Commands.OpenWindowCommand.WindowType.SETTINGS, _settingsViewModel);
            DummyDebugCommand = new Commands.DummyDebugCommand(this);
        }