コード例 #1
0
        void ISaveState.Load(string filename)
        {
            filename = filename + ".serverTimings";
            if (!File.Exists(filename))
            {
                return;
            }

            _eventAggregator.PublishOnUIThread(new ShowTraceWindowEvent(this));
            string data = File.ReadAllText(filename);

            var eventConverter     = new ServerTimingConverter();
            var deseralizeSettings = new JsonSerializerSettings();

            deseralizeSettings.Converters.Add(eventConverter);
            deseralizeSettings.TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple;
            deseralizeSettings.TypeNameHandling = TypeNameHandling.Auto;

            ServerTimesModel m = JsonConvert.DeserializeObject <ServerTimesModel>(data, deseralizeSettings);

            FormulaEngineDuration   = m.FormulaEngineDuration;
            StorageEngineDuration   = m.StorageEngineDuration;
            StorageEngineCpu        = m.StorageEngineCpu;
            TotalDuration           = m.TotalDuration;
            VertipaqCacheMatches    = m.VertipaqCacheMatches;
            StorageEngineQueryCount = m.StorageEngineQueryCount;
            TotalCpuDuration        = m.TotalCpuDuration;

            this._storageEngineEvents.Clear();
            this._storageEngineEvents.AddRange(m.StoreageEngineEvents);
            NotifyOfPropertyChange(() => StorageEngineEvents);
        }
コード例 #2
0
        void ISaveState.Save(string filename)
        {
            var m = new ServerTimesModel()
            {
                FormulaEngineDuration   = this.FormulaEngineDuration,
                StorageEngineDuration   = this.StorageEngineDuration,
                StorageEngineCpu        = this.StorageEngineCpu,
                TotalDuration           = this.TotalDuration,
                VertipaqCacheMatches    = this.VertipaqCacheMatches,
                StorageEngineQueryCount = this.StorageEngineQueryCount,
                StoreageEngineEvents    = this._storageEngineEvents,
                TotalCpuDuration        = this.TotalCpuDuration
            };
            var json = JsonConvert.SerializeObject(m, Formatting.Indented);

            File.WriteAllText(filename + ".serverTimings", json);
        }
コード例 #3
0
        private string GetJsonString()
        {
            var m = new ServerTimesModel()
            {
                FormulaEngineDuration   = this.FormulaEngineDuration,
                StorageEngineDuration   = this.StorageEngineDuration,
                StorageEngineCpu        = this.StorageEngineCpu,
                TotalDuration           = this.TotalDuration,
                VertipaqCacheMatches    = this.VertipaqCacheMatches,
                StorageEngineQueryCount = this.StorageEngineQueryCount,
                StoreageEngineEvents    = this._storageEngineEvents,
                TotalCpuDuration        = this.TotalCpuDuration
            };
            var json = JsonConvert.SerializeObject(m, Formatting.Indented);

            return(json);
        }
コード例 #4
0
        void ISaveState.Load(string filename)
        {
            filename = filename + ".serverTimings";
            if (!File.Exists(filename))
            {
                return;
            }

            this.IsChecked = true;
            string           data = File.ReadAllText(filename);
            ServerTimesModel m    = JsonConvert.DeserializeObject <ServerTimesModel>(data);

            FormulaEngineDuration   = m.FormulaEngineDuration;
            StorageEngineDuration   = m.StorageEngineDuration;
            StorageEngineCpu        = m.StorageEngineCpu;
            TotalDuration           = m.TotalDuration;
            VertipaqCacheMatches    = m.VertipaqCacheMatches;
            StorageEngineQueryCount = m.StorageEngineQueryCount;
            TotalCpuDuration        = m.TotalCpuDuration;

            this._storageEngineEvents.Clear();
            this._storageEngineEvents.AddRange(m.StoreageEngineEvents);
            NotifyOfPropertyChange(() => StorageEngineEvents);
        }