public AppItemViewModel(IAudioMixerViewModelCallback callback, EarTrumpetAudioSessionModelGroup sessions) { _sessions = sessions; // select a session at random as sndvol does. var session = _sessions.Sessions.First(); IconHeight = IconWidth = 24; SessionId = session.SessionId; ProcessId = session.ProcessId; ExeName = GetExeName(session.DisplayName); IsDesktop = session.IsDesktop; _volume = Convert.ToInt32(Math.Round((session.Volume * 100), MidpointRounding.AwayFromZero)); _isMuted = session.IsMuted; _callback = callback; if (session.IsDesktop) { try { if (Path.GetExtension(session.IconPath) == ".dll") { Icon = IconService.GetIconFromFileAsImageSource(session.IconPath); } else { // override for SpeechRuntime.exe (Repo -> HEY CORTANA) if (session.IconPath.ToLowerInvariant().Contains("speechruntime.exe")) { var sysType = Environment.Is64BitOperatingSystem ? "SysNative" : "System32"; Icon = IconService.GetIconFromFileAsImageSource(Path.Combine("%windir%", sysType, "Speech\\SpeechUX\\SpeechUXWiz.exe"), 0); } else { Icon = System.Drawing.Icon.ExtractAssociatedIcon(session.IconPath).ToImageSource(); } } } catch { // ignored } if (Icon == null) { Background = new SolidColorBrush(AccentColorService.GetColorByTypeName("ImmersiveSystemAccent")); } else { Background = new SolidColorBrush(Colors.Transparent); } } else { if (File.Exists(session.IconPath)) //hack until we invoke the resource manager correctly. { Icon = new BitmapImage(new Uri(session.IconPath)); } Background = new SolidColorBrush(AccentColorService.FromABGR(session.BackgroundColor)); } }