示例#1
0
        private async Task RunAsync(int id)
        {
            // Favorite the post with the id
            var y = YandeSettings.Current;

            await YandeClient.VoteAsync(id, y.UserName, y.PasswordHash, VoteType.Favorite);
        }
示例#2
0
 private async void LoginButton_Click(object sender, RoutedEventArgs e)
 {
     if (YandeUserNameTextBox.Text != "" && YandePasswordBox.Password != "")
     {
         // Login to yande
         await YandeClient.SignInAsync(YandeUserNameTextBox.Text, YandePasswordBox.Password);
     }
 }
示例#3
0
        private static async Task ChangeHostAsync(string host, string passwordHashSalt)
        {
            // Log out the user account from the current moebooru site
            YandeClient.SignOut();

            // Clear all wallpaper/lockscreen records as they are only identified with postId
            using (var db = new AppDbContext())
            {
                db.Database.ExecuteSqlCommand($"delete from {nameof(AppDbContext.WallpaperRecords)}; delete from {nameof(AppDbContext.LockScreenRecords)}");
            }

            // Change the site settings
            YandeSettings.Current.Host             = host;
            YandeSettings.Current.PasswordHashSalt = passwordHashSalt;

            // Close the app
            AppRestartFailureReason result = await CoreApplication.RequestRestartAsync("");
        }
示例#4
0
 private void LogoutButton_Click(object sender, RoutedEventArgs e)
 {
     YandeClient.SignOut();
 }
示例#5
0
        public async Task Unfavorite()
        {
            await YandeClient.RemoveFavoriteAsync(Post.Id);

            this.IsFavorited = false;
        }
示例#6
0
        public async Task Favorite()
        {
            await YandeClient.AddFavoriteAsync(Post.Id);

            this.IsFavorited = true;
        }
示例#7
0
 public async Task UpdateIsFavorited()
 {
     IsFavorited = await YandeClient.CheckFavorited(Post.Id);
 }