Esempio n. 1
0
		private async void Button_Click(object sender, RoutedEventArgs e)
		{
			if (PINText != null && PINText.Length != 0)
			{
				ButtonText = "処理中";
				ButtonEnable = false;
				try
				{
					tokens = await CoreTweet.OAuth.GetTokensAsync(session, PINText);
                    var userdata = new UserData();

                    userdata.UserID = tokens.UserId.ToString();
                    userdata.UserName = tokens.ScreenName;
                    userdata.AccessToken = tokens.AccessToken;
                    userdata.AccessTokenSecret = tokens.AccessTokenSecret;

                    var rdl = new UserDataLoader(filename);
                    rdl.Userdata = userdata;
                    rdl.UserDataSave();
                }
                catch (CoreTweet.TwitterException exception)
				{
					string caption = "エラー";
					string message = "次のエラーが発生しました\n" + exception.Message.ToString();
					var button = MessageBoxButton.OK;
					MessageBox.Show(message, caption, button);
				}
				finally
				{
					Close();
				}
			}
		}
Esempio n. 2
0
        private bool LoadTokens()
        {
            var udl = new UserDataLoader(App.userprofile_filename);
            if (udl.Userdata != null)
            {
                tokens = udl.GetCoreTweetTokens(App.consumer_key, App.consumer_secret);
                userdata = udl.Userdata;
                UserNameText = userdata.UserName;
                StatusText = "認証成功";
                StartButtonEnable = true;

                return true;
            }
            else
            {
                StatusText = "認証してください";
                StartButtonEnable = false;

                return false;
            }
        }