コード例 #1
0
        /// <summary>
        /// Initializes the archive of the application
        /// </summary>
        protected void SetupArchive()
        {
            //creating the archive and its content
            archive = new Ferda.FrontEnd.Archive.FerdaArchive(this, menu, this,
                projectManager.Archive, this, toolBar, projectManager);
            archiveContent = new DockWindow();
            archiveContent.Resize += new EventHandler(archiveContent_Resize);

            //synchronizing the sizes of content and archive
            archiveContent.ClientSize = archive.Size;

            //Settings required by the DockDotNET library to dock anything
            archiveContent.DockType = DockContainerType.ToolWindow;
            archiveContent.Text = ResManager.GetString("ArchiveContentText");
            archive.ResManager = this.ResManager;
            archive.PropertiesDisplayer = propertyGrid;
            archive.ContextHelpDisplayer = contextHelp;

            //setting the archive displayer
            propertyGrid.ArchiveDisplayer = archive;
            menu.ArchiveDisplayer = archive;

            archiveContent.Controls.Add(archive);
        }
コード例 #2
0
        /// <summary>
        /// Constructor that sets the Box property
        /// </summary>
        /// <param name="box">box that will be represented by this node</param>
        /// <param name="alongDirection">the direction of expanding</param>
        /// <param name="arch">Archive where this box belongs</param>
        /// <param name="parent">Parent component of the archive</param>
        /// <param name="iconDictionary">Icon dictionary containing all the icons
        /// for the box visualization</param>
        /// <param name="list">Some image list</param>
        /// <param name="provider">Control providing access to all the icons</param>
        /// <param name="projManager">Project manager of the application</param>
        public FerdaTreeNode(ModulesManager.IBoxModule box, bool alongDirection, 
            ProjectManager.Archive arch, FerdaArchive parent, Dictionary<string, int> iconDictionary,
            ImageList list, IIconProvider provider, ProjectManager.ProjectManager projManager)
            : base()
        {
            Box = box;
            Text = box.UserName;
            AlongDirection = alongDirection;
            Archive = arch;
            ParentTreeView = parent;

            //icon provider for the menu
            this.provider = provider;

            //setting the projectManager
            projectManager = projManager;

            //setting the icon
            if (box.MadeInCreator.Icon.Length == 0)
            {
                this.ImageIndex = iconDictionary["naIcon"];
                this.SelectedImageIndex = iconDictionary["naIcon"];
            }
            else
            {
                string label = box.MadeInCreator.Label;

                if (iconDictionary.ContainsKey(label))
                {
                    this.ImageIndex = iconDictionary[label];
                    this.SelectedImageIndex = iconDictionary[label];
                }
                else
                {
                    MemoryStream stream = new MemoryStream(box.MadeInCreator.Icon);
                    Icon icon = new Icon(stream);
                    int count = list.Images.Count;
                    list.Images.Add(icon);
                    iconDictionary.Add(label, count);

                    this.ImageIndex = count;
                    this.SelectedImageIndex = count;
                }
            }

            //sets the child nodes for this node
            if (AlongDirection)
            {
                //sets the boxes as ConnectionTo
                foreach(ModulesManager.IBoxModule b in Archive.ConnectedTo(Box))
                {
                    Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive,
                        ParentTreeView, iconDictionary, list, provider, projectManager));
                }
            }
            else
            {
                //sets the boxes as ConnectionFrom
                foreach(ModulesManager.IBoxModule b in Archive.ConnectionsFrom(Box))
                {
                    Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive,
                        ParentTreeView, iconDictionary, list, provider, projectManager));
                }
            }
        }