Example #1
0
        public void BringToFront(string wmText = "")
        {
            Execute.OnUIThreadAsync(() => playerWindow.Activate());

            //string clipboardText = Clipboard.GetText();
            string clipboardText = wmText;

            LoggerManager.Info($"Clipboard: ${clipboardText}");

            OpenURI(clipboardText);
        }
Example #2
0
        /// <summary>
        /// Dialog opened from:
        /// - Open Url button in menu
        /// - Open Url button on center of screen
        /// </summary>
        public void OpenUrl()
        {
            Execute.OnUIThread(() => IsFileSelected = false);
            string uri = OpenUrlViewModel.GetURI();

            if (uri == null)
            {
                LoggerManager.Info("User cancelled OpenURI window.");
                return;
            }
            OpenURI(uri);
        }
Example #3
0
        public void OpenURI(string uri)
        {
            SelectedServiceResult = null;

            Streaming.ServiceResult result = ServiceResultResolver.DialogProcessURIBlocking(uri, ShellViewModel.Instance.playerWindow);
            LoggerManager.Info($"OpenURI: Parsed '{uri}' to {result}");

            if (result == null)
            {
                urlLoadLock = false;
                return;
            }

            Execute.OnUIThread(() =>
            {
                ResetPlayback();

                LoadMedia(result);
            });
        }
Example #4
0
        //public bool CanOpenFile { get { return !IsPlaying; } }


        public void Stop()
        {
            LoggerManager.Info("File ended");
            if (Fullscreen)
            {
                if (!Logic.Instance.settings.DoNotExitFullscreenOnStop)
                {
                    ToggleFullscreen(true);
                }
            }
            //space press hack
            Execute.OnUIThread(() => shellView.VideoProgressBar.Focus());
            ShowBars();
            ShowStartupUI();

            LoggerManager.Info("Media stopped");

            this.DXCanvas.Scene = null;

            HeadsetStop();
            //headsets.ForEach(h => h.Stop());

            Execute.OnUIThread(() =>
            {
                shellView.TopBar.Visibility = Visibility.Hidden;
                this.DXCanvas.Visibility    = Visibility.Hidden;
            });

            Task.Factory.StartNew(() =>
            {
                if (IsPlaying || _mediaDecoder.IsEnded)
                {
                    _mediaDecoder.Stop();
                    ShellViewModel.SendEvent("movieStopped", Path.GetFileName(SelectedFileName));
                    //STATS
                    Logic.Instance.stats.TrackEvent("Application events", "Stop", "");

                    _timeValue = 0;
                    try
                    {
                        Execute.OnUIThread(() =>
                        {
                            NotifyOfPropertyChange(() => TimeValue);
                            NotifyOfPropertyChange(() => CanPlay);
                            CurrentPosition = (new TimeSpan(0, 0, 0)).ToString();
                            UpdateTimeLabel();

                            shellView.PlayPause.Visibility = Visibility.Visible;
                            shellView.Pause.Visibility     = Visibility.Collapsed;

                            this.DXCanvas.StopRendering();
                        });
                    }
                    catch (Exception) { }
                }
            });

            waitForPlaybackStop.Set();

            //SelectedServiceResult = null;

            NotifyOfPropertyChange(() => PlayerTitle);
            NotifyOfPropertyChange(() => CanStopOrRewind);
        }
Example #5
0
        protected override void OnViewLoaded(object view)
        {
            base.OnViewLoaded(view);

            IntPtr     windowHandle = new WindowInteropHelper(playerWindow).Handle;
            HwndSource source       = HwndSource.FromHwnd(windowHandle);

            source.AddHook(new HwndSourceHook(WndProc));

            this.DXCanvas.StopRendering();

            shellView.BufferingStatus.Visibility = Visibility.Collapsed;

            ShowStartupUI();

            if (!string.IsNullOrWhiteSpace(FileFromArgs))
            {
                LoggerManager.Info($"Opening URI from command line arguments: {FileFromArgs}");
                OpenURI(FileFromArgs);
            }

            Logic.Instance.CheckForUpdate();
#if FEATURE_BROWSER_PLUGINS
            BrowserPluginManagement.CheckForBrowsers();
#endif
            Logic.Instance.stats.TrackScreen("Start screen");
            Logic.Instance.stats.TrackEvent("Application events", "Init", "Player launched");

            //LegacyTest();

#if FEATURE_REMOTE_CONTROL
            if (Logic.Instance.settings.EnableRemoteControl)
            {
                EnableRemoteControl();
            }
#endif
            if (Logic.Instance.settings.UseBlackBackground)
            {
                shellView.mainGrid.Background = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black);
            }
            if (Logic.Instance.settings.DisableUI)
            {
                shellView.controlBar.Visibility = Visibility.Collapsed;
                shellView.TopBar.Visibility     = Visibility.Collapsed;
                shellView._OpenUrl.Visibility   = Visibility.Collapsed;
                shellView._OpenFile.Visibility  = Visibility.Collapsed;
            }

            Features.ListUpdated += LicenseUpdated;
#if FEATURE_LICENSE_NINJA
            licensingConnector.LicenseCheck();
#else
            // set hardcoded basic no-license-required features
            Features.SetBasicFeatures();
#endif

            InputDevices.NavigatorInputDevice.TryInit(windowHandle);

            var motdBridge = new MOTDBridge();
            motd = new MOTDClient("https://download.bivrost360.com/player-desktop/?action=", motdBridge);

            var currentVersion = motdBridge.Version;
            var prevVersion    = Logic.Instance.settings.LastStoredPlayerVersion;
            if (currentVersion != prevVersion)             //< first install or an update?
            {
                motd.RequestUpgradeNotice(prevVersion);
                Logic.Instance.settings.LastStoredPlayerVersion = currentVersion;
                Logic.Instance.settings.Save();
            }
            else
            {
                motd.RequestMOTD();
            }
        }