Ejemplo n.º 1
0
        private bool LoadFile(string fileName)
        {
            CloseAllModuleDialogs();
            CloseHistoryWindow();
            CloseNotesWindow();
            theNeuronArrayView.theSelection.selectedRectangles.Clear();
            CloseAllModuleDialogs();
            SuspendEngine();

            XmlFile.Load(ref theNeuronArray, fileName);


            setTitleBar();
            Task.Delay(1000).ContinueWith(t => ShowDialogs());
            foreach (ModuleView na in theNeuronArray.modules)
            {
                if (na.TheModule != null)
                {
                    na.TheModule.SetUpAfterLoad();
                }
            }
            if (theNeuronArray.displayParams != null)
            {
                theNeuronArrayView.Dp = theNeuronArray.displayParams;
            }
            NeuronArrayView.SortAreas();
            Update();
            SetShowSynapsesCheckBox(theNeuronArray.ShowSynapses);
            OpenHistoryWindow();
            ResumeEngine();
            return(true);
        }
Ejemplo n.º 2
0
        private async void LoadFile(string fileName)
        {
            CloseAllModuleDialogs();
            CloseHistoryWindow();
            CloseNotesWindow();
            theNeuronArrayView.theSelection.selectedRectangles.Clear();
            CloseAllModuleDialogs();
            SuspendEngine();

            bool success = false;
            await Task.Run(delegate { success = XmlFile.Load(ref theNeuronArray, fileName); });

            if (!success)
            {
                CreateEmptyNetwork();
                Properties.Settings.Default["CurrentFile"] = currentFileName;
                Properties.Settings.Default.Save();
                return;
            }
            currentFileName = fileName;

            if (XmlFile.CanWriteTo(currentFileName))
            {
                SaveButton.IsEnabled = true;
            }
            else
            {
                SaveButton.IsEnabled = false;
            }

            setTitleBar();
            await Task.Delay(1000).ContinueWith(t => ShowDialogs());

            foreach (ModuleView na in theNeuronArray.modules)
            {
                if (na.TheModule != null)
                {
                    na.TheModule.SetUpAfterLoad();
                }
            }
            if (theNeuronArray.displayParams != null)
            {
                theNeuronArrayView.Dp = theNeuronArray.displayParams;
            }
            NeuronArrayView.SortAreas();

            AddFileToMRUList(currentFileName);
            Properties.Settings.Default["CurrentFile"] = currentFileName;
            Properties.Settings.Default.Save();

            Update();
            SetShowSynapsesCheckBox(theNeuronArray.ShowSynapses);
            SetPlayPauseButtonImage(theNeuronArray.EngineIsPaused);
            ResumeEngine();
        }
Ejemplo n.º 3
0
        private bool LoadClipBoardFromFile(string fileName)
        {
            XmlFile.Load(ref myClipBoard, fileName);

            foreach (ModuleView na in myClipBoard.modules)
            {
                if (na.TheModule != null)
                {
                    na.TheModule.SetUpAfterLoad();
                }
            }
            return(true);
        }
Ejemplo n.º 4
0
        private bool LoadClipBoardFromFile(string fileName)
        {
            XmlFile.Load(ref myClipBoard, fileName);

            foreach (ModuleView na in myClipBoard.modules)
            {
                if (na.TheModule != null)
                {
                    na.TheModule.SetUpAfterLoad();
                }
                {
                    try
                    {
                        na.TheModule.SetUpAfterLoad();
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show("SetupAfterLoad failed on module " + na.Label + ".   Message: " + e.Message);
                    }
                }
            }
            return(true);
        }