Window4.xaml.cs 1.69 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace WpfApplication1
{
    /// <summary>
    /// Window4.xaml 的交互逻辑
    /// </summary>
    public partial class Window4 : Window
    {
        ObservableCollection<int> Datas = new ObservableCollection<int>();
        int BoltCnt = 88;
        int Target = 10000;
        int Alarm = 1000;
        public Window4()
        {
            InitializeComponent();

            Init();
        }
        void Init() 
        {
            for (int i = 0; i < BoltCnt; i++) 
            {
                Datas.Add((int)(Math.Sin(i * 20 * Math.PI / BoltCnt) * 10 + 100)*100);
            }

            this.graphScanCircular1.Target = Target;
            this.graphScanCircular1.Alarm = Alarm;
            this.graphScanCircular1.BoltCnt = BoltCnt;
            this.graphScanCircular1.DataSource = Datas;
        }
        int index = 0;
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (index >= BoltCnt)
                index = 0;
            Random r=new Random();
            Datas[index] += (r.Next(1000) - 500);
            
            index++;
            
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (index >= BoltCnt)
                index = 0;
            this.graphScanCircular1.OrgBoltNo = index + 1;

            index++;
        }
    }
}