Пример #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;

            }
        }