コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: TestWardrobe.cs プロジェクト: carlubian/Vestis
        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();
        }
コード例 #3
0
ファイル: UserPage.xaml.cs プロジェクト: carlubian/Vestis
        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();
        }
コード例 #4
0
        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);
            }
        }