Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
hinaloe committed Jul 4, 2015
1 parent 5dc00f2 commit 29e0dbe
Show file tree
Hide file tree
Showing 21 changed files with 1,151 additions and 0 deletions.
22 changes: 22 additions & 0 deletions TwVideoUp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22823.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TwVideoUp", "TwVideoUp\TwVideoUp.csproj", "{6E091039-EEF0-4093-B72D-EDD81ACAC493}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{6E091039-EEF0-4093-B72D-EDD81ACAC493}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6E091039-EEF0-4093-B72D-EDD81ACAC493}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6E091039-EEF0-4093-B72D-EDD81ACAC493}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6E091039-EEF0-4093-B72D-EDD81ACAC493}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions TwVideoUp/AboutApp.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Window x:Class="TwVideoUp.AboutApp"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TwVideoUp"
mc:Ignorable="d"
Title="About" Height="178" Width="320" WindowStyle="ToolWindow" ResizeMode="NoResize" ShowInTaskbar="False" SizeToContent="Width">
<Grid>
<TextBlock x:Name="AppNameBlock" HorizontalAlignment="Center" Height="47" Margin="10,9,10,0" TextWrapping="Wrap" Text="Twitter Video Uploader" VerticalAlignment="Top" Width="294" FontSize="24" TextAlignment="Center"/>
<TextBlock x:Name="AppVersionBlock" HorizontalAlignment="Left" Margin="232,61,0,0" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Height="51" Margin="2,0,0,0" TextWrapping="Wrap" VerticalAlignment="Bottom" >
Author: <Hyperlink RequestNavigate="Hyperlink_Nav" NavigateUri="https://twitter.com/hnle0">@hnle0</Hyperlink><LineBreak/>
Detail TVU: <Hyperlink RequestNavigate="Hyperlink_Nav" NavigateUri="https://blog.hinaloe.net/twvideoup/">https://blog.hinaloe.net/twvideoup/</Hyperlink><LineBreak/>
Powerd by <Hyperlink RequestNavigate="Hyperlink_Nav" NavigateUri="http://coretweet.github.io/">CoreTweet</Hyperlink>
</TextBlock>

</Grid>
</Window>
24 changes: 24 additions & 0 deletions TwVideoUp/AboutApp.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Diagnostics;
using System.Reflection;
using System.Windows;

namespace TwVideoUp
{
/// <summary>
/// AboutApp.xaml の相互作用ロジック
/// </summary>
public partial class AboutApp : Window
{
public AboutApp()
{
InitializeComponent();
AppVersionBlock.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
}

private void Hyperlink_Nav(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Process.Start(e.Uri.AbsoluteUri);
e.Handled = true;
}
}
}
29 changes: 29 additions & 0 deletions TwVideoUp/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="TwVideoUp.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<userSettings>
<TwVideoUp.Properties.Settings>
<setting name="token" serializeAs="String">
<value />
</setting>
<setting name="secret" serializeAs="String">
<value />
</setting>
</TwVideoUp.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
9 changes: 9 additions & 0 deletions TwVideoUp/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="TwVideoUp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TwVideoUp"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions TwVideoUp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace TwVideoUp
{
/// <summary>
/// App.xaml の相互作用ロジック
/// </summary>
public partial class App : Application
{
}
}
19 changes: 19 additions & 0 deletions TwVideoUp/AuthWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Window x:Class="TwVideoUp.AuthWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TwVideoUp"
mc:Ignorable="d"
Title="AuthWindow" Height="300" Width="300"
Loaded="Window_Loaded"
>
<Grid>
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="5,54,0,0" TextWrapping="Wrap" Text="1. 下記のURLにアクセスしてログインしてください。" VerticalAlignment="Top" Width="277"/>
<TextBlock x:Name="AuthLink" HorizontalAlignment="Left" Margin="10,74,0,0" TextWrapping="Wrap" VerticalAlignment="Top" ><Hyperlink NavigateUri="{Binding AuthUrl}" RequestNavigate="Hyperlink_RequestNavigate"><Run Text="{Binding AuthUrl}" /></Hyperlink></TextBlock>
<TextBlock x:Name="textBlock1" HorizontalAlignment="Left" Margin="10,142,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="14" Width="282"><Run Text="2. PINを以下に入力してください"/><LineBreak/><Run/></TextBlock>
<TextBox x:Name="pin" HorizontalAlignment="Left" Height="36" Margin="56,164,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="157" FontSize="24" IsEnabled="False"/>
<Button x:Name="authButton" Content="Auth" HorizontalAlignment="Left" Height="36" Margin="218,164,0,0" VerticalAlignment="Top" Width="64" FontSize="20" Click="authButton_Click"/>

</Grid>
</Window>
86 changes: 86 additions & 0 deletions TwVideoUp/AuthWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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.Shapes;
using CoreTweet;
using TwVideoUp.Core;



namespace TwVideoUp
{
/// <summary>
/// AuthWindow.xaml の相互作用ロジック
/// </summary>
public partial class AuthWindow : Window
{
public AuthWindow()
{
InitializeComponent();
}

private CoreTweet.OAuth.OAuthSession session;
private CoreTweet.Tokens tokens;


private void Window_Loaded(object sender, RoutedEventArgs e)
{
DataContext = new db
{
AuthUrl = "",
};
var bindings = DataContext as db;
session = OAuth.Authorize(Twitter.CK, Twitter.CS);
bindings.AuthUrl = session.AuthorizeUri.ToString();
pin.IsEnabled = true;
}
private class db
{
public string AuthUrl { get; set; }
}

private void authButton_Click(object sender, RoutedEventArgs e)
{
var bindings = DataContext as db;
var code = pin.Text;
try
{
tokens = session.GetTokens(code);
}
catch(CoreTweet.TwitterException ex)
{
System.Windows.MessageBox.Show("エラーが発生しました、もう一度やり直してください\n" + ex.Message,
"info", MessageBoxButton.OK, MessageBoxImage.Error);
return;

}
catch (System.Net.WebException ex)
{
System.Windows.MessageBox.Show("エラーが発生しました、もう一度やり直してください\n" + ex.Message,
"info", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}

Properties.Settings.Default.token = tokens.AccessToken;
Properties.Settings.Default.secret = tokens.AccessTokenSecret;
Properties.Settings.Default.Save();
Close();

}

private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
System.Diagnostics.Process.Start(e.Uri.AbsoluteUri);
e.Handled = true;
}
}
}
8 changes: 8 additions & 0 deletions TwVideoUp/Core/Twitter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace TwVideoUp.Core
{
class Twitter
{
public const string CK = "qw2T5m4KTyEHOQWkeNn3yK6HX";
public const string CS = "sRd31tOuPUbQyV2xj2W22c8du25xtZZJj0J3EtMlLcqgQifuSb";
}
}
27 changes: 27 additions & 0 deletions TwVideoUp/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Window x:Class="TwVideoUp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:TwVideoUp"
mc:Ignorable="d"
Title="Twitter Video Uploader" Height="350" Width="420">
<Grid>
<MediaElement x:Name="mediaElement" Margin="10,10,10,134" Source="{Binding Media}" LoadedBehavior="Manual" SourceUpdated="mediaElement_SourceUpdated" UnloadedBehavior="Pause" />
<ProgressBar x:Name="PGbar" HorizontalAlignment="Right" Height="10" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="79" Value="{Binding Fin}" ValueChanged="ProgressBar_ValueChanged"/>
<TextBox x:Name="StatusArea" HorizontalAlignment="Left" Height="56" Margin="10,0,0,73" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="392" ToolTip="Tweet text" Text="{Binding Status}"/>
<Button x:Name="pickerCaller" Content="Select" HorizontalAlignment="Left" Height="25" Margin="10,0,0,43" VerticalAlignment="Bottom" Width="60" Click="pickerCaller_Click" />
<Button x:Name="SendTweetButton" Content="Tweet" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="59" Margin="343,0,0,43" Height="25" Click="SendTweetButton_Click"/>
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="28" Margin="10,0,0,9" VerticalAlignment="Bottom" Width="228">
<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Left">
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" Height="18" Margin="9,9,0,-1" TextWrapping="Wrap" Text="Preview:" VerticalAlignment="Top" Width="65"/>
<Button Click="m_JumpButton_Click" FontFamily="Webdings" ToolTip="Back">9</Button>
<Button Click="m_PauseButton_Click" FontFamily="Webdings" ToolTip="Pause">;</Button>
<Button Click="m_PlayButton_Click" FontFamily="Webdings" ToolTip="Play">4</Button>
<Button Click="m_OpenWindow_Click" FontFamily="Webdings" ToolTip="Open Preview Window">2</Button>
</StackPanel>
</Border>


</Grid>
</Window>
Loading

0 comments on commit 29e0dbe

Please sign in to comment.