Example #1
0
        internal void Setup(MimeModule mimes)
        {
            base.Setup();

            TagsFilterSelections = new List <TypedItem>(Enumerable.Range(1, 15).Select(i => new TypedItem(i.ToString(), i)).Reverse());

            if (model.Queries == null || model.Queries.Count == 0)
            {
                model.Queries = new List <Query>().Default(Settings.Settings.Domains);
            }
            AllQueries = new ObservableCollection <QueryViewModel>(from x in model.Queries select new QueryViewModel(x));

            Mimes = mimes.Items;
            Paths.Build(Settings, model.Items);
            ApplyPreferences();

            if (Indexer != null &&
                !Indexer.IsInitialized)
            {
                Indexer.Index(model.Items);
            }

            Resolver.Load(model.Items);

            if (UserPreferences.TryGet <string>(ModuleKey, "recent-tags", out string recentTags))
            {
                var tags = recentTags.Split(new char[] { ';', '|' }, StringSplitOptions.RemoveEmptyEntries);
                Resolver.SetRecentTags(tags);
            }
        }
Example #2
0
        public WorkspaceViewModel(Workspace model)
        {
            // first time setting we don't want
            // 'setup lazy loaded modules to fire
            _DataServiceStrategy = model.DataServiceStrategy;

            DataServices.Add(new XmlDataService());
            DataServices.Add(new JsonDataService());

            var found = DataServices.FirstOrDefault(x => x.Key.Equals(model.DataServiceStrategy));

            if (found != null)
            {
                _DataService = found;
            }

            Overlay.RegisterOverlay(AppConstants.OverlayContent, ShowContentOverlay);
            Settings = new SettingsModule(DataService);
            Settings.Setup();

            Tasks = new TasksModule(DataService, Settings);
            Tasks.Setup();

            Paths = new VirtualPathModule(DataService);
            Paths.Setup();

            Mimes = new MimeModule(DataService);
            Mimes.Setup();

            Indexer = new IndexerModule(DataService, Settings);
            Indexer.Setup();

            Schema = new SchemaModule(DataService, Settings);
            Schema.Setup();

            Content = new ContentModule(DataService, Settings, Indexer, Paths, Schema);
            Content.Setup(Mimes);

            Credentials = new CredentialsModule(DataService)
            {
            };
            Credentials.Setup();

            Rolodex = new RolodexModule(DataService);
            Rolodex.Setup();

            Datatool = new DatatoolModule(DataService);
            Datatool.Setup();

            Workflow = new WorkflowModule();
        }