Exemple #1
0
        private static void CreateAllPaletteSets()
        {
            Array paletteSetTypes = Enum.GetValues(typeof(PaletteSetType));

            _allPaletteSets = new PaletteSetBase[paletteSetTypes.Length];

            foreach (PaletteSetType type in paletteSetTypes)
            {
                PaletteSetBase paletteSet;
                switch (type)
                {
                case PaletteSetType.MapClean:
                    paletteSet = new MapCleanPaletteSet();
                    break;

                case PaletteSetType.ActionSequence:
                    paletteSet = new ActionSequencePaletteSet();
                    break;

                default:
                    throw new InvalidOperationException("Invalid palette set type: " + type.ToString());
                }

                _allPaletteSets[(int)type] = paletteSet;
            }
        }
Exemple #2
0
        /// <summary>
        /// Show the palette by palette type and document.
        /// </summary>
        /// <param name="paletteSetType"></param>
        /// <param name="document"></param>
        /// <returns></returns>
        public static PaletteSetBase DisplayPaletteSet(PaletteSetType paletteSetType, Document document)
        {
            PaletteSetBase paletteSet = null;

            if (_allPaletteSets == null)
            {
                var paletteSetTypes = Enum.GetValues(typeof(PaletteSetType));
                _allPaletteSets = new PaletteSetBase[paletteSetTypes.Length];
            }
            else
            {
                paletteSet = _allPaletteSets[(int)paletteSetType];
            }

            if (paletteSet == null)
            {
                switch (paletteSetType)
                {
                case PaletteSetType.MapClean:
                    paletteSet = new MapCleanPaletteSet();
                    break;

                case PaletteSetType.ActionSequence:
                    paletteSet = new ActionSequencePaletteSet();
                    break;

                default:
                    return(null);
                }

                _allPaletteSets[(int)paletteSetType] = paletteSet;
            }

            paletteSet.Show(document);
            return(paletteSet);
        }