Example #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK.Equals(ofdProjectFile.ShowDialog(this)))
            {
                projectFilePath   = ofdProjectFile.FileName;
                projectFolderPath = Path.GetDirectoryName(projectFilePath);

                ProjectFileReader pfr = new ProjectFileReader(projectFilePath);

                opcMockProject = pfr.OpcMockProject;

                opcMockProject.OnProtocolAdded += new OpcMockProject.ProtocolHandler(opcMockProject_OnProtocolAdded);

                projectFileWriter = new ProjectFileWriter(opcMockProject, projectFolderPath);

                if (!File.Exists(DataFilePath()))
                {
                    File.Create(DataFilePath()).Close();
                }

                opcReader = new OpcReaderCsv(DataFilePath());
                opcWriter = new OpcWriterCsv(DataFilePath());

                FillOpcDataGrid(opcReader.ReadAllTags());

                Text = "OPC Mock - " + opcMockProject.Name;
                EnableButtonsAfterDataFileLoad();
            }
        }
Example #2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateProjectDialog cpd = new CreateProjectDialog();

            cpd.StartPosition = FormStartPosition.CenterParent;

            if (DialogResult.OK.Equals(cpd.ShowDialog(this)))
            {
                opcMockProject = cpd.Project;

                opcMockProject.OnProtocolAdded += new OpcMockProject.ProtocolHandler(opcMockProject_OnProtocolAdded);

                projectFolderPath = cpd.ProjectFolderPath;

                projectFileWriter = new ProjectFileWriter(opcMockProject, projectFolderPath);

                projectFileWriter.Save();

                if (!File.Exists(DataFilePath()))
                {
                    File.Create(DataFilePath()).Close();
                }

                opcReader = new OpcReaderCsv(DataFilePath());
                opcWriter = new OpcWriterCsv(DataFilePath());

                Text = "OPC Mock - " + opcMockProject.Name;
                EnableButtonsAfterDataFileLoad();
            }

            cpd.Dispose();
        }
Example #3
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (DialogResult.OK.Equals(ofdProjectFile.ShowDialog(this)))
            {
                projectFilePath = ofdProjectFile.FileName;
                projectFolderPath = Path.GetDirectoryName(projectFilePath);

                ProjectFileReader pfr = new ProjectFileReader(projectFilePath);

                opcMockProject = pfr.OpcMockProject;

                opcMockProject.OnProtocolAdded += new OpcMockProject.ProtocolHandler(opcMockProject_OnProtocolAdded);

                projectFileWriter = new ProjectFileWriter(opcMockProject, projectFolderPath);

                if (!File.Exists(DataFilePath()))
                {
                    File.Create(DataFilePath()).Close();
                }

                opcReader = new OpcReaderCsv(DataFilePath());
                opcWriter = new OpcWriterCsv(DataFilePath());

                FillOpcDataGrid(opcReader.ReadAllTags());

                Text = "OPC Mock - " + opcMockProject.Name;
                EnableButtonsAfterDataFileLoad();
            }
        }
Example #4
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CreateProjectDialog cpd = new CreateProjectDialog();
            cpd.StartPosition = FormStartPosition.CenterParent;

            if (DialogResult.OK.Equals(cpd.ShowDialog(this)))
            {
                opcMockProject = cpd.Project;

                opcMockProject.OnProtocolAdded += new OpcMockProject.ProtocolHandler(opcMockProject_OnProtocolAdded);

                projectFolderPath = cpd.ProjectFolderPath;

                projectFileWriter = new ProjectFileWriter(opcMockProject, projectFolderPath);

                projectFileWriter.Save();

                if (!File.Exists(DataFilePath()))
                {
                    File.Create(DataFilePath()).Close();
                }

                opcReader = new OpcReaderCsv(DataFilePath());
                opcWriter = new OpcWriterCsv(DataFilePath());

                Text = "OPC Mock - " + opcMockProject.Name;
                EnableButtonsAfterDataFileLoad();
            }

            cpd.Dispose();
        }