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); }
private BitmapEx DrawKey() { var bitmap = LayoutContext.CreateBitmap(); var fontFamily = GlobalContext.Options.Theme.FontFamily; var combName = $"{_device.RealName.Split(' ')[0]}\n{_device.FriendlyName.Split(' ')[0]}"; DefaultDrawingAlgs.DrawText(bitmap, fontFamily, combName, GlobalContext.Options.Theme.ForegroundColor); if (_device.Mute) { DefaultDrawingAlgs.SelectElement(bitmap, GlobalContext.Options.Theme); } return(bitmap); }
private void Draw() { var bitmap = LayoutContext.CreateBitmap(); var fontFamily = GlobalContext.Options.Theme.FontFamily; DefaultDrawingAlgs.DrawText(bitmap, fontFamily, _action.Text, GlobalContext.Options.Theme.ForegroundColor); if (_action.Active) { DefaultDrawingAlgs.SelectElement(bitmap, GlobalContext.Options.Theme); } DrawInvoke(new [] { new LayoutDrawElement(new Location(0, 0), bitmap) }); }
private BitmapEx DrawKey() { var bitmap = LayoutContext.CreateBitmap(); var path = _session.SessionIdentifier.Split('|')[1]; path = path.Substring(0, path.Length - 40); path = DevicePathMapper.FromDevicePath(path); var process = Process.GetProcesses().FirstOrDefault(p => p.Id == _session.ProcessId); if (path == null && process != null) { try { path = process.MainModule.FileName; } catch { } } if (path != null) { var iconRepresentation = _audioSelectLayout._bitmapDownloadService.GetBitmapForExecutable(path).GetAwaiter().GetResult(); using (var iconBmpEx = iconRepresentation.CreateBitmap()) { BitmapHelpers.ResizeBitmap(iconBmpEx, bitmap); } } if (_session.Mute) { DefaultDrawingAlgs.SelectElement(bitmap, GlobalContext.Options.Theme); } return(bitmap); }
private BitmapEx Draw() { var bitmap = LayoutContext.CreateBitmap(); if (!string.IsNullOrEmpty(_options.Symbol)) { var fontFamily = FontService.Instance.AwesomeFontFamily; DefaultDrawingAlgs.DrawText(bitmap, fontFamily, _options.Symbol, GlobalContext.Options.Theme.ForegroundColor); } else { using (var iconRepresentation = _bitmapDownloadService.GetBitmapForExecutable(_options.Executable).Result) using (var iconBmpEx = iconRepresentation.CreateBitmap()) { BitmapHelpers.ResizeBitmap(iconBmpEx, bitmap); if (_selected) { DefaultDrawingAlgs.SelectElement(bitmap, GlobalContext.Options.Theme); } } } return(bitmap); }