<commit_before>﻿using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Microsoft.VisualStudio.R.Package.Plots.Definitions;
using Microsoft.VisualStudio.R.Package.Shell;

namespace Microsoft.VisualStudio.R.Package.Plots {
    [Export(typeof(IPlotHistory))]
    internal sealed class PlotHistory : IPlotHistory {

        public PlotHistory() {
            PlotContentProvider = new PlotContentProvider();
            PlotContentProvider.PlotChanged += OnPlotChanged;
        }

        #region IPlotHistory
        public int ActivePlotIndex { get; private set; }
        public int PlotCount { get; private set; }
        public IPlotContentProvider PlotContentProvider { get; private set; }

        public async Task RefreshHistoryInfo() {
            var info = await PlotContentProvider.GetHistoryInfoAsync();
            ActivePlotIndex = info.ActivePlotIndex;
            PlotCount = info.PlotCount;

            VsAppShell.Current.DispatchOnUIThread(() => {
                HistoryChanged?.Invoke(this, EventArgs.Empty);
            });
        }

        public event EventHandler HistoryChanged;<commit_msg>Init index to -1<commit_after>﻿using System;
using System.ComponentModel.Composition;
using System.Threading.Tasks;
using Microsoft.VisualStudio.R.Package.Plots.Definitions;
using Microsoft.VisualStudio.R.Package.Shell;

namespace Microsoft.VisualStudio.R.Package.Plots {
    [Export(typeof(IPlotHistory))]
    internal sealed class PlotHistory : IPlotHistory {

        public PlotHistory() {
            ActivePlotIndex = -1;
            PlotContentProvider = new PlotContentProvider();
            PlotContentProvider.PlotChanged += OnPlotChanged;
        }

        #region IPlotHistory
        public int ActivePlotIndex { get; private set; }
        public int PlotCount { get; private set; }
        public IPlotContentProvider PlotContentProvider { get; private set; }

        public async Task RefreshHistoryInfo() {
            var info = await PlotContentProvider.GetHistoryInfoAsync();
            ActivePlotIndex = info.ActivePlotIndex;
            PlotCount = info.PlotCount;

            VsAppShell.Current.DispatchOnUIThread(() => {
                HistoryChanged?.Invoke(this, EventArgs.Empty);
            });
        }

        public event EventHandler HistoryChanged;
{'fraction_non_alphanumeric': 0.08201623237932508, 'fraction_numerical': 0.0008543357539513029, 'mean_word_length': 2.8330605564648117, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6597492', 'n_tokens_mistral': 609, 'n_tokens_neox': 564, 'n_words': 132}