Exemple #1
0
            private BitmapEx DrawKey()
            {
                var bitmap = LayoutContext.CreateBitmap();

                var fontFamily = GlobalContext.Options.Theme.FontFamily;

                string icon = null;

                if (!_audioSelectLayout._options.Names.TryGetValue(_device.Id, out var combName))
                {
                    combName = $"{_device.RealName.Split(' ')[0]}\n{_device.FriendlyName.Split(' ')[0]}";
                }
                else
                {
                    switch (_device.Type)
                    {
                    case MediaDeviceType.Speakers:
                        icon = FontAwesomeRes.fa_volume_down;
                        break;

                    case MediaDeviceType.Phone:
                        icon = FontAwesomeRes.fa_phone;
                        break;

                    case MediaDeviceType.Digital:
                        icon = FontAwesomeRes.fa_usb;
                        break;

                    case MediaDeviceType.Monitor:
                        icon = FontAwesomeRes.fa_tv;
                        break;
                    }
                }

                if (icon != null)
                {
                    DefaultDrawingAlgs.DrawCaptionedIcon(bitmap, FontService.Instance.AwesomeFontFamily, icon, fontFamily, combName, combName, GlobalContext.Options.Theme.ForegroundColor);
                }
                else
                {
                    DefaultDrawingAlgs.DrawText(bitmap, fontFamily, combName, GlobalContext.Options.Theme.ForegroundColor);
                }

                if (_device.Id == _audioSelectLayout._defaultDeviceId)
                {
                    DefaultDrawingAlgs.SelectElement(bitmap, GlobalContext.Options.Theme);
                }

                return(bitmap);
            }