Пример #1
0
        void UpdateStatistics(DataView dv)
        {
            DataView curdv = ((DataViewDisplay)dataBook.CurrentPageWidget).View;

            if (curdv != dv)
            {
                return;
            }
            StatisticsInfo si = (info[dv] as StatisticsInfo);

            if (si.Changed == true)
            {
                ByteBuffer bb = dv.Buffer;

                for (int i = 0; i < si.Freqs.Length; i++)
                {
                    si.Freqs[i] = 0;
                }

                for (int i = 0; i < bb.Size; i++)
                {
                    ++si.Freqs[bb[i]];
                }

                si.Changed = false;
            }

            sdw.Update(si.Freqs);
        }
Пример #2
0
        void OnBufferChanged(DataView dv)
        {
            if (info.Contains(dv))
            {
                (info[dv] as StatisticsInfo).Changed = true;
            }
            else
            {
                StatisticsInfo si = new StatisticsInfo();
                info[dv] = si;
            }

            UpdateStatistics(dv);
        }
Пример #3
0
        void OnSwitchPage(object o, SwitchPageArgs args)
        {
            DataView dv = ((DataViewDisplay)dataBook.GetNthPage((int)args.PageNum)).View;

            if (dv == null)
            {
                return;
            }
            if (!info.Contains(dv))
            {
                info[dv] = new StatisticsInfo();
            }

            UpdateStatistics(dv);
        }
Пример #4
0
 void OnDataViewAdded(DataView dv)
 {
     dv.Buffer.Changed += new ByteBuffer.ChangedHandler(OnBufferContentsChanged);
     dv.BufferChanged  += new DataView.DataViewEventHandler(OnBufferChanged);
     info[dv]           = new StatisticsInfo();
 }