private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                IEnumerable <string> args     = Environment.GetCommandLineArgs().Skip(1);
                IntPtr         windowHandle   = new WindowInteropHelper(this).Handle;
                ServiceBuilder serviceBuilder = new ServiceBuilder()
                                                .WithArgs(args)
                                                .WithWindowHandler(windowHandle);

                DataContext = viewModel = new ViewModel(await serviceBuilder.Build());
            }
            catch (Exception exc)
            {
                MessageBox.Show(Utils.GetTypeMessageAndStack(exc), "Building service", MessageBoxButton.OK, MessageBoxImage.Error);
                throw;
            }

            try
            {
                IEnumerable <string> args = Environment.GetCommandLineArgs().Skip(1);

                hotKeys = new HotKeysBuilder().WithArgs(args).Build();

                hotKeys.Toggle_Pressed   += OnTogglePlayPause;
                hotKeys.Next_Pressed     += OnNext;
                hotKeys.Previous_Pressed += OnPrevious;
                hotKeys.Play_Pressed     += OnPlay;
                hotKeys.Pause_Pressed    += OnPause;
                hotKeys.Restart_Pressed  += OnRestart;

                hotKeys.Register();
            }
            catch (Exception exc)
            {
                MessageBox.Show(Utils.GetTypeMessageAndStack(exc), "Building hotkeys", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
        public HotKeysBuilder WithHotKeys(HotKeys hotKeys)
        {
            this.hotKeys = hotKeys;

            return(this);
        }
 public SettingsWindow(IAudioExtended service, HotKeys hotKeys)
     : this(new ServiceBuilder().WithService(service), new HotKeysBuilder().WithHotKeys(hotKeys))
 {
 }