public Color this[String colorName]
            {
                get
                {
                    IntPtr name = IntPtr.Zero;
                    UInt32 colorType;

                    try
                    {
                        name      = Marshal.StringToHGlobalUni("Immersive" + colorName);
                        colorType = UXTheme.GetImmersiveColorTypeFromName(name);
                        if (colorType == 0xFFFFFFFF)
                        {
                            throw new InvalidOperationException();
                        }
                    }
                    finally
                    {
                        if (name != IntPtr.Zero)
                        {
                            Marshal.FreeHGlobal(name);
                            name = IntPtr.Zero;
                        }
                    }

                    return(this[colorType]);
                }
            }
 public Color this[UInt32 colorType]
 {
     get
     {
         UInt32 nativeColor = UXTheme.GetImmersiveColorFromColorSetEx(this._colorSet, colorType, false, 0);
         //if (nativeColor == 0)
         //    throw new InvalidOperationException();
         return(Color.FromArgb(
                    (Byte)((0xFF000000 & nativeColor) >> 24),
                    (Byte)((0x000000FF & nativeColor) >> 0),
                    (Byte)((0x0000FF00 & nativeColor) >> 8),
                    (Byte)((0x00FF0000 & nativeColor) >> 16)
                    ));
     }
 }
            // HACK: GetAllColorNames collects the available color names by brute forcing the OS function.
            //   Since there is currently no known way to retrieve all possible color names,
            //   the method below just tries all indices from 0 to 0xFFF ignoring errors.
            public List <String> GetAllColorNames()
            {
                List <String> allColorNames = new List <String>();

                for (UInt32 i = 0; i < 0xFFF; i++)
                {
                    IntPtr typeNamePtr = UXTheme.GetImmersiveColorNamedTypeByIndex(i);
                    if (typeNamePtr != IntPtr.Zero)
                    {
                        IntPtr typeName = (IntPtr)Marshal.PtrToStructure(typeNamePtr, typeof(IntPtr));
                        allColorNames.Add(Marshal.PtrToStringUni(typeName));
                    }
                }

                return(allColorNames);
            }
        protected override void OnStartup(StartupEventArgs e)
        {
            Color           accentColor = UXTheme.GetAccentColor();
            SolidColorBrush accentBrush = new SolidColorBrush(accentColor);

            Resources["Windows.Accent"] = accentBrush;

            VolWindow       = new VolumeWindow();
            ProjectorWindow = new ProjectorStatus();
            Parser          = new KeyComboParser();

            Parser.RegisterHotKey(ProjectorCombo);
            Parser.RegisterHotKey(VolUpCombo);
            Parser.RegisterHotKey(VolDownCombo);
            Parser.OnHotKeyReceived += HotKeyCallback;

            base.OnStartup(e);
        }