Exemple #1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ErrorReportingService.Initialize();

            Trace.WriteLine("App Application_Startup");

            if (!SingleInstanceAppMutex.TakeExclusivity())
            {
                Trace.WriteLine("App Application_Startup TakeExclusivity failed");
                Current.Shutdown();
                return;
            }

            ((ThemeManager)Resources["ThemeManager"]).SetTheme(ThemeData.GetBrushData());

            var deviceManager = DataModelFactory.CreateAudioDeviceManager();

            DiagnosticsService.Advise(deviceManager);

            _viewModel        = new MainViewModel(deviceManager);
            _viewModel.Ready += MainViewModel_Ready;

            _flyoutWindow = new FlyoutWindow(_viewModel, new FlyoutViewModel(_viewModel));
            _trayIcon     = new TrayIcon(new TrayViewModel(_viewModel));

            HotkeyService.Register(SettingsService.Hotkey);
            HotkeyService.KeyPressed += (_, __) => _viewModel.OpenFlyout();

            StartupUWPDialogDisplayService.ShowIfAppropriate();

            Trace.WriteLine($"App Application_Startup Exit");
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            ErrorReportingService.Initialize();

            Trace.WriteLine("App Application_Startup");

            if (!SingleInstanceAppMutex.TakeExclusivity())
            {
                Trace.WriteLine("App Application_Startup TakeExclusivity failed");
                Current.Shutdown();
                return;
            }

            ((ThemeManager)Resources["ThemeManager"]).SetTheme(ThemeData.GetBrushData());

            PlaybackDevicesViewModel        = new DeviceCollectionViewModel(DataModelFactory.CreateAudioDeviceManager(AudioDeviceKind.Playback));
            PlaybackDevicesViewModel.Ready += MainViewModel_Ready;

            FlyoutViewModel = new FlyoutViewModel(PlaybackDevicesViewModel);
            FlyoutWindow    = new FlyoutWindow(FlyoutViewModel);

            TrayViewModel              = new TrayViewModel(PlaybackDevicesViewModel);
            TrayViewModel.LeftClick    = new RelayCommand(() => FlyoutViewModel.OpenFlyout(FlyoutShowOptions.Pointer));
            TrayViewModel.OpenMixer    = new RelayCommand(OpenMixer);
            TrayViewModel.OpenSettings = new RelayCommand(OpenSettings);

            _trayIcon = new TrayIcon(TrayViewModel);
            FlyoutWindow.DpiChanged += (_, __) => TrayViewModel.DpiChanged();

            HotkeyManager.Current.Register(SettingsService.Hotkey);
            HotkeyManager.Current.KeyPressed += (hotkey) =>
            {
                if (hotkey.Equals(SettingsService.Hotkey))
                {
                    FlyoutViewModel.OpenFlyout(FlyoutShowOptions.Keyboard);
                }
            };

            StartupUWPDialogDisplayService.ShowIfAppropriate();

            Trace.WriteLine($"App Application_Startup Exit");
        }
Exemple #3
0
        public static void DumpAndShowData()
        {
            var allText = DumpDevices(DataModelFactory.CreateAudioDeviceManager(AudioDeviceKind.Playback));

            allText += DumpDevices(DataModelFactory.CreateAudioDeviceManager(AudioDeviceKind.Recording));
            allText += Environment.NewLine;
            allText += $"App: {(App.Current.HasIdentity() ? Package.Current.Id.Version.ToVersionString() : "dev")}" + Environment.NewLine;
            allText += $"BuildLabel: {SystemSettings.BuildLabel}" + Environment.NewLine;
            allText += $"First Party Addons: {string.Join(" ", Extensibility.Hosting.AddonManager.Current.BuiltIn.Select(a => a.DisplayName))}" + Environment.NewLine;
            allText += $"Third Party Addons: {string.Join(" ", Extensibility.Hosting.AddonManager.Current.ThirdParty.Select(a => a.DisplayName))}" + Environment.NewLine;
            allText += $"IsLightTheme: {SystemSettings.IsLightTheme}" + Environment.NewLine;
            allText += $"RTL: {SystemSettings.IsRTL}" + Environment.NewLine;
            allText += $"IsTransparencyEnabled: {SystemSettings.IsTransparencyEnabled}" + Environment.NewLine;
            allText += $"UseAccentColor: {SystemSettings.UseAccentColor}" + Environment.NewLine;
            allText += $"AnimationsEnabled: {SystemParameters.MenuAnimation}" + Environment.NewLine;
            allText += Environment.NewLine;
            allText += AppTrace.GetLogText();

            var fileName = $"{Path.GetTempFileName()}.txt";

            File.WriteAllText(fileName, allText);
            ProcessHelper.StartNoThrow(fileName);
        }