/// <summary>
        /// Metoda tworzenia obiektu opcji tworzenia sieci na podstawie danych wprowadzonych do formularza.
        /// </summary>
        /// <returns>Obiekt opcji tworzenia sieci.</returns>
        private OptionData CreateOptionDataFromForm()
        {
            OptionData option = new OptionData();
            try
            {
                option.TrainingPath = textBoxTrainigPath.Text;
                option.TrainingMinNumberOfPeriods = int.Parse(textBoxTrainingMinPeriod.Text);
                option.TrainingMaxNumberOfPeriods = int.Parse(textBoxTrainingMaxPeriod.Text);
                option.TrainingPeriodsStep = int.Parse(textBoxTrainingPeriodStep.Text);
                option.MinTrainingPatterns = int.Parse(textBoxMinPattern.Text);
                option.MaxTrainingPatterns = int.Parse(textBoxMaxPattern.Text);
                option.TrainingPatternsStep = int.Parse(textBoxPatternStep.Text);
                option.TrainingPatternsSearchStartDate = dateTimePickerTrain.Value;
                option.TrainingExchangeDaysStep = int.Parse(textBoxTrainDateStep.Text);

                option.TestPath = textBoxTestPath.Text;
                option.TestMinNumberOfPeriods = int.Parse(textBoxTestMinPeriodNo.Text);
                option.TestMaxNumberOfPeriods = int.Parse(textBoxTestMaxPeriodNo.Text);
                option.TestPeriodsStep = int.Parse(textBoxTestPeriodStep.Text);
                option.DesiredNumberOfPatterns = int.Parse(textBoxDesiredPatNo.Text);
                option.TestPatternsSearchStartDate = dateTimePickerTest.Value;
                option.TestExchangeDaysStep = int.Parse(textBoxTestDateStep.Text);

                option.NetPath = textBoxNetPath.Text;
                option.MaxEpochs = int.Parse(textBoxMaxEpochs.Text);
                option.MinEpochs = int.Parse(textBoxMinEpochs.Text);
                option.MaxEpochsMultiplierStep = double.Parse(textBoxEpochsStep.Text);
                option.MinHiddenLayersMultiplier = double.Parse(textBoxMinHidden.Text);
                option.MaxHiddenLayersMultiplier = double.Parse(textBoxMaxHidden.Text);
                option.HiddenLayersMultiplierStep = double.Parse(textBoxHiddenStep.Text);
                option.DesiredMSE = double.Parse(textBoxMSE.Text);
                return option;
            }
            catch
            {
                return null;
            }
        }
        /// <summary>
        /// Metoda tworzenia nowych sieci neuronowych.
        /// </summary>
        /// <param name="option">Opcje tworzenia nowych sieci neuronowych</param>
        public void CreateNewNeuralNets(OptionData option)
        {
            this.InitializationProgress = 0;
            int numberOfSteps = 3;
            int currentStep = 1;
            Task t = new Task((Action)(
                    () =>
                    {
                        this.InitializationStatus = "Step " + currentStep.ToString() + "/" + numberOfSteps.ToString() + " : Generating training Data";

                        GenerateTrainingData(
                            option.TrainingPath,
                            option.TrainingMinNumberOfPeriods,
                            option.TrainingMaxNumberOfPeriods,
                            option.TrainingPeriodsStep,
                            option.MinTrainingPatterns,
                            option.MaxTrainingPatterns,
                            option.TrainingPatternsStep,
                            option.TrainingPatternsSearchStartDate,
                            option.TrainingExchangeDaysStep
                            );

                        this.InitializationProgress = (double)currentStep * 100 / numberOfSteps;
                        currentStep++;
                        this.InitializationStatus = "Step " + currentStep.ToString() + "/" + numberOfSteps.ToString() + " : Generating test Data";

                        GenerateTestData(
                            option.TestPath,
                            option.TestMinNumberOfPeriods,
                            option.TestMaxNumberOfPeriods,
                            option.TestPeriodsStep,
                            option.DesiredNumberOfPatterns,
                            option.TestPatternsSearchStartDate,
                            option.TestExchangeDaysStep
                            );

                        this.InitializationProgress = (double)currentStep * 100 / numberOfSteps;
                        currentStep++;
                        this.InitializationStatus = "Step " + currentStep.ToString() + "/" + numberOfSteps.ToString() + " : Creating and training networks";
                        CreateNetworks(
                            option.NetPath,
                            Path.GetDirectoryName(option.TrainingPath),
                            Path.GetDirectoryName(option.TestPath),
                            option.MaxEpochs,
                            option.MinEpochs,
                            option.MaxEpochsMultiplierStep,
                            option.MinHiddenLayersMultiplier,
                            option.MaxHiddenLayersMultiplier,
                            option.HiddenLayersMultiplierStep,
                            100 / (double)numberOfSteps,
                            option.DesiredMSE);
                    }
                    ), TaskCreationOptions.LongRunning
                    );
            t.Start();
        }