public SubWindow(MainWindow w) { this.mainWindow = w; InitializeComponent(); DataFile TimeArg = new DataFile(); //ComboBoxItem TempItem = new ComboBoxItem(); //TempItem.Content = TimeArg.CorrectMinute.ToString(); this.ComboBox1.SelectedValue = TimeArg.CorrectMinute; //TempItem.Content = TimeArg.CorrectSecond.ToString(); this.ComboBox2.SelectedValue = TimeArg.CorrectSecond; //TempItem.Content = TimeArg.RelaxMinute.ToString(); this.ComboBox3.SelectedValue = TimeArg.RelaxMinute; //TempItem.Content = TimeArg.RelaxSecond.ToString(); this.ComboBox4.SelectedValue = TimeArg.RelaxSecond; //((ComboBoxItem)this.ComboBox1.SelectedItem).Content = TimeArg.CorrectMinute; //((ComboBoxItem)this.ComboBox2.SelectedItem).Content = TimeArg.CorrectSecond; //((ComboBoxItem)this.ComboBox3.SelectedItem).Content = TimeArg.RelaxMinute; //((ComboBoxItem)this.ComboBox4.SelectedItem).Content = TimeArg.RelaxSecond; }
//主逻辑 public MainWindow() { InitializeComponent(); init(); DataFile TimeArg = new DataFile(); Args.longMilliseconds = TimeArg.RelaxSeconds * 1000; Args.shortMilliseconds = TimeArg.CorrectSeconds * 1000; var w = (MainWindow)Window.GetWindow(this); Events myDetection = new Events(w); Handlers myHandlers = new Handlers(w); myDetection.TimeToDetect += new Detection(myHandlers.EyeDetect); myDetection.TimeToDetect += new Detection(myHandlers.RunTime); myDetection.TimeToAnalyse += new AnalyseArg(myHandlers.PreAnalyse); myDetection.TimeToAnalyse += new AnalyseArg(myHandlers.Analyse); myDetection.LongTimeDetected += new Correction(myHandlers.DisplayMessage); myDetection.ShortTimeDetected += new Correction(myHandlers.DisplayMessage); myDetection.Detect(); }
//“设置”修改主窗口参数 public void ChangeArgs() { DataFile TimeArg = new DataFile(); Args.longMilliseconds = TimeArg.RelaxSeconds * 1000; Args.shortMilliseconds = TimeArg.CorrectSeconds * 1000; }