AcManager.Controls.UserControls.DynamicBackground.OnLoaded C# (CSharp) Method

OnLoaded() private method

private OnLoaded ( object sender, RoutedEventArgs e ) : void
sender object
e System.Windows.RoutedEventArgs
return void
        private async void OnLoaded(object sender, RoutedEventArgs e) {
            if (_loaded) return;
            _loaded = true;

            await Task.Delay(2000);

            try {
                _window = Window.GetWindow(this);
                if (_window == null) return;

                _window.Activated += Window_Activated;
                _window.Deactivated += Window_Deactivated;

                Player.StateChanged += Player_StateChanged;

                Player.Initialize(PluginsManager.Instance.GetPluginDirectory("VLC"), @"--ignore-config", @"--no-video-title", @"--no-sub-autodetect-file", @"--no-audio");
                Player.BeginStop(Stopped);
                _started = true;
            } catch (Exception ex) {
                NonfatalError.NotifyBackground(ControlsStrings.VideoViewer_CannotPlay, ControlsStrings.VideoViewer_CannotPlay_Commentary, ex);
            }
        }