public void Execute(object parameter) { var split = (parameter as string)?.Split(':'); var(user, garment) = (split[0], split[1]); var wardrobe = DressingRoom.ForUser(user).AsT0; (Window.Current.Content as Frame).Navigate(typeof(EditClothesPage), (wardrobe, garment)); }
public void TestUserWardrobe() { OneOf <Wardrobe, IFailure> result = new UninitializedVariable(); Action act = () => result = DressingRoom.ForUser("TestUserOne"); act.Should().NotThrow(); var wardrobe = result.AsT0; wardrobe.Should().NotBeNull(); act = () => result = DressingRoom.ForUser("TestUserTwo"); act.Should().NotThrow(); var failure = result.AsT1; failure.Should().NotBeNull(); }
protected override void OnNavigatedTo(NavigationEventArgs e) { var target = e?.Parameter; var result = DressingRoom.ForUser(target as string); user = result.AsT0; // Paint elements with user profile color DataContext = user; if (user.Garments.Any()) { FillStatistics(); FillNotifications(); } // Preload weather information to avoid lag spike // when accessing combination page. Weather information // is cached for the next 30 minutes. new Thread(() => { Console.WriteLine(DressingRoom.WeatherData); }).Start(); }
public async void Execute(object parameter) { var split = (parameter as string)?.Split(':'); var(user, garment) = (split[0], split[1]); var confirm = new ConfirmDeleteGarment(); await confirm.ShowAsync(); if (confirm.Result is true) { DressingRoom.ForUser(user).Match(wardrobe => { wardrobe.RemoveGarment(garment); return(0); }, error => { return(-1); } ); (Window.Current.Content as Frame).Navigate(typeof(WardrobePage), DressingRoom.ForUser(user).AsT0); } }