Exemplo n.º 1
0
        private void btEnterFunc_Click(object sender, RoutedEventArgs e)
        {
            WindowEnterFunc win = new WindowEnterFunc(textBlockEnteredFunc.Text);

            win.ShowDialog();
            if (NelderMid.answer != null && NelderMid.answer.result == -1)
            {
                this.textBlockEnteredFunc.Text = win.strFunc;
                List <string> list = new List <string>();
                list.AddRange(NelderMid.answer.values.Keys);
                list.Sort();
                this.createCoordinates(ref spKoordinates, ref list);
            }
        }
Exemplo n.º 2
0
 private void btLoadData_Click(object sender, RoutedEventArgs e)
 {
     Microsoft.Win32.OpenFileDialog sv = new Microsoft.Win32.OpenFileDialog();
     sv.DefaultExt = ".txt";
     sv.Filter     = "Text documents (.txt)|*.txt";
     if (sv.ShowDialog() == true)
     {
         System.IO.StreamReader stream = new System.IO.StreamReader(sv.FileName);
         textBlockEnteredFunc.Text = stream.ReadLine();
         WindowEnterFunc win = new WindowEnterFunc(textBlockEnteredFunc.Text, true);
         win = null;
         if (NelderMid.answer == null || NelderMid.answer.result != -1)
         {
             MessageBox.Show("Ошибка. Загрузочная функция введена не верно!");
             textBlockEnteredFunc.Text = "";
             return;
         }
         else
         {
             List <string> list = new List <string>();
             list.AddRange(NelderMid.answer.values.Keys);
             list.Sort();
             this.createCoordinates(ref spKoordinates, ref list);
             for (int i = 0; i < NelderMid.answer.values.Count; ++i)
             {
                 try
                 {
                     ((TextBox)((Grid)spKoordinates.Children[i]).Children[1]).Text = stream.ReadLine();
                 }
                 catch
                 {
                 }
             }
         }
         tbMaxK.Text         = stream.ReadLine();
         tbEpsilon.Text      = stream.ReadLine();
         tbLambda.Text       = stream.ReadLine();
         tbAlpha.Text        = stream.ReadLine();
         tbBeta.Text         = stream.ReadLine();
         tbGamma.Text        = stream.ReadLine();
         tbCR.Text           = stream.ReadLine();
         cbCountSymbols.Text = stream.ReadLine();
         stream.Close();
     }
 }