Last active
August 29, 2015 14:06
-
-
Save ustreamer-01647/90eace6f0f2bee354412 to your computer and use it in GitHub Desktop.
CoreTweet テスト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="coretweettest.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="MainWindow" Height="482.955" Width="669.318"> | |
<Grid> | |
<Button x:Name="verifyButton" Content="認証開始" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="75" Click="verifystartButton_Click"/> | |
<Label Content="承認アドレス:" HorizontalAlignment="Left" Margin="107,10,0,0" VerticalAlignment="Top" Width="81"/> | |
<TextBox x:Name="pinTextbox" HorizontalAlignment="Left" Height="23" Margin="84,52,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" RenderTransformOrigin="0.28,0.555"/> | |
<Button x:Name="pinVerifyButton" Content="PIN認証" HorizontalAlignment="Left" Margin="221,51,0,0" VerticalAlignment="Top" Width="75" Click="pinButton_Click"/> | |
<Label x:Name="pinLabel" Content="PIN:" HorizontalAlignment="Left" Margin="15,51,0,0" VerticalAlignment="Top" Width="49"/> | |
<Button x:Name="getHometimeline" Content="getHometimeline" HorizontalAlignment="Left" Margin="10,97,0,0" VerticalAlignment="Top" Width="137" Click="getHometimelineButton_Click"/> | |
<TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="286" Margin="10,157,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="641" VerticalScrollBarVisibility="Auto"/> | |
<TextBox x:Name="verifylinkTextbox" HorizontalAlignment="Left" Height="23" Margin="206,10,0,0" VerticalAlignment="Top" Width="411"/> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 coretweettest | |
{ | |
/// <summary> | |
/// MainWindow.xaml の相互作用ロジック | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
string apikey = "94LiuiGwmekn0FAzCjABKPOmf"; | |
string apisecret = "Chl4nuDSvXnxtnSp6j0uv8gier8IyJLdLg9UQDcx6evfGRLhs3"; | |
CoreTweet.Tokens tokens; | |
OAuth.OAuthSession session; | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
private void getHometimelineButton_Click(object sender, RoutedEventArgs e) | |
{ | |
foreach (var status in tokens.Statuses.HomeTimeline()) | |
textBox1.AppendText( | |
string.Format("@{0}: {1}", status.User.ScreenName, status.Text) | |
); | |
} | |
private void verifystartButton_Click(object sender, RoutedEventArgs e) | |
{ | |
verifylinkTextbox.Clear(); | |
session = OAuth.Authorize(apikey, apisecret); | |
verifylinkTextbox.Text = session.AuthorizeUri.ToString(); | |
} | |
private void pinButton_Click(object sender, RoutedEventArgs e) | |
{ | |
tokens = session.GetTokens(pinTextbox.Text); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment