Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ProjectTreeIL            = new ImageList();
            ProjectTreeIL.ColorDepth = ColorDepth.Depth32Bit;
            ProjectTreeIL.ImageSize  = new Size(16, 16);
            ProjectTreeIL.Images.Add(Resources.document);
            ProjectTreeIL.Images.Add(Resources.folder_open);
            treeView1.ImageList = ProjectTreeIL;

            for (int i = 0; i < this.Controls.Count; i++)
            {
                MdiClient mdiClient = this.Controls[i] as MdiClient;
                if (mdiClient != null)
                {
                    Win32Util.SetMDIBorderStyle(mdiClient, BorderStyle.None);
                }
            }
            menuNew.MenuItems.Clear();
            foreach (Plugin p in Program.PluginManager.Plugins)
            {
                List <Type> creatables = new List <Type>();
                foreach (Type t in p.FileFormatTypes)
                {
                    if (t.GetInterfaces().Contains(typeof(IEmptyCreatable)))
                    {
                        creatables.Add(t);
                    }
                }
                if (creatables.Count > 0)
                {
                    MenuItem m = menuNew.MenuItems.Add(p.Name);
                    foreach (Type t in creatables)
                    {
                        MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetFileDescription());
                        ii.Click += new EventHandler(CreateNew_Click);
                        ii.Tag    = t;
                    }
                }
            }
            menuFileNew.MenuItems.Clear();
            foreach (Plugin p in Program.PluginManager.Plugins)
            {
                List <Type> creatables = new List <Type>();
                foreach (Type t in p.FileFormatTypes)
                {
                    if (t.GetInterfaces().Contains(typeof(IFileCreatable)))
                    {
                        creatables.Add(t);
                    }
                }
                if (creatables.Count > 0)
                {
                    MenuItem m = menuFileNew.MenuItems.Add(p.Name);
                    foreach (Type t in creatables)
                    {
                        MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetFileDescription());
                        ii.Click += new EventHandler(CreateFileNew_Click);
                        ii.Tag    = t;
                    }
                }
            }
            menuProjectNew.MenuItems.Clear();
            foreach (Plugin p in Program.PluginManager.Plugins)
            {
                if (p.ProjectTypes.Length > 0)
                {
                    MenuItem m = menuProjectNew.MenuItems.Add(p.Name);
                    foreach (Type t in p.ProjectTypes)
                    {
                        MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetProjectDescription());
                        ii.Click += new EventHandler(CreateNewProject_Click);
                        ii.Tag    = t;
                    }
                }
            }
            menuCompression.MenuItems.Clear();
            foreach (Plugin p in Program.PluginManager.Plugins)
            {
                if (p.CompressionTypes.Length != 0)
                {
                    MenuItem m = menuCompression.MenuItems.Add(p.Name);
                    foreach (Type t in p.CompressionTypes)
                    {
                        MenuItem ii  = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetCompressionDescription());
                        var      dec = ii.MenuItems.Add("Decompress...");
                        dec.Click += new EventHandler(Decompress_Click);
                        dec.Tag    = t;
                        if (t.GetInterfaces().Contains(typeof(ICompressable)))
                        {
                            var comp = ii.MenuItems.Add("Compress...");
                            comp.Click += new EventHandler(Compress_Click);
                            comp.Tag    = t;
                        }
                    }
                }
            }
            if (PendingPath != null)
            {
                Program.FileManager.OpenFile(new EFEDiskFile(PendingPath));
            }
            PendingPath = null;
        }
Esempio n. 2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     for (int i = 0; i < this.Controls.Count; i++)
     {
         MdiClient mdiClient = this.Controls[i] as MdiClient;
         if (mdiClient != null)
         {
             Win32Util.SetMDIBorderStyle(mdiClient, BorderStyle.None);
         }
     }
     menuNew.MenuItems.Clear();
     foreach (Plugin p in Program.PluginManager.Plugins)
     {
         List <Type> creatables = new List <Type>();
         foreach (Type t in p.FileFormatTypes)
         {
             if (t.GetInterfaces().Contains(typeof(IEmptyCreatable)))
             {
                 creatables.Add(t);
             }
         }
         if (creatables.Count > 0)
         {
             MenuItem m = menuNew.MenuItems.Add(p.Name);
             foreach (Type t in creatables)
             {
                 MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetFileDescription());
                 ii.Click += new EventHandler(CreateNew_Click);
                 ii.Tag    = t;
             }
         }
     }
     menuFileNew.MenuItems.Clear();
     foreach (Plugin p in Program.PluginManager.Plugins)
     {
         List <Type> creatables = new List <Type>();
         foreach (Type t in p.FileFormatTypes)
         {
             if (t.GetInterfaces().Contains(typeof(IFileCreatable)))
             {
                 creatables.Add(t);
             }
         }
         if (creatables.Count > 0)
         {
             MenuItem m = menuFileNew.MenuItems.Add(p.Name);
             foreach (Type t in creatables)
             {
                 MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetFileDescription());
                 ii.Click += new EventHandler(CreateFileNew_Click);
                 ii.Tag    = t;
             }
         }
     }
     menuCompression.MenuItems.Clear();
     foreach (Plugin p in Program.PluginManager.Plugins)
     {
         if (p.CompressionTypes.Length != 0)
         {
             MenuItem m = menuCompression.MenuItems.Add(p.Name);
             foreach (Type t in p.CompressionTypes)
             {
                 MenuItem ii = m.MenuItems.Add(((dynamic) new StaticDynamic(t)).Identifier.GetCompressionDescription());
                 ii.MenuItems.Add("Decompress...");
                 if (t.GetInterfaces().Contains(typeof(ICompressable)))
                 {
                     ii.MenuItems.Add("Compress...");
                 }
                 //ii.Click += new EventHandler(CreateFileNew_Click);
                 //ii.Tag = t;
             }
         }
     }
     if (PendingPath != null)
     {
         Program.FileManager.OpenFile(new EFEDiskFile(PendingPath));
     }
     PendingPath = null;
 }