コード例 #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);
                }
            }
        }
コード例 #2
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";
        }
コード例 #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";
        }
コード例 #4
0
        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>();
        }