private async Task InitializeAsync() { try { await Task.Run(() => { _audioSourceLoader.LoadAudioSources(); Options.ContextMenuItems = BuildContextMenu(); InitializeModels(); }).ConfigureAwait(false); _settingsWindowVm = await SetupViewModels().ConfigureAwait(false); await _uiDispatcher.InvokeAsync(() => { _settingsWindow = new SettingsWindow(_settingsWindowVm); _settingsWindow.Saved += Saved; _settingsWindow.Canceled += Canceled; ElementHost.EnableModelessKeyboardInterop(_settingsWindow); }); await SelectAudioSourceFromSettings().ConfigureAwait(false); Logger.Debug("Initialization complete"); } catch (Exception e) { Logger.Error(e); } }
/// <summary> /// Initializes a new instance of the <see cref="SettingsWindow"/> class /// with the settings viewmodel. /// </summary> /// <param name="vm">The settings window viewmodel.</param> /// <param name="audioBandVM">The audioband view model</param> /// <param name="albumArtPopupVM">The album art popup view model</param> /// <param name="albumArtVM">The album art view model</param> /// <param name="customLabelsVM">The custom labels view model</param> /// <param name="aboutVm">The about dialog view model</param> /// <param name="nextButtonVM">The next button view model</param> /// <param name="playPauseButtonVM">The play/pause button view model</param> /// <param name="previousButtonVM">The previous button view model</param> /// <param name="progressBarVM">The progress bar view model</param> public SettingsWindow( SettingsWindowVM vm, AudioBandVM audioBandVM, AlbumArtPopupVM albumArtPopupVM, AlbumArtVM albumArtVM, CustomLabelsVM customLabelsVM, AboutVM aboutVm, NextButtonVM nextButtonVM, PlayPauseButtonVM playPauseButtonVM, PreviousButtonVM previousButtonVM, ProgressBarVM progressBarVM) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; ElementHost.EnableModelessKeyboardInterop(this); CancelCloseCommand = new RelayCommand(CancelCloseCommandOnExecute); SaveCloseCommand = new RelayCommand(SaveCloseCommandOnExecute); AudioBandVM = audioBandVM; AlbumArtPopupVM = albumArtPopupVM; AlbumArtVM = albumArtVM; CustomLabelsVM = customLabelsVM; AboutVM = aboutVm; NextButtonVM = nextButtonVM; PlayPauseButtonVM = playPauseButtonVM; PreviousButtonVM = previousButtonVM; ProgressBarVM = progressBarVM; InitializeComponent(); DataContext = vm; _vm = vm; Activated += OnActivated; }
public SettingsWindow() { InitializeComponent(); DwmDropShadow.DropShadowToWindow(this); DataContext = new SettingsWindowVM(this); }
public Settings() { InitializeComponent(); viewModel = new SettingsWindowVM(); this.DataContext = viewModel; RefreshControls(); }
/// <summary> /// Initializes a new instance of the <see cref="SettingsWindow"/> class /// with the settings viewmodel. /// </summary> /// <param name="vm">The settings window viewmodel.</param> internal SettingsWindow(SettingsWindowVM vm) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; CancelCloseCommand = new RelayCommand(CancelCloseCommandOnExecute); SaveCloseCommand = new RelayCommand(SaveCloseCommandOnExecute); InitializeComponent(); DataContext = vm; vm.CustomLabelsVM.DialogService = new DialogService(this); }
private async Task InitializeAsync() { try { Logger.Debug("Initialization started"); await Task.Run(() => { _audioSourceContextMenuItems = new List <DeskBandMenuAction>(); _settingsMenuItem = new DeskBandMenuAction("Audio Band Settings"); _settingsMenuItem.Clicked += SettingsMenuItemOnClicked; RefreshContextMenu(); InitializeModels(); }).ConfigureAwait(false); _settingsWindowVm = await SetupViewModels().ConfigureAwait(false); await _uiDispatcher.InvokeAsync(() => { _settingsWindow = new SettingsWindow(_settingsWindowVm); _settingsWindow.Saved += SettingsWindowOnSaved; _settingsWindow.Canceled += SettingsWindowOnCanceled; ElementHost.EnableModelessKeyboardInterop(_settingsWindow); }); _audioSourceManager = new AudioSourceManager(); _audioSourceManager.AudioSources.CollectionChanged += AudioSourcesOnCollectionChanged; _audioSourceManager.LoadAudioSources(); Logger.Debug("Initialization complete"); } catch (Exception e) { Logger.Error(e, "Error during initialization"); } }