コード例 #1
0
        /// <summary>
        /// Create a new Color Options package
        /// </summary>
        /// <param name="newpkg">The Package the color Option should be added to</param>
        /// <param name="ask">if ask is true, a Dialog will be displayed that lets the
        /// user decide which Subsets to recolor</param>
        public void Create(IPackageFile newpkg)
        {
            WaitingScreen.Wait();
            try
            {
                //this.newpkg = newpkg;

                WaitingScreen.UpdateMessage("Loading available Color Options");
                Hashtable fullmap        = Scenegraph.GetMMATMap(package);
                Hashtable map            = fullmap;
                ArrayList allowedSubsets = Scenegraph.GetRecolorableSubsets(package);

                //Check if the User can select a Subset
                bool userselect = false;
                if (map.Count > 1)
                {
                    userselect = true;
                }
                else
                {
                    if (map.Count == 1)
                    {
                        foreach (string s in map.Keys)
                        {
                            Hashtable ht = (Hashtable)map[s];
                            if (ht.Count > 1)
                            {
                                userselect = true;
                            }
                        }
                    }
                }

                //let the user Select now
                if (userselect)
                {
                    map = SubsetSelectForm.Execute(map, allowedSubsets);
                }



                ProcessMmatMap(newpkg, map, fullmap);
            }
            finally
            {
                WaitingScreen.Stop();
            }
        }
コード例 #2
0
        /// <summary>
        /// Create a new Color Options package
        /// </summary>
        /// <param name="newpkg">The Package the color Option should be added to</param>
        /// <param name="fkt">The function that ahs to be called wne the Selection should be displayed</param>
        public void Create(IPackageFile newpkg, CreateSelectionCallback fkt)
        {
            WaitingScreen.Wait();
            try
            {
                //this.newpkg = newpkg;

                WaitingScreen.UpdateMessage("Loading available Color Options");
                Hashtable fullmap        = Scenegraph.GetMMATMap(package);
                Hashtable map            = fullmap;
                ArrayList allowedSubsets = Scenegraph.GetRecolorableSubsets(package);

                //Check if the User can select a Subset
                bool userselect = false;
                if (map.Count > 1)
                {
                    userselect = true;
                }
                else
                {
                    if (map.Count == 1)
                    {
                        foreach (string s in map.Keys)
                        {
                            Hashtable ht = (Hashtable)map[s];
                            if (ht.Count > 1)
                            {
                                userselect = true;
                            }
                        }
                    }
                }

                SubsetSelectForm ssf = SubsetSelectForm.Prepare(map, allowedSubsets);
                fkt(ssf, userselect, fullmap);
            }
            finally
            {
                WaitingScreen.Stop();
            }
            return;

            /*string[] subsets = GetSubsets();
             *
             * //let the user Select
             * if ((subsets.Length>1) && (ask))
             * {
             *      Listing l = new Listing();
             *      subsets = l.Execute(subsets);
             * }
             *
             * WaitingScreen.Wait();
             * WaitingScreen.UpdateMessage("Getting slave Subsets");
             * SubsetItem[] subsetsi = GetSlaveSubsets(subsets);
             *
             * WaitingScreen.UpdateMessage("Getting Resource Nodes");
             * ArrayList cres = GetCresNames(subsetsi);
             *
             * WaitingScreen.UpdateMessage("Getting Material Overrides");
             * Hashtable mmats = GetMMATs(subsetsi, cres);
             * ArrayList guids = GetGUIDs();
             *
             * LoadSubSetList(mmats, guids, subsetsi);
             *
             * WaitingScreen.UpdateMessage("Load LIFO Files");
             * GetLifoFiles();
             *
             * WaitingScreen.Stop();*/
        }