コード例 #1
0
        private void BackgroungVideo_MediaEnded(object sender, RoutedEventArgs e)
        {
            Uri nextVideo = backgroundVideoPlaylist.nextVideo();

            MainWindow.Instance.Log("Next BackgroundVideo - " + nextVideo.ToString().Substring(nextVideo.ToString().LastIndexOf("/") + 1));

            BackgroungVideo.Stop();
            BackgroungVideo.Source = nextVideo;
            BackgroungVideo.Play();
        }
コード例 #2
0
        private void BackgroundVideo_Loaded(object sender, RoutedEventArgs e)
        {
            MainWindow.Instance.Log("BackgroundVideo loaded");

            if (backgroundVideoPlaylist.currentVideo != null)
            {
                BackgroungVideo.Volume      = Settings.Instance.VideoVolume;
                BackgroungVideo.Source      = backgroundVideoPlaylist.currentVideo;
                BackgroungVideo.MediaEnded += BackgroungVideo_MediaEnded;
                BackgroungVideo.Play();
            }
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            this.InitializeComponent();

            if (!adminMode)
            {
                AppDomain.CurrentDomain.ProcessExit += (e, s) => {
                    NewsUpdateThread.Instance.StopUpdating();
                    Process.Start("ControlsBasics-WPF.exe");
                };
                AppDomain.CurrentDomain.UnhandledException += (e, s) => {
                    NewsUpdateThread.Instance.StopUpdating();
                    Process.Start("ControlsBasics-WPF.exe"); App.Current.Shutdown();
                };
            }

            instance = this;

            CheckTime();

            var_navigationRegion = navigationRegion;

            CreateData.Instance.GetAllVideos();
            CreateData.Instance.GetBackgroundVideos();
            CreateData.Instance.GetNewsFromFile();
            CreateData.Instance.GetGames();
            CreateData.Instance.GetAllTimetable();

            NewsUpdateThread.Instance.StartUpdating();

            KinectRegion.SetKinectRegion(this, kinectRegion);

            App app = ((App)Application.Current);

            app.KinectRegion = kinectRegion;

            handHelper = new HandOverHelper(kinectRegion, Dispatcher);

            // Use the default sensor
            this.kinectRegion.KinectSensor = KinectSensor.GetDefault();

            //// Add in display content
            var localDataSource = DataSource.GetGroup("Menu");

            history.Add("Menu");
            this.itemsControl.ItemTemplate = (DataTemplate)this.FindResource(localDataSource.TypeGroup + "Template");
            this.itemsControl.ItemsSource  = localDataSource;

            // Open a Main video when nowbody use system
            BodyFrameReader bodyFrameReader = this.kinectRegion.KinectSensor.BodyFrameSource.OpenReader();

            // set the BodyFramedArrived event notifier
            bodyFrameReader.FrameArrived += this.Reader_BodyFrameArrived;
            handHelper.OnHoverStart      += () =>
            {
                try
                {
                    UI(() =>
                    {
                        if (instance.BackgroungVideo.Visibility == Visibility.Visible)
                        {
                            UIInvoked();
                            MenuButton.Visibility = Visibility.Visible;
                        }
                    });
                }
                catch (Exception ex)
                {
                    Log(ex.Message);
                    throw;
                }
            };

            Cursor = adminMode ? Cursors.Arrow : Cursors.None;

            backgroundVideoPlaylist = new BackgroundVideoPlaylist();

            if (backgroundVideoPlaylist.currentVideo != null)
            {
                BackgroungVideo.Source      = backgroundVideoPlaylist.currentVideo;
                BackgroungVideo.MediaEnded += BackgroungVideo_MediaEnded;
                BackgroungVideo.Play();
            }

            string GesturePath = $@"{AppDomain.CurrentDomain.BaseDirectory}\GesturesDatabase\KinectGesture.gbd";

            if (File.Exists(GesturePath))
            {
                var eggVideoFile = $@"{AppDomain.CurrentDomain.BaseDirectory}\vgbtechs\kinectrequired.mp4";
                if (File.Exists(eggVideoFile))
                {
                    EggVideo.Source      = new Uri(eggVideoFile);
                    EggVideo.Visibility  = Visibility.Collapsed;
                    EggVideo.MediaEnded += (s, e) =>
                    {
                        BackgroungVideo.Volume = Settings.Settings.Volume;
                        EggVideo.Visibility    = Visibility.Collapsed;
                    };
                }

                int maxBodies = this.kinectRegion.KinectSensor.BodyFrameSource.BodyCount;
                for (int i = 0; i < maxBodies; ++i)
                {
                    GestureDetector detector = new GestureDetector(this.kinectRegion.KinectSensor);
                    detector.OnGestureFired += Detector_OnGestureFired;
                    this.gestureDetectorList.Add(detector);
                }
            }
        }
コード例 #4
0
 private void BackgroungVideo_MediaEnded(object sender, RoutedEventArgs e)
 {
     BackgroungVideo.Stop();
     BackgroungVideo.Source = backgroundVideoPlaylist.nextVideo();
     BackgroungVideo.Play();
 }