private void nextPage() { //Application.Current.Properties["question"] = str; Window4 window4 = new Window4(); window4.Top = this.Top + (this.ActualHeight - window4.Height) / 2; window4.Left = this.Left + (this.ActualWidth - window4.Width) / 2; window4.ShowDialog(); }
private void button7_Click(object sender, RoutedEventArgs e)//线性拟合 { if (array == null) { MessageBox.Show("请打开文件!", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.OK); } else { if (Done == false)//见全局变量Done的注释 { Win4 = new Window4(); Win4.ShowDialog(); } IsClick = true; Tuple <double, double> s = new Tuple <double, double>(0, 0); XAxis = new double[array.GetLength(1)]; double[] YAxis = new double[array.GetLength(1)]; //将输入的力的范围内的值取出 for (int i = 0; i < array.GetLength(1); i++) { XAxis[i] = Win4.startPoint + i * Win4.gap; } Random rd = new Random(); int RandomNum = rd.Next(0, array.GetLength(0) / 2); for (int i = 0; i < array.GetLength(1); i++) { YAxis[i] = array[RandomNum, i]; } s = MathNet.Numerics.Fit.Line(XAxis, YAxis); b = s.Item1; k = s.Item2; Done = true; if (p5 == null) { p5 = new Page5(); } content4.Content = new Frame()//将 content4.Content内容清除 { Content = null }; content3.Content = new Frame() { Content = p5 }; } }