Exemple #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);
        }
Exemple #2
0
 public void AddSchema(string mode, ObservableCollection <Models.XmlAnything <Models.ISchema> > schemaList)
 {
     if ("file" == mode)
     {
         FileSchemaViewModel newSchema = new FileSchemaViewModel(_mainSettings, new Models.FileSchema(), this, _log);
         Models.XmlAnything <Models.ISchema> xmlAnything = new Models.XmlAnything <Models.ISchema>();
         xmlAnything.Value = newSchema.Schema;
         ChildrenViewModels.Add(newSchema);
         schemaList.Add(xmlAnything);
     }
     if ("folder" == mode)
     {
         FolderSchemaViewModel newSchema = new FolderSchemaViewModel(_mainSettings, new Models.FolderSchema(), this, _log);
         Models.XmlAnything <Models.ISchema> xmlAnything = new Models.XmlAnything <Models.ISchema>();
         xmlAnything.Value = newSchema.Schema;
         ChildrenViewModels.Add(newSchema);
         schemaList.Add(xmlAnything);
     }
 }
        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);
        }