private async void DemoRotationFlyoutOpened(object sender, object e) { // Load from file this.demoRotationConfig = await LoadDemoRotationConfigFromFileAsync(); this.UpdateDemoRotationEntriesUI(); }
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)); } }
private async Task SaveDemoAvailability(DemoLauncherConfig config) { XmlSerializer serializer = new XmlSerializer(typeof(DemoLauncherConfig)); StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync("DemoLauncherConfig.xml", CreationCollisionOption.ReplaceExisting); using (Stream stream = await file.OpenStreamForWriteAsync()) { serializer.Serialize(stream, config); } }