//this reloads the file which was being used on the previous run of the program
        //or creates a new one
        private void Window_ContentRendered(object sender, EventArgs e)
        {
            progressDialog            = new ProgressDialog();
            progressDialog.Visibility = Visibility.Collapsed;
            progressDialog.Top        = 100;
            progressDialog.Left       = 100;
            progressDialog.Owner      = this;
            progressDialog.Show();
            progressDialog.Hide();
            progressDialog.SetProgress(100, "");

            //if the left shift key is pressed, don't load the file
            if (Keyboard.IsKeyUp(Key.LeftShift))
            {
                try
                {
                    string fileName = ""; //if the load is successful, currentfile will be set by the load process
                    if (App.StartupString != "")
                    {
                        fileName = App.StartupString;
                    }
                    if (fileName == "")
                    {
                        fileName = (string)Properties.Settings.Default["CurrentFile"];
                    }
                    if (fileName != "")
                    {
                        LoadFile(fileName);
                        NeuronView.OpenHistoryWindow();
                    }
                    else //force a new file creation on startup if no file name set
                    {
                        CreateEmptyNetwork();
                        SetPlayPauseButtonImage(false);
                    }
                }
                //various errors might have happened so we'll just ignore them all and start with a fresh file
                catch (Exception e1)
                {
                    e1.GetType();
                    MessageBox.Show("Error encountered in file load: " + e1.Message);
                    CreateEmptyNetwork();
                }
            }
            LoadModuleTypeMenu();
        }
예제 #2
0
 private void OpenHistoryWindow()
 {
     if (Application.Current.MainWindow != this)
     {
         return;
     }
     if (theNeuronArray != null)
     {
         bool history = false;
         foreach (Neuron n in theNeuronArray.Neurons())
         {
             if (n.KeepHistory)
             {
                 history = true;
             }
         }
         if (history)
         {
             NeuronView.OpenHistoryWindow();
         }
     }
 }