示例#1
0
        override public VizForm Clone()
        {
            SerializationHelper sh = new SerializationHelper();
            sh.dataBlock = this.GetDataBlock();
            sh.graph = new Graph(ga);

            FileAnalogVizForm avf = new FileAnalogVizForm(sh);
            avf.MdiParent = MdiParent;
            avf.Text = Text;// +Parent.childFormNumber++;
            avf.Init();
            avf.Show();
            return avf;
        }
示例#2
0
        override public VizForm Clone()
        {
            SerializationHelper sh = new SerializationHelper();

            sh.dataBlock = this.GetDataBlock();
            sh.graph     = new Graph(ga);

            FileAnalogVizForm avf = new FileAnalogVizForm(sh);

            avf.MdiParent = MdiParent;
            avf.Text      = Text;// +Parent.childFormNumber++;
            avf.Init();
            avf.Show();
            return(avf);
        }
示例#3
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter           = "XML Files (*.xml)|*.xml|Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string fileName = openFileDialog.FileName;

                FileStream          stream = File.Open(fileName, FileMode.Open);
                SerializationHelper sh     = SerializationHelper.LoadXML(stream);
                stream.Close();

                VizForm childForm;
                if (sh.dataBlock.m_dataType == DataBlock.DATA_TYPE.ANALOG)
                {
                    childForm = new FileAnalogVizForm(sh);
                }
                else if (sh.dataBlock.m_dataType == DataBlock.DATA_TYPE.DIGITAL)
                {
                    childForm = new FileDigitalVizForm(sh);
                }
                else
                {
                    MessageBox.Show("file not supported");
                    return;
                }

                // Make it a child of this MDI form before showing it.
                childForm.MdiParent = this;
                childForm.Text      = fileName;
                childForm.Init();
                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;
            }
        }
示例#4
0
        private void OpenFile(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "XML Files (*.xml)|*.xml|Text Files (*.txt)|*.txt|All Files (*.*)|*.*";
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string fileName = openFileDialog.FileName;

                FileStream stream = File.Open(fileName, FileMode.Open);
                SerializationHelper sh = SerializationHelper.LoadXML(stream);
                stream.Close();

                VizForm childForm;
                if (sh.dataBlock.m_dataType == DataBlock.DATA_TYPE.ANALOG)
                {
                    childForm = new FileAnalogVizForm(sh);
                }
                else if (sh.dataBlock.m_dataType == DataBlock.DATA_TYPE.DIGITAL)
                {
                    childForm = new FileDigitalVizForm(sh);
                }
                else
                {
                    MessageBox.Show("file not supported");
                    return;
                }

                // Make it a child of this MDI form before showing it.
                childForm.MdiParent = this;
                childForm.Text = fileName;
                childForm.Init();
                childForm.Show();
                childForm.WindowState = FormWindowState.Maximized;

            }
        }