public void generateNewESN()
        {
            esn = new EchoStateNetwork(1000, 0.3);

            reservoirValue.Dispatcher.Invoke(() => { reservoirValue.Text = "1000"; });
            leakValue.Dispatcher.Invoke(() => { leakValue.Text = "0.3"; });
            File_New.Dispatcher.Invoke(() => { File_New.IsEnabled = true; });

            showMessageBox("Sieć wygenerowana", "Zakończono proces");
        }
        // Zapisanie obiektu sieci
        private void File_Save_Click(object sender, RoutedEventArgs e)
        {
            // Configure save file dialog box
            Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
            dlg.FileName   = "ESN  " + DateTime.Today.ToShortDateString(); // Default file name
            dlg.DefaultExt = ".esn";                                       // Default file extension
            dlg.Filter     = "Esn file (.esn)|*.esn";                      // Filter files by extension

            // Show save file dialog box
            Nullable <bool> result = dlg.ShowDialog();
            FileStream      fs;

            // Process save file dialog box results
            if (result == true)
            {
                // Save document
                string filename = dlg.FileName;
                fs = new FileStream(filename, FileMode.Create);

                // Construct a BinaryFormatter and use it to serialize the data to the stream.
                BinaryFormatter formatter = new BinaryFormatter();
                try
                {
                    EchoStateNetwork temp = esn;
                    temp.data = null;
                    temp.Y    = null;
                    temp.Yt   = null;
                    temp.X    = null;
                    formatter.Serialize(fs, temp);
                }
                catch (Exception ex)
                {
                    showMessageBox("Serializacja nieudana. Powód: " + ex.Message, "Błąd");
                    throw;
                }
                fs.Close();
            }
        }
        // Otwarcie zapisanej wcześniej sieci
        private void File_Open_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "File";                  // Default file name
            dlg.DefaultExt = ".esn";                  // Default file extension
            dlg.Filter     = "ESN file (.esn)|*.esn"; // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();
            FileStream      fs;

            // Process open file dialog box results
            if (result == true)
            {
                // Open document
                string filename = dlg.FileName;
                fs = new FileStream(filename, FileMode.Open);
                try
                {
                    BinaryFormatter formatter = new BinaryFormatter();

                    //Deserialize the hashtable from the file and
                    //assign the reference to the local variable.
                    esn                 = (EchoStateNetwork)formatter.Deserialize(fs);
                    mseValue.Text       = esn.mse.ToString();
                    reservoirValue.Text = esn.size.ToString();
                    if (esn.mse == 0)
                    {
                        mseValue.Text = "";
                    }
                    else
                    {
                        mseValue.Text = esn.mse.ToString();
                    }
                    leakValue.Text = esn.a.ToString();
                    if (esn.isTeached == true)
                    {
                        askBox.IsEnabled    = true;
                        askButton.IsEnabled = true;
                        teach.IsEnabled     = false;
                        initValue.IsEnabled = false;
                    }
                    else
                    {
                        askBox.IsEnabled    = false;
                        askButton.IsEnabled = false;
                        teach.IsEnabled     = true;
                        initValue.IsEnabled = true;
                        loadData.IsEnabled  = true;
                    }
                    if (loadDataPath.Text.Equals("Nie wybrano pliku"))
                    {
                        teach.IsEnabled     = false;
                        initValue.IsEnabled = false;
                    }
                }
                catch (Exception ex)
                {
                    showMessageBox("Deserializacja nieudana. Powód: " + ex.Message, "Błąd");
                    throw;
                }
                fs.Close();
            }
        }