Beispiel #1
0
        public void ShowSample()
        {
            ObjectIdCollection ids = PickObjectSet("Please pick the objects to be scheduled:");

            if (ids.Count == 0)
            {
                return;
            }

            Dictionary <RXClass, List <ObjectId> > classDictionary           = new Dictionary <RXClass, List <ObjectId> >();
            Dictionary <RXClass, List <ObjectId> > ineligibleClassDictionary = new Dictionary <RXClass, List <ObjectId> >();
            StringCollection eligibleClassNames = new StringCollection();

            eligibleClassNames.AddRange(PropertyDataServices.FindEligibleClassNames());
            foreach (ObjectId id in ids)
            {
                if (!eligibleClassNames.Contains(id.ObjectClass.Name))
                {
                    if (!ineligibleClassDictionary.ContainsKey(id.ObjectClass))
                    {
                        ineligibleClassDictionary[id.ObjectClass] = new List <ObjectId>();
                    }

                    ineligibleClassDictionary[id.ObjectClass].Add(id);
                }
                else
                {
                    if (!classDictionary.ContainsKey(id.ObjectClass))
                    {
                        classDictionary[id.ObjectClass] = new List <ObjectId>();
                    }

                    classDictionary[id.ObjectClass].Add(id);
                }
            }

            if (classDictionary.Keys.Count == 0)
            {
                GetEditor().WriteMessage("No eligible object is selected. Schedule table sample will now quit.");
                return;
            }

            UiData runtimeData = new UiData();

            runtimeData.classObjectIdsMap           = classDictionary;
            runtimeData.ineligibleClassObjectIdsMap = ineligibleClassDictionary;
            WizardSheetPropertySetDefinition sheetPsd = new WizardSheetPropertySetDefinition();
            WizardSheetScheduleTableStyle    sheetSts = new WizardSheetScheduleTableStyle();
            WizardSheetSummary sheetSummary           = new WizardSheetSummary();
            WizardManager      wizard = new WizardManager();

            wizard.AddSheet(sheetPsd);
            wizard.AddSheet(sheetSts);
            wizard.AddSheet(sheetSummary);
            wizard.RuntimeData = runtimeData;
            if (wizard.ShowWizard() == System.Windows.Forms.DialogResult.OK)
            {
                ScheduleTableCreateResult result = ScheduleTableCreateEx.CreateScheduleTable(runtimeData);
            }
        }
        public static Dictionary <string, List <RXClass> > GroupClassesByProperty(this Dictionary <RXClass, StringCollection> classPropertiesMap)
        {
            Dictionary <string, List <RXClass> > propertyClassesMap = new Dictionary <string, List <RXClass> >();

            foreach (RXClass objectType in classPropertiesMap.Keys)
            {
                foreach (string propertyName in classPropertiesMap[objectType])
                {
                    if (!propertyClassesMap.ContainsKey(propertyName))
                    {
                        propertyClassesMap[propertyName] = new List <RXClass>();
                    }
                    propertyClassesMap[propertyName].Add(objectType);
                }
            }
            return(propertyClassesMap);
        }
        void GenerateColumnHeaderByObjectType(RXClass objectType, StringCollection propertyNames, TreeNodeCollection nodes)
        {
            // First we categorize the properties.
            Dictionary <string, StringCollection> categorizedProperties = new Dictionary <string, StringCollection>();

            foreach (string propertyName in propertyNames)
            {
                string catName = GetCategoryName(propertyName);
                if (!categorizedProperties.ContainsKey(catName))
                {
                    categorizedProperties[catName] = new StringCollection();
                }
                categorizedProperties[catName].Add(propertyName);
            }
            // sort category names alphabetically
            List <string> sortedCatNames = new List <string>();

            foreach (string catName in categorizedProperties.Keys)
            {
                sortedCatNames.Add(catName);
            }
            sortedCatNames.Sort();
            // create category headers
            foreach (string catName in sortedCatNames)
            {
                TreeNode headerNode = nodes.Add(catName);
                // create columns
                List <string> sortedPropNames = new List <string>();
                string[]      propNames       = new string[categorizedProperties[catName].Count];
                categorizedProperties[catName].CopyTo(propNames, 0);
                sortedPropNames.AddRange(propNames);
                sortedPropNames.Sort();
                foreach (string propName in sortedPropNames)
                {
                    AddPropertyToNodeCollection(headerNode.Nodes, objectType, propName);
                }
            }
        }