WebcastRootNodeBuilder.cs :  » Network-Clients » iReaper » IReaper » CourseData » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Network Clients » iReaper 
iReaper » IReaper » CourseData » WebcastRootNodeBuilder.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using IReaper.FileData;
using IReaper.CourseData;
using IReaper.Properties;
using IReaper.Category;

namespace IReaper.CourseData{

    public delegate TreeNode GetTreeNodeEventHandler();

    class WebcastRootNodeBuilder
    {
        #region Instance
        TreeNode rootNode;
        /// 
        /// </summary>
        /// <param name="Node"></param>
        private WebcastRootNodeBuilder()
        { }
        /// <summary>
        /// 7
        /// </summary>
        void CreateSubNodes(TreeNode Node)
        {
            if (Node == null)
                return;
            this.rootNode = Node;
            this.rootNode.ImageKey = "Webcast";
            this.rootNode.SelectedImageKey = "Webcast";
            this.rootNode.Nodes.Clear();
            //
            TreeNode techNode = new TreeNode(Resources.Technology);//"");
            TreeNode seriesNode = new TreeNode(Resources.Series);//"");
            TreeNode productNode = new TreeNode(Resources.Product);//"");
            TreeNode teacherNode = new TreeNode(Resources.Speaker);//"");
            TreeNode levelNode = new TreeNode(Resources.Level);//"");
            TreeNode rateNode = new TreeNode(Resources.Rate);//"");
            TreeNode timeNode = new TreeNode(Resources.Time);//"");
            //
            techNode.Name = CourseAttributeTypeEnum.Technology.ToString();
            techNode.SelectedImageKey = techNode.ImageKey = CourseAttributeTypeEnum.Technology.ToString();
            seriesNode.Name = CourseAttributeTypeEnum.Series.ToString();
            seriesNode.SelectedImageKey = seriesNode.ImageKey = CourseAttributeTypeEnum.Series.ToString();
            productNode.Name = CourseAttributeTypeEnum.Product.ToString();
            productNode.SelectedImageKey = productNode.ImageKey = CourseAttributeTypeEnum.Product.ToString();
            teacherNode.Name = CourseAttributeTypeEnum.Speaker.ToString();
            teacherNode.SelectedImageKey = teacherNode.ImageKey = CourseAttributeTypeEnum.Speaker.ToString();
            levelNode.Name = CourseAttributeTypeEnum.Level.ToString();
            levelNode.SelectedImageKey = levelNode.ImageKey = CourseAttributeTypeEnum.Level.ToString();
            timeNode.Name = CourseAttributeTypeEnum.Time.ToString();
            timeNode.SelectedImageKey = timeNode.ImageKey = CourseAttributeTypeEnum.Time.ToString();
            rateNode.Name = CourseAttributeTypeEnum.Rating.ToString();
            rateNode.SelectedImageKey = rateNode.ImageKey = CourseAttributeTypeEnum.Rating.ToString();
            //i
            //root
            if (this.rootNode.TreeView != null)
            {
                this.rootNode.TreeView.BeginInvoke(new System.Threading.ThreadStart(delegate()
                {
                    this.rootNode.Nodes.AddRange(new TreeNode[]{
                techNode,
                seriesNode,
                productNode,
                teacherNode,
                levelNode,
                rateNode,
                timeNode
            });
                }));
            }
            else
            {
                this.rootNode.Nodes.AddRange(new TreeNode[]{
                techNode,
                seriesNode,
                productNode,
                teacherNode,
                levelNode,
                rateNode,
                timeNode
            });
            }
        }

        #endregion
        #region static
        static WebcastRootNodeBuilder builder;
        static CourseCategoryVector allVector;

        

        static WebcastRootNodeBuilder()
        {
            builder = new WebcastRootNodeBuilder();
        }
        /// <summary>
        /// Node
        /// </summary>
        /// <param name="Node"></param>
        internal static void BuildSubNodes(TreeNode Node)
        {
            builder.CreateSubNodes(Node);
        }

        /// <summary>
        /// 
        /// </summary>
        public static CourseCategoryVector AllVector
        {
            get { return WebcastRootNodeBuilder.allVector; }
        }

        public static TreeNode GetAllDataNode()
        {
            //
            WebcastCourseTreeNode<Course> allNode = ((Dictionary<string, TreeNode>)Core.CoreData[CoreDataType.AllCourseTreeNode])["All"] as WebcastCourseTreeNode<Course>;
            if (allNode == null)
                allNode = new WebcastCourseTreeNode<Course>();
            //
            BuildSubNodes(allNode);
            //
            allNode.Name = "All";
            allNode.Tag = Resources.AllCourse;
            //
            allVector = CourseVectorBase.GetCoursVector(CourseDataManager.AllCourses) as CourseCategoryVector;
            allNode.SetVector(allVector);
            //
            return allNode;
        }

        public static TreeNode GetCompletedDataNode()
        {
            //
            WebcastCourseTreeNode<Course> completedNode = ((Dictionary<string, TreeNode>)Core.CoreData[CoreDataType.AllCourseTreeNode])["Completed"] as WebcastCourseTreeNode<Course>;
            if (completedNode == null)
                completedNode = new WebcastCourseTreeNode<Course>();
            //
            BuildSubNodes(completedNode);
            //
            completedNode.Name = "Completed";
            completedNode.Tag = Resources.Completed;// "";
            //
            completedNode.SetVector(CourseVectorBase.GetCoursVector(CourseDataManager.CompletedCourses));
            return completedNode;
        }

        public static TreeNode GetNewDataNode()
        {
            //
            WebcastCourseTreeNode<Course> newNode = ((Dictionary<string, TreeNode>)Core.CoreData[CoreDataType.AllCourseTreeNode])["New"] as WebcastCourseTreeNode<Course>;
            if (newNode == null)
                newNode = new WebcastCourseTreeNode<Course>();
            //
            BuildSubNodes(newNode);
            //
            newNode.Name = "New";
            newNode.Tag = Resources.New;// "";
            //
            newNode.SetVector(CourseVectorBase.GetCoursVector(CourseDataManager.NewCourses));
            return newNode;
        }


        public static TreeNode GetLatestDataNode()
        {
            //
            WebcastCourseTreeNode<Course> lastNode = ((Dictionary<string, TreeNode>)Core.CoreData[CoreDataType.AllCourseTreeNode])["Last"] as WebcastCourseTreeNode<Course>;
            if (lastNode == null)
                lastNode = new WebcastCourseTreeNode<Course>();
            //
            BuildSubNodes(lastNode);
            //
            lastNode.Name = "Last";
            lastNode.Tag = Resources.Lastest;// "";
            //
            lastNode.SetVector(CourseVectorBase.GetCoursVector(CourseDataManager.LatestCourses));
            return lastNode;
        }

        #endregion
    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.