Пример #1
0
        public AssemblyDocumentControl(IDocumentObject document)
        {
            _document = (AssemblyDocument)document;

            InitializeComponent();
            textBoxPath.Text = _document.OriginalPath ?? "";

            AssemblyName name = _document.GetName();

            if (name != null)
            {
                lblAsmNameValue.Text = name.FullName;
            }
        }
Пример #2
0
        private void assemblyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (OpenFileDialog dlg = new OpenFileDialog())
            {
                dlg.Filter = CANAPE.Properties.Resources.ProjectExplorer_AssembliesFileFilter;

                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    try
                    {
                        AssemblyDocument document = new AssemblyDocument(dlg.FileName);
                        document.Name = document.GetName().Name;

                        CANAPEProject.CurrentProject.AddDocument(document, false);
                    }
                    catch (IOException ex)
                    {
                        MessageBox.Show(this, ex.Message,
                            CANAPE.Properties.Resources.MessageBox_ErrorString,
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    catch (BadImageFormatException ex)
                    {
                        MessageBox.Show(this, ex.Message,
                            CANAPE.Properties.Resources.MessageBox_ErrorString,
                            MessageBoxButtons.OK, MessageBoxIcon.Error);

                    }
                }
            }
        }