protected override async void OnNavigatedTo(NavigationEventArgs e) { Instance = this; // Set the map location. var locationTask = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() => { Map.LandmarksVisible = true; LoadMapElements(); if (e.Parameter != null && e.Parameter is string) { var par = (e.Parameter as string).Split(':'); if (par[0] == "showmap") { MoveMap(par[1], par[2]); } } var currentLocation = await Maps.GetCurrentLocationAsync(); if (currentLocation != null) { var icon = new MapIcon(); icon.Location = currentLocation; icon.NormalizedAnchorPoint = new Point(0.5, 0.5); icon.Image = RandomAccessStreamReference.CreateFromUri(new Uri("ms-appx:///Assets/Square44x44Logo.targetsize-30.png")); Map.MapElements.Add(icon); } }); CurrentAdventure = await DataProvider.Instance.GetCurrentAdventure(); List <UIElement> elementsToShow = new List <UIElement>(); if (await DataProvider.Instance.GetCurrentAdventure() == null) { elementsToShow.Add(MainControlsNewAdventureButtonContainer); elementsToShow.Add(MainControlsViewOldAdventuresButtonContainer); } else { elementsToShow.Add(MainControlsViewOldAdventuresButtonContainer); elementsToShow.Add(MainControlsCaptureButtonContainer); elementsToShow.Add(MainControlsUploadButtonContainer); elementsToShow.Add(MainControlsBrowseButtonContainer); } for (var i = 0; i < elementsToShow.Count; i++) { var elem = elementsToShow[i]; elem.Opacity = 0; elem.Visibility = Visibility.Visible; elem.Offset(0, 20, 0).Then().Offset().Fade(1).SetDuration(200).SetDelay(i * 100).Start(); } if (App.IsXbox()) { MainControlsCaptureButton.Focus(FocusState.Keyboard); return; } Task.Run <List <AdventureRemoteSystem> >(async() => { await Task.Delay(2000); return(await ConnectedService.Instance.FindAllRemoteSystemsHostingAsync()); }).AsAsyncOperation <List <AdventureRemoteSystem> >().Completed = (s, args) => { var systems = s.GetResults(); if (systems.Count > 0) { FindName("RemoteSystemContainer"); _system = systems.First(); DeviceTypeTextBlock.Text = _system.RemoteSystem.Kind.ToString(); RemoteSystemContainer.Opacity = 0; RemoteSystemContainer.Visibility = Visibility.Visible; RemoteSystemContainer.Scale(0.8f, 0.8f, (float)ActualWidth / 2, (float)ActualHeight / 2, 0) .Then().Scale(1, 1, (float)ActualWidth / 2, (float)ActualHeight / 2).Fade(1).Start(); } }; }
private void RemoteSystemCancelButton_Click(object sender, RoutedEventArgs e) { RemoteSystemContainer.Fade(0).Scale(0.8f, 0.8f, (float)ActualWidth / 2, (float)ActualHeight / 2).SetDurationForAll(200).Start(); }