示例#1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            ModuleAtribute.Init(dockPanel, ViewDropDown);
            setStyle(this, new MenuStripRenderer());

            foreach (ToolStripItem menu in MainMenu.Items)
            {
                if (menu is ToolStripDropDownButton)
                {
                    foreach (ToolStripItem item in ((ToolStripDropDownButton)menu).DropDownItems)
                    {
                        MenuStripRenderer.SetStyle(item);
                    }
                }
            }

            if (startArgs != null && startArgs.Length != 0)
            {
                FileInfo fi = new FileInfo(startArgs[0]);
                if (fi.Exists)
                {
                    OpenFile(fi.FullName);
                }
                else
                {
                    NewDocument();
                }
            }
            else
            {
                NewDocument();
            }

            status.Text = "Готово";
        }
示例#2
0
 bool build()
 {
     if (!core.Build(ActiveDocument.CombineCode()))
     {
         status.Text = "В ходе сборки возникли ошибки";
         ModuleAtribute.Show(typeof(ErrorWindow));
         return(false);
     }
     status.Text = "Построение успешно завершено";
     return(true);
 }
示例#3
0
        public static void Init(DockPanel panel, ToolStripDropDownButton menu)
        {
            foreach (var type in typeof(ModuleAtribute).Assembly.GetTypes())
            {
                foreach (var a in type.GetCustomAttributes(typeof(ModuleAtribute), false))
                {
                    ModuleAtribute atrib = a as ModuleAtribute;
                    DockContent    form  = type.GetConstructor(new Type[] { }).Invoke(null) as DockContent;

                    ToolStripMenuItem btn = new ToolStripMenuItem(atrib.dysplayName);
                    menu.DropDownItems.Add(btn);
                    btn.Click += (s, e) =>
                    {
                        if (form.Visible)
                        {
                            form.Hide();
                        }
                        else
                        {
                            Show(type);
                        }
                    };

                    form.TabText      = atrib.dysplayName;
                    form.FormClosing += (s, e) =>
                    {
                        e.Cancel = true;
                        form.Hide();
                    };
                    forms.Add(type, new key()
                    {
                        form  = form,
                        dock  = atrib.dock,
                        panel = panel
                    });

                    if (atrib.defaultShow)
                    {
                        Show(type);
                    }
                }
            }
        }