Exemplo n.º 1
0
        /// <summary>
        /// DispatcherTimerで実行するポイント追加メソッド
        /// UIスレッドで実行される
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MovingPoint(object sender, EventArgs e)
        {
            double mag = 50.0 + 40.0 * Math.Sin(ang2);
            double ang = ang1;
            var    p   = new ScatterPoint(mag, ang);

            ScatterPointsLive.Add(p);
            ang1 += dA1;
            ang2 += dA2;

            frameCount++;
            if (watch.ElapsedMilliseconds > 1000 && frameCount > 1)
            {
                PointAddRate = string.Format("PointAddRate {0:#.}", this.frameCount / (this.watch.ElapsedMilliseconds * 0.001));
                frameCount   = 0;
                watch.Restart();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// UIスレッド以外からポイントを追加する時に使用(Dispatcher.BeginInvokeを使用)
 /// </summary>
 /// <param name="sp"></param>
 public void SetScatterPoint(ScatterPoint sp)
 {
     System.Windows.Application.Current.Dispatcher.BeginInvoke(
         new Action(() => ScatterPointsLive.Add(sp)));
 }