private async Task <MultilayerPointSymbol> GetCurrentSymbol()
        {
            // If the style hasn't been opened, return.
            if (_emojiStyle == null)
            {
                return(null);
            }

            MultilayerPointSymbol faceSymbol = null;

            try
            {
                // Get the key that identifies the selected eye symbol (or an empty string if none selected).
                SymbolLayerInfo eyeLayerInfo = (SymbolLayerInfo)EyeSymbolList.SelectedItem;
                string          eyeLayerKey  = eyeLayerInfo != null ? eyeLayerInfo.Key : string.Empty;

                // Get the key that identifies the selected mouth symbol (or an empty string if none selected).
                SymbolLayerInfo mouthLayerInfo = (SymbolLayerInfo)MouthSymbolList.SelectedItem;
                string          mouthLayerKey  = mouthLayerInfo != null ? mouthLayerInfo.Key : string.Empty;

                // Get the key that identifies the selected hat symbol (or an empty string if none selected).
                SymbolLayerInfo hatLayerInfo = (SymbolLayerInfo)HatSymbolList.SelectedItem;
                string          hatLayerKey  = hatLayerInfo != null ? hatLayerInfo.Key : string.Empty;

                // Create a list of the symbol keys that identify the selected symbol layers, including the base (circle) symbol.
                List <string> symbolKeys = new List <string>
                {
                    _baseSymbolKey, eyeLayerKey, mouthLayerKey, hatLayerKey
                };

                // Get a multilayer point symbol from the style that contains the selected symbol layers.
                faceSymbol = await _emojiStyle.GetSymbolAsync(symbolKeys) as MultilayerPointSymbol;

                // Loop through all symbol layers and lock the color.
                foreach (SymbolLayer lyr in faceSymbol.SymbolLayers)
                {
                    // Changing the color of the symbol will not affect this layer.
                    lyr.IsColorLocked = true;
                }

                // Unlock the color for the base (first) layer. Changing the symbol color will change this layer's color.
                faceSymbol.SymbolLayers.First().IsColorLocked = false;

                // Set the symbol color from the combo box.
                if (FaceColorComboBox.SelectedItem != null)
                {
                    faceSymbol.Color = (Color)FaceColorComboBox.SelectedItem;
                }

                // Set the symbol size from the slider.
                faceSymbol.Size = SizeSlider.Value;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to create symbol: " + ex.Message, "Exception");
            }

            // Return the multilayer point symbol.
            return(faceSymbol);
        }
        private async Task ReadMobileStyle(string stylePath)
        {
            try
            {
                // Open the mobile style file at the provided path.
                _emojiStyle = await SymbolStyle.OpenAsync(stylePath);

                // Get the default style search parameters.
                SymbolStyleSearchParameters searchParams = await _emojiStyle.GetDefaultSearchParametersAsync();

                // Search the style with the default parameters to return all symbol results.
                IList <SymbolStyleSearchResult> styleResults = await _emojiStyle.SearchSymbolsAsync(searchParams);

                // Create an empty placeholder image to represent "no symbol" for each category.
                WinMedia.ImageSource emptyImage = WinMedia.Imaging.BitmapSource.Create
                                                      (2, 2, 96, 96,
                                                      WinMedia.PixelFormats.Indexed1,
                                                      new WinMedia.Imaging.BitmapPalette(new List <WinMedia.Color> {
                    WinMedia.Colors.Transparent
                }),
                                                      new byte[4],
                                                      1);

                // Create lists to contain the available symbol layers for each category of symbol and add an empty entry as default.
                List <SymbolLayerInfo> eyeSymbolInfos = new List <SymbolLayerInfo> {
                    new SymbolLayerInfo("", emptyImage, "")
                };
                List <SymbolLayerInfo> mouthSymbolInfos = new List <SymbolLayerInfo> {
                    new SymbolLayerInfo("", emptyImage, "")
                };
                List <SymbolLayerInfo> hatSymbolInfos = new List <SymbolLayerInfo>()
                {
                    new SymbolLayerInfo("", emptyImage, "")
                };

                // Loop through the results and put symbols into the appropriate list according to category.
                foreach (SymbolStyleSearchResult result in styleResults)
                {
                    // Get the symbol for this result.
                    MultilayerPointSymbol multiLayerSym = await result.GetSymbolAsync() as MultilayerPointSymbol;

                    // Create a swatch image from the symbol.
                    RuntimeImage swatch = await multiLayerSym.CreateSwatchAsync();

                    WinMedia.ImageSource symbolImage = await swatch.ToImageSourceAsync();

                    // Create a symbol layer info object to represent the symbol in the list.
                    // The symbol key will be used to retrieve the symbol from the style.
                    SymbolLayerInfo symbolInfo = new SymbolLayerInfo(result.Name, symbolImage, result.Key);

                    // Add the symbol layer info to the correct list for its category.
                    switch (result.Category)
                    {
                    case "Eyes":
                    {
                        eyeSymbolInfos.Add(symbolInfo);
                        break;
                    }

                    case "Mouth":
                    {
                        mouthSymbolInfos.Add(symbolInfo);
                        break;
                    }

                    case "Hat":
                    {
                        hatSymbolInfos.Add(symbolInfo);
                        break;
                    }
                    }
                }

                // Show the symbols in the category list boxes.
                EyeSymbolList.ItemsSource   = eyeSymbolInfos;
                MouthSymbolList.ItemsSource = mouthSymbolInfos;
                HatSymbolList.ItemsSource   = hatSymbolInfos;

                // Call a function to construct the current symbol (default yellow circle).
                Symbol faceSymbol = await GetCurrentSymbol();

                // Call a function to show a preview image of the symbol.
                await UpdateSymbolPreview(faceSymbol);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error reading symbols from style: " + ex.Message);
            }
        }