Exemplo n.º 1
0
        public async override void OnTick()
        {
            string title = String.Empty;

            if (String.IsNullOrEmpty(settings.Application) || (!settings.ShowVolume && !settings.ShowAppName))
            {
                return;
            }

            if (settings.ShowAppName)
            {
                title = settings.Application;
            }

            if (settings.ShowVolume)
            {
                var appInfo = (await AppVolume.GetVolumeApplicationsStatus()).Where(app => app.Name == settings.Application).FirstOrDefault();
                if (appInfo != null)
                {
                    // Append volume on new line if app name is also selected
                    title = title + (String.IsNullOrEmpty(title) ? "" : "\n") + Math.Round(appInfo.Volume * 100).ToString();
                }
            }

            await Connection.SetTitleAsync(title);
        }
        private async void FetchApplications()
        {
            // Get all the applications in the Volume Mixer
            settings.Applications = await AppVolume.GetVolumeApplicationsStatus();

            if (settings.Applications == null)
            {
                Logger.Instance.LogMessage(TracingLevel.WARN, $"{GetType()} GetVolumeApplicationsNames called but returned null");
                return;
            }
            Logger.Instance.LogMessage(TracingLevel.INFO, $"{GetType()} FetchApplication returned {settings.Applications.Count} volume apps");
            await SaveSettings();
        }