示例#1
0
文件: Form1.cs 项目: vi34/fb2smv
        private void saveProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FBType rootFbType = _parcer.Storage.Types.FirstOrDefault(t => t.IsRoot);

            if (rootFbType == null)
            {
                Program.ErrorMessage(Messages.No_FB_System_Loaded_Message_);
                return;
            }
            saveFileDialogProject.FileName = rootFbType.Name + projectFileExtension;
            if (saveFileDialogProject.ShowDialog() == DialogResult.OK)
            {
                ProjectFileStructure s = new ProjectFileStructure();
                s.ExecutionModels = _executionModels;
                s.Storage         = _parcer.Storage;

                FileStream      fs         = new FileStream(saveFileDialogProject.FileName, FileMode.Create);
                BinaryFormatter serializer = new BinaryFormatter();
                //try
                //{
                serializer.Serialize(fs, s);
                //}

                /*if (saveFileDialogProject.ShowDialog() == DialogResult.OK)
                 * {
                 *
                 * }*/
            }
        }
示例#2
0
文件: Form1.cs 项目: vi34/fb2smv
 private void resetWorkspace(ProjectFileStructure project)
 {
     _executionModels  = project.ExecutionModels;
     _parcer           = new FBClassParcer(project.Storage, ShowMessage);
     _selectedFbType   = null;
     _selectedVariable = null;
     fbTypesView.Nodes.Clear();
     smvCodeRichTextBox.Text  = "";
     messagesRichTextBox.Text = "";
 }
示例#3
0
文件: Form1.cs 项目: vi34/fb2smv
        private ProjectFileStructure loadProject(string filename)
        {
            FileStream      fs         = new FileStream(filename, FileMode.Open);
            BinaryFormatter serializer = new BinaryFormatter();
            //ProjectFileStructure openedProject = new ProjectFileStructure();

            ProjectFileStructure openedProject = (ProjectFileStructure)serializer.Deserialize(fs);

            fs.Close();
            return(openedProject);
        }
示例#4
0
文件: Form1.cs 项目: vi34/fb2smv
        private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                /*if (mainModuleRichTextBox.Text != "")
                 * {
                 *
                 *  if (MessageBox.Show("Main module exists. Clear it?", "", MessageBoxButtons.YesNo) == DialogResult.OK)
                 *  {
                 *      mainModuleRichTextBox.Text = "";
                 *  }
                 * }*/
                if (Path.GetExtension(openFileDialog1.FileName) == projectFileExtension) //load saved project
                {
                    ProjectFileStructure openedProject = loadProject(openFileDialog1.FileName);
                    resetWorkspace(openedProject);
                }
                else //load from .fbt files
                {
                    resetWorkspace();
                    loadFbSystem(openFileDialog1.FileName);
                }
                VisualizableStringTree t = new VisualizableStringTree();
                t.Construct(_parcer.Storage);
                fbTypesView.Nodes.Add(t.TreeViewRoot());

                try
                {
                    varDependencyGraph = new VarDependencyGraph(_parcer.Storage);
                    varDependencyGraph.Construct();
                }
                catch (KeyNotFoundException ex)
                {
                    ShowMessage(ex.Message);
                }

                //time scheduler data
                timersTextBox.Text   = _parcer.Storage.TimersCount.ToString();
                timetypeTextBox.Text = _parcer.Storage.TimeSMVType;
                tmaxTextBox.Text     = _parcer.Storage.Tmax.ToString();
            }
        }