public Core(Canvas Mycanvas_, ProgressBar progress_, TextBlock progressTextBlock_) { Mycanvas = Mycanvas_; progress = progress_; progressTextBlock = progressTextBlock_; IsRuning = false; m_SyncContext = SynchronizationContext.Current; suspensionWindow = new SuspensionWindow(this); StringArr = new List <string>(); StringArr.Add("电阻"); StringArr.Add("电容"); StringArr.Add("导线"); StringArr.Add("电感"); StringArr.Add("电阻表"); StringArr.Add("电压表"); StringArr.Add("地"); StringArr.Add("红色探针"); StringArr.Add("黑色探针"); StringArr.Add("直流电源"); StringArr.Add("交流电源"); Mycanvas.MouseLeftButtonDown += Mycanvas_MouseLeftButtonDown; Mycanvas.MouseUp += Mycanvas_MouseUp; Mycanvas.MouseMove += Mycanvas_MouseMove; Mycanvas.MouseRightButtonUp += Mycanvas_MouseRightButtonUp; Mycanvas.KeyDown += MainWindow_KeyDown; //定义面板上的鼠标操作 elecCompSet = new ElecCompSet(); SyncProgess(100, "无任务"); //用这个函数异步更新ProgressBar的值 mycondition = new condition(); myOscilloscope = new oscilloscope(); //示波器,只有一个实例 }
public MainWindow() { IsRuning = false; InitializeComponent(); m_SyncContext = SynchronizationContext.Current; suspensionWindow = new SuspensionWindow(this); /*ImageArr = new List<Image>(); * //MessageBox.Show("" + Environment.CurrentDirectory); * for (int i=0; i<4; i++) * { * Image image = new Image(); * image.Width = 200; * image.Height = 150; * /*image.Source = new BitmapImage(new Uri("C:\\Users" + * "\\37754\\Pictures\\doge.jpg")); * image.Source = new BitmapImage(new Uri(Environment.CurrentDirectory + "\\doge.jpg")); + ImageArr.Add(image); + }*/ StringArr = new List <string>(); StringArr.Add("电阻"); StringArr.Add("电容"); StringArr.Add("导线"); StringArr.Add("电感"); StringArr.Add("电阻表"); StringArr.Add("电压表"); StringArr.Add("地"); StringArr.Add("红色探针"); StringArr.Add("蓝色探针"); this.elecCompList.ItemsSource = StringArr; //this.elecCompList.ItemsSource = ImageArr; this.elecCompList.MouseDoubleClick += ElecCompList_MouseDoubleClick; //UpdateList(); this.Mycanvas.MouseLeftButtonDown += Mycanvas_MouseLeftButtonDown; this.Mycanvas.MouseUp += Mycanvas_MouseUp; this.Mycanvas.MouseMove += Mycanvas_MouseMove; this.Mycanvas.MouseRightButtonUp += Mycanvas_MouseRightButtonUp; elecCompSet = new ElecCompSet(); //elecCompSet.AddCompAndShow(new Resistance(), Mycanvas); //elecCompSet.AddCompAndShow(new Capacity(), Mycanvas); //resistance2.Move(100, 200); this.KeyDown += MainWindow_KeyDown; InitTest(); this.start_button.Click += Start_button_Click; SyncProgess(100, "无任务"); //用这个函数异步更新ProgressBar的值 myOscilloscope = new oscilloscope(); }