private async void Accept(object sender, RoutedEventArgs e) { if (!Creatable) return; Favorite favorite = new Favorite() { Name = location.Name, Address = location.Address, Description = location.Description, Collection = collection, Symbol = location.Symbol, Location = Location.Location, Timestamp = DateTime.Now }; // Its a new collection name, delete it from the old folder ... if (location is Favorite && collection != collectionBuffer) await (location as Favorite).Delete(); // ... and create a new Favorite in the right collection folder await favorite.SaveToFile(collection); // Set this as the new location Location = favorite; // Reset the Buffer locationBuffer = location; // Recreate the CommandBar CreateAppBarButtons(); //VisualStateManager.GoToState(this, "Default", true); // Because we added a State with an OnGoBackAction for this NavigationManager.Current.NavigateBack(); }
private async void Accept(object sender, RoutedEventArgs e) { if (!Creatable) return; Favorite favorite = new Favorite() { Name = name, Address = address, Description = description, Symbol = symbol, Location = Location.Location, Timestamp = DateTime.Now }; await favorite.SaveToFile(collection); State favState = new State() { Sheet = typeof(LocationSheet), MapCenter = favorite.Location, MapZoomLevel = 14 }; NavigationManager.Current.NavigateTo(favState, favorite); }