private void generateNetworkButton_Click(object sender, RoutedEventArgs e)
        {
            int[] hidden = new int[hiddenLayersListBox.Items.Count];
            for (int i = 0; i < hiddenLayersListBox.Items.Count; i++)
            {
                hidden[i] = ((HiddenListItem)hiddenLayersListBox.Items[i]).Count;
            }
            NetworkListItem item = new NetworkListItem(newNetworkNameTextBox.Text, int.Parse(inputCountTextBox.Text), int.Parse(outputCountTextBox.Text), ActivationFunctionType.Sigmoid, hidden);

            networksDataGrid.Items.Add(item);
            saveAllNetworksButtonLabel.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
        }
        private void importNetworkButton_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dialog = new Microsoft.Win32.OpenFileDialog();
            dialog.Filter      = "Neural Network Items|*.nni|Neural Networks|*.nn|All supported items|*.nni;*.nn";
            dialog.Multiselect = true;
            bool?result = dialog.ShowDialog(this);

            if (result == true)
            {
                Stream[]        fss       = dialog.OpenFiles();
                BinaryFormatter formatter = new BinaryFormatter();
                foreach (FileStream fs in fss)
                {
                    string ext = System.IO.Path.GetExtension(fs.Name);
                    if (ext == ".nni")
                    {
                        List <NetworkListItem> items = (List <NetworkListItem>)formatter.Deserialize(fs);
                        foreach (NetworkListItem item in items)
                        {
                            networksDataGrid.Items.Add(item);
                            item.Finished = true;
                            saveAllNetworksButtonLabel.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
                        }
                    }
                    else if (ext == ".nn")
                    {
                        List <NeuralNetwork> nns = (List <NeuralNetwork>)formatter.Deserialize(fs);
                        int i = 0;
                        foreach (NeuralNetwork nn in nns)
                        {
                            NetworkListItem item = new NetworkListItem(string.Format("{0}_{1}", fs.Name, i), nn);
                            networksDataGrid.Items.Add(item);
                            item.Finished = true;
                            saveAllNetworksButtonLabel.GetBindingExpression(TextBlock.TextProperty).UpdateTarget();
                        }
                    }
                    else
                    {
                        MessageBox.Show(string.Format("The file {0} has incorrect file extension and couldn't be opened", fs.Name), "File can't be opened", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    fs.Flush();
                    fs.Close();
                }
            }
        }
        private void copyToClipboardButton_Click(object sender, RoutedEventArgs e)
        {
            NetworkListItem item = (NetworkListItem)((Button)sender).Tag;

            Clipboard.SetText(item.ToString());
        }