示例#1
0
        private void DeserializeSchemsHistory()
        {
            using (var streamReader = new StreamReader(Path.Combine(HistoryDataPath, HistoryCacheFile)))
            {
                var xmlSerializer = new XmlSerializer(typeof(Histories));
                var histories     = xmlSerializer.Deserialize(streamReader) as Histories;

                if (histories == null)
                {
                    throw new InvalidOperationException("The History Chace File Is Corrupted. It was deleted!");
                }

                Schemes.Clear();
                History.Clear();
                foreach (var history in histories.AllHistories)
                {
                    var scheme = SchemeCache.ByTitle(history.Scheme.Title);

                    // Is this update necessary? Maybe the scheme was changed and so the history gets updated?
                    history.Scheme = scheme;

                    Schemes.Add(history.Scheme, history);
                    History.Add(history);
                }
            }
        }
        public SchemeHistory(SchemeCache schemeCache)
        {
            SchemeCache = schemeCache;

            Schemes = new Dictionary<Scheme, History>();
            History = new ObservableCollection<History>();

            HistoryDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                Path.Combine("Twainsoft", "StudioStyler"));

            HistoryCacheFile = "SchemesHistory.xml";
        }
示例#3
0
        public SchemeHistory(SchemeCache schemeCache)
        {
            SchemeCache = schemeCache;

            Schemes = new Dictionary <Scheme, History>();
            History = new ObservableCollection <History>();

            HistoryDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                           Path.Combine("Twainsoft", "StudioStyler"));

            HistoryCacheFile = "SchemesHistory.xml";
        }
        public SchemeModel(SchemeCache schemeCache, SchemeHistory schemesHistory, OptionsStore optionsStore,
            StudioStylesService studioStylesService, SettingsActivator settingsActivator)
        {
            SchemeCache = schemeCache;
            SchemesHistory = schemesHistory;
            OptionsStore = optionsStore;
            StudioStylesService = studioStylesService;
            SettingsActivator = settingsActivator;

            var stylesPerPage = optionsStore.StylesPerPage;

            PagedSchemesView = new PagedCollectionView(SchemeCache.Schemes) { PageSize = stylesPerPage };
            PagedSchemesView.SortDescriptions.Add(new SortDescription("Rating", ListSortDirection.Descending));

            CurrentSearchString = "";
            SearchValues = new List<string>();
        }