| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- using MuchInfo.Chart.Data.Interfaces;
- using MuchInfo.Chart.WPF.Helpers;
- using MuchInfo.Chart.WPF.Primitives.Interfaces;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.CompilerServices;
- using System.Threading;
- namespace MuchInfo.Chart.WPF.Primitives
- {
- public class OutputDataWrapper : ILineDataSetWithUid, IDeletable
- {
- private static List<WeakReference> OutputDataWrapper_503 = new List<WeakReference>();
- private ILineDataSet OutputDataWrapper_504;
- /// <summary>
- /// NewGuid
- /// </summary>
- private Guid OutputDataWrapper_505;
- private LineDataSetDataChangedEventHandler OutputDataWrapper_506;
- public event LineDataSetDataChangedEventHandler DataChanged
- {
- add
- {
- this.OutputDataWrapper_506 = (LineDataSetDataChangedEventHandler)Delegate.Combine(this.OutputDataWrapper_506, value);
- }
- remove
- {
- this.OutputDataWrapper_506 = (LineDataSetDataChangedEventHandler)Delegate.Remove(this.OutputDataWrapper_506, value);
- }
- }
- public virtual ILineDataSet mDat
- {
- get
- {
- return this.OutputDataWrapper_504;
- }
- [MethodImpl(32)]
- set
- {
- LineDataSetDataChangedEventHandler dataChangedEventHandler = new LineDataSetDataChangedEventHandler(this.OutputDataWrapper_2184);
- bool flag = this.OutputDataWrapper_504 != null;
- if (flag)
- {
- this.OutputDataWrapper_504.DataChanged -= (dataChangedEventHandler);
- }
- this.OutputDataWrapper_504 = value;
- flag = (this.OutputDataWrapper_504 != null);
- if (flag)
- {
- this.OutputDataWrapper_504.DataChanged += (dataChangedEventHandler);
- }
- }
- }
- internal Guid DataGUID
- {
- get
- {
- return this.OutputDataWrapper_505;
- }
- set
- {
- this.OutputDataWrapper_505 = value;
- }
- }
- [DebuggerNonUserCode]
- private static void OutputDataWrapper_2173(object value)
- {
- List<WeakReference> outputDataWrapper_ = OutputDataWrapper.OutputDataWrapper_503;
- Monitor.Enter(outputDataWrapper_);
- checked
- {
- try
- {
- bool flag = OutputDataWrapper.OutputDataWrapper_503.Count == OutputDataWrapper.OutputDataWrapper_503.Capacity;
- if (flag)
- {
- int num = 0;
- int arg_51_0 = 0;
- int num2 = OutputDataWrapper.OutputDataWrapper_503.Count - 1;
- int num3 = arg_51_0;
- while (true)
- {
- int arg_A2_0 = num3;
- int num4 = num2;
- if (arg_A2_0 > num4)
- {
- break;
- }
- WeakReference weakReference = OutputDataWrapper.OutputDataWrapper_503[num3];
- flag = weakReference.IsAlive;
- if (flag)
- {
- bool flag2 = num3 != num;
- if (flag2)
- {
- OutputDataWrapper.OutputDataWrapper_503[num] = (OutputDataWrapper.OutputDataWrapper_503[num3]);
- }
- num++;
- }
- num3++;
- }
- OutputDataWrapper.OutputDataWrapper_503.RemoveRange(num, OutputDataWrapper.OutputDataWrapper_503.Count - num);
- OutputDataWrapper.OutputDataWrapper_503.Capacity = (OutputDataWrapper.OutputDataWrapper_503.Count);
- }
- OutputDataWrapper.OutputDataWrapper_503.Add(new WeakReference(RuntimeHelpers.GetObjectValue(value)));
- }
- finally
- {
- Monitor.Exit(outputDataWrapper_);
- }
- }
- }
- public OutputDataWrapper()
- {
- OutputDataWrapper.OutputDataWrapper_2173(this);
- this.OutputDataWrapper_505 = Guid.NewGuid();
- }
- internal void OutputDataWrapper_2177(ILineDataSet dat)
- {
- this.mDat = dat;
- LineDataSetDataChangedEventHandler outputDataWrapper_ = this.OutputDataWrapper_506;
- bool flag = outputDataWrapper_ != null;
- if (flag)
- {
- outputDataWrapper_(null);
- }
- }
- /// <summary>
- /// 返回mDat
- /// </summary>
- /// <returns></returns>
- internal ILineDataSet OutputDataWrapper_2180()
- {
- return this.mDat;
- }
- public List<ILineDataPoint> Data()
- {
- bool flag = this.mDat != null;
- List<ILineDataPoint> result;
- if (flag)
- {
- result = this.mDat.DataPoints;
- }
- else
- {
- result = null;
- }
- return result;
- }
- private void OutputDataWrapper_2184(object Change)
- {
- LineDataSetDataChangedEventHandler outputDataWrapper_ = this.OutputDataWrapper_506;
- bool flag = outputDataWrapper_ != null;
- if (flag)
- {
- outputDataWrapper_(null);
- }
- }
- internal void OutputDataWrapper_2185()
- {
- LineDataSetDataChangedEventHandler outputDataWrapper_ = this.OutputDataWrapper_506;
- bool flag = outputDataWrapper_ != null;
- if (flag)
- {
- outputDataWrapper_(new PlotDeletingDataChange());
- }
- }
- public string UID()
- {
- return this.OutputDataWrapper_505.ToString();
- }
- public void OnDelete()
- {
- this.mDat = null;
- }
- string ILineDataSetWithUid.UID()
- {
- throw new NotImplementedException();
- }
- event LineDataSetDataChangedEventHandler ILineDataSet.DataChanged
- {
- add { throw new NotImplementedException(); }
- remove { throw new NotImplementedException(); }
- }
- List<ILineDataPoint> ILineDataSet.DataPoints
- {
- get
- {
- return Data();
- }
- set
- {
- this.mDat.DataPoints = value;
- }
- }
- void IDeletable.OnDelete()
- {
- throw new NotImplementedException();
- }
- }
- }
|