Ejemplo n.º 1
0
        private void btnTestTagEditorGUI_Click(object sender, EventArgs e)
        {
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();

                // Load the XML Tag Definition
                //ofd.Filter = "Antenna Tag Definition|antenna.xml";
                ofd.Filter = "XML Tag Definition|*.xml";
                if (ofd.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                string      tdfFilename   = ofd.FileName;
                XmlDocument tagDefinition = new XmlDocument();
                tagDefinition.Load(tdfFilename);

                // Load the tag data
                string      tagDataFilename = @"vehicles\warthog\warthog antenna.antenna";
                TagFileName testTagFileName = new TagFileName(
                    tagDataFilename, MapfileVersion.HALOPC, TagSource.Archive);
                TagBase testTag = new TagBase();
                testTag.LoadTagBuffer(testTagFileName);
                BinaryReader br      = new BinaryReader(testTag.Stream);
                Antenna      antenna = new Antenna();
                antenna.Read(br);
                antenna.ReadChildData(br);

                Form test = new Form();
                test.Size = new Size(640, 480);
                TagEditorControl tagEditor = new TagEditorControl();
                tagEditor.Dock = DockStyle.Top;

                tagEditor.Create(tagDefinition, antenna);

                test.Controls.Add(tagEditor);
                test.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
            }
        }