private async void TimerCallback(object state)
        {
            KioskExperience nextKioskExperience = kioskRotation[nextKioskExperienceIndex];

            nextKioskExperienceIndex = (nextKioskExperienceIndex + 1) % kioskRotation.Length;

            await AppShell.Current.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                // Fade in the transition overlay
                AppShell.Current.AppOverlay.Opacity    = 0;
                AppShell.Current.AppOverlay.Visibility = Visibility.Visible;
                await new OpacityAnimation(1, TimeSpan.FromMilliseconds(1000)).Activate(AppShell.Current.AppOverlay);

                // Move out of the page into the Demo Launcher page. We do this so we shutdown the camera in the current experience before we go to the next one.
                AppShell.Current.NavigateToPage(typeof(DemoLauncherPage));

                // Wait some time
                await Task.Delay(2000);

                // Move to the new experience
                AppShell.Current.NavigateToExperience(nextKioskExperience);

                // Fade out the transition overlay
                await new OpacityAnimation(0, TimeSpan.FromMilliseconds(1000)).Activate(AppShell.Current.AppOverlay);
                AppShell.Current.AppOverlay.Visibility = Visibility.Collapsed;
            });
        }
Exemple #2
0
 public void NavigateToExperience(KioskExperience experience)
 {
     if (this.AppFrame.CurrentSourcePageType != experience.PageType)
     {
         NavigateToPage(experience.PageType);
     }
 }
        public async void Start()
        {
            // Stop current scheduler
            Stop();

            // Load the demo rotation
            DemoLauncherConfig config = await SettingsPage.LoadDemoRotationConfigFromFileAsync();

            kioskRotation = config.Entries.Where(entry => entry.Enabled).Select(entry => KioskExperiences.Experiences.First(exp => exp.Attributes.Id == entry.Id)).ToArray();

            if (kioskRotation.Length > 0)
            {
                // Shuffled the demo order
                Random random = new Random();
                for (int i = 0; i < kioskRotation.Length; i++)
                {
                    int             r    = random.Next(0, kioskRotation.Length);
                    KioskExperience temp = kioskRotation[r];
                    kioskRotation[r] = kioskRotation[i];
                    kioskRotation[i] = temp;
                }

                // Start the scheduler
                nextKioskExperienceIndex = 0;
                timer = new Timer(TimerCallback, null, TimeSpan.Zero, TimeSpan.FromMinutes(SettingsHelper.Instance.DemoRotationTimePerDemo));
            }
        }
Exemple #4
0
        public void NavigateToStartingPage()
        {
            KioskExperience startingExp = KioskExperiences.Experiences.FirstOrDefault(item => item.Attributes.Id == SettingsHelper.Instance.StartingPage);

            if (startingExp == null)
            {
                NavigateToPage(typeof(DemoLauncherPage));
                this.navView.SelectedItem = this.navlist.First();
            }
            else
            {
                NavigateToExperience(startingExp);
            }
        }