Пример #1
0
 public void Close()
 {
     if (AskClose())
     {
         ActiveDesigner  = null;
         ActiveDesigners = null;
         if (_differences != null)
         {
             _differences.Close();
             _differences = null;
         }
         _documentManager.Close();
     }
 }
Пример #2
0
        private void PopulateDesigners()
        {
            _designers = new SortedDictionary <string, IFireworksDesigner>();
            DirectoryInfo   dInfo = new DirectoryInfo(new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName);
            List <FileInfo> files = new List <FileInfo>();

            files.AddRange(dInfo.GetFiles("*.dll", SearchOption.AllDirectories).ToList <FileInfo>());
            files.AddRange(dInfo.GetFiles("*.exe", SearchOption.AllDirectories).ToList <FileInfo>());

            List <Assembly> pluginAssemblies = new List <Assembly>();

            foreach (FileInfo file in files)
            {
                try
                {
                    // found an assembly
                    pluginAssemblies.Add(Assembly.LoadFile(file.FullName));
                }
                catch (Exception)
                {
                    //EXE's and DLL's are not always managed assemblies.
                }
            }

            foreach (Assembly pluginAssembly in pluginAssemblies)
            {
                try
                {
                    // Look for class(s) with our interface and construct them
                    foreach (var type in pluginAssembly.GetTypes())
                    {
                        Type iDesigner = type.GetInterface(typeof(IFireworksDesigner).FullName);
                        if (iDesigner != null)
                        {
                            IFireworksDesigner designer = Activator.CreateInstance(type) as IFireworksDesigner;
                            _designers.Add(designer.PluginType + designer.PluginOrder + Guid.NewGuid().ToString(), designer);
                        }
                    }
                }
                catch (Exception)
                {
                    //Something really bad must have happened.
                    //MessageBox.Show("Fatal error reflecting plugins in assembly '" + pluginAssembly.FullName + "'.\r\n" +
                    //    "The error message is:\r\n\r\n" + e.Message);
                }
            }
        }
Пример #3
0
        private void listViewDesigners_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewDesigners.SelectedItems.Count > 0)
            {
                #region DisablePreviousDesigner
                foreach (TabPage item in tabControlDesigners.TabPages)
                {
                    tabControlDesigners.TabPages.Remove(item);
                }
                selectedDesigner = null;
                #endregion

                #region EnableSelectedDesigner
                // Take previously constructed designer and make it visible on the screen
                tabControlDesigners.TabPages.Add(tabPagePlugin);
                TabPage pluginTabPage = tabControlDesigners.TabPages[0];
                selectedDesigner = listViewDesigners.SelectedItems[0].Tag as IFireworksDesigner;

                var selectedControl = selectedDesigner as Control;

                SuspendLayout();
                pluginTabPage.Text = selectedDesigner.PluginName;
                pluginTabPage.Controls.Clear();
                pluginTabPage.Location = new System.Drawing.Point(4, 22);
                pluginTabPage.Name     = "pluginTabPage";
                pluginTabPage.Size     = new System.Drawing.Size(648, 280);
                pluginTabPage.TabIndex = 2;


                if (selectedControl != null)
                {
                    pluginTabPage.Controls.Add(selectedControl);
                    selectedControl.Dock     = System.Windows.Forms.DockStyle.Fill;
                    selectedControl.Location = new System.Drawing.Point(0, 0);
                    selectedControl.Name     = "selectedDesigner";
                    selectedControl.Size     = new System.Drawing.Size(648, 280);
                    selectedControl.TabIndex = 0;
                }

                ResumeLayout(true);
                // Ensure designer is in proper state
                selectedDesigner.DesignerManager = this;
                selectedDesigner.LoadData();
                #endregion
            }
        }
Пример #4
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         IFireworksDesigner designer = listView1.SelectedItems[0].Tag as IFireworksDesigner;
         if (designer != null)
         {
             richTextBox1.Text = designer.PluginInformation;
         }
         else
         {
             if (listView1.SelectedItems[0].Text.Equals("ICSharpCode.TextEditor"))
             {
                 richTextBox1.Text = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("FireworksFramework.ICSharpCode.TextEditor.EULA.txt")).ReadToEnd();
             }
         }
     }
 }
Пример #5
0
        void PublishNamespace()
        {
            if (_documentManager.DocumentState != DocumentStates.Closed)
            {
                List <IFireworksDesigner> activeDesigners = new List <IFireworksDesigner>();

                foreach (var designer in _pluginManager.Designers.Values)
                {
                    if (designer.PluginType == PluginType.Designer && designer.IsValidContext())
                    {
                        activeDesigners.Add(designer as IFireworksDesigner);
                    }
                }
                ActiveDesigners = activeDesigners;
                ActiveDesigner  = null;
                if (activeDesigners.Any())
                {
                    ActiveDesigner = ActiveDesigners.First();
                }
            }
        }