Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
testCoreTweet
<Window x:Class="testCoreTweet.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="193.182" Width="664.773">
<Grid>
<Button x:Name="startSettingButton" Content="startSetting" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="99" Click="startSettingButton_Click"/>
<Label Content="Access here:" HorizontalAlignment="Left" Margin="114,10,0,0" VerticalAlignment="Top" Width="88"/>
<TextBox x:Name="pinUritextbox" HorizontalAlignment="Left" Height="23" Margin="207,10,0,0" VerticalAlignment="Top" Width="440"/>
<TextBox x:Name="pinTextbox" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Margin="67,48,0,0"/>
<Label Content="PIN:" HorizontalAlignment="Left" Margin="10,48,0,0" VerticalAlignment="Top" Width="52"/>
<Button x:Name="pinButton" Content="certificate" HorizontalAlignment="Left" Margin="207,47,0,0" VerticalAlignment="Top" Width="89" Click="pinButton_Click"/>
<TextBox x:Name="pinResultTextbox" HorizontalAlignment="Left" Height="23" Margin="329,48,0,0" Text="pinResultTextbox" VerticalAlignment="Top" Width="318"/>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CoreTweet;
namespace testCoreTweet
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
CoreTweet.Tokens tokens;
CoreTweet.OAuth.OAuthSession session;
const string ApiKey = "";
const string ApiSecret = "";
public MainWindow()
{
InitializeComponent();
}
private void startSettingButton_Click(object sender, RoutedEventArgs e)
{
session = OAuth.Authorize(ApiKey, ApiSecret);
pinUritextbox.Text = session.AuthorizeUri.ToString();
}
private void pinButton_Click(object sender, RoutedEventArgs e)
{
tokens = session.GetTokens(pinTextbox.Text);
pinResultTextbox.Text = tokens.ToString();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.