Skip to content
Browse files

First Commit

  • Loading branch information...
0 parents commit ce573b289c638848c1fa96d1c9a219ec466db428 = committed Apr 15, 2011
Showing with 2,020 additions and 0 deletions.
  1. +20 −0 InWFExample.sln
  2. +7 −0 InWFExample/App.config
  3. +65 −0 InWFExample/Authorize.Designer.cs
  4. +104 −0 InWFExample/Authorize.cs
  5. +120 −0 InWFExample/Authorize.resx
  6. +104 −0 InWFExample/InWFExample.csproj
  7. +5 −0 InWFExample/InWFExample.csproj.user
  8. +344 −0 InWFExample/MainForm.Designer.cs
  9. +88 −0 InWFExample/MainForm.cs
  10. +120 −0 InWFExample/MainForm.resx
  11. +20 −0 InWFExample/Program.cs
  12. +36 −0 InWFExample/Properties/AssemblyInfo.cs
  13. +71 −0 InWFExample/Properties/Resources.Designer.cs
  14. +117 −0 InWFExample/Properties/Resources.resx
  15. +30 −0 InWFExample/Properties/Settings.Designer.cs
  16. +7 −0 InWFExample/Properties/Settings.settings
  17. BIN InWFExample/bin/Debug/InWFExample.exe
  18. +7 −0 InWFExample/bin/Debug/InWFExample.exe.config
  19. BIN InWFExample/bin/Debug/InWFExample.pdb
  20. BIN InWFExample/bin/Debug/InWFExample.vshost.exe
  21. +7 −0 InWFExample/bin/Debug/InWFExample.vshost.exe.config
  22. +13 −0 InWFExample/bin/Debug/OfflineDocs/Completed.htm
  23. +11 −0 InWFExample/bin/Debug/OfflineDocs/Navigating.htm
  24. BIN InWFExample/bin/Debug/OfflineDocs/completed.png
  25. BIN InWFExample/bin/Debug/OfflineDocs/loading.gif
  26. +380 −0 InWFExample/oAuthExt/oAuthBase2.cs
  27. +334 −0 InWFExample/oAuthExt/oAuthLinkedIn.cs
  28. BIN InWFExample/obj/Debug/InWFExample.Authorize.resources
  29. BIN InWFExample/obj/Debug/InWFExample.MainForm.resources
  30. BIN InWFExample/obj/Debug/InWFExample.Properties.Resources.resources
  31. +10 −0 InWFExample/obj/Debug/InWFExample.csproj.FileListAbsolute.txt
  32. BIN InWFExample/obj/Debug/InWFExample.csproj.GenerateResource.Cache
  33. BIN InWFExample/obj/Debug/InWFExample.exe
  34. BIN InWFExample/obj/Debug/InWFExample.pdb
  35. 0 README
20 InWFExample.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InWFExample", "InWFExample\InWFExample.csproj", "{9AF11DCC-09B1-4296-946A-8627588A1E9D}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9AF11DCC-09B1-4296-946A-8627588A1E9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9AF11DCC-09B1-4296-946A-8627588A1E9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9AF11DCC-09B1-4296-946A-8627588A1E9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9AF11DCC-09B1-4296-946A-8627588A1E9D}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
7 InWFExample/App.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="LiApiKey" value="5s5OSkySDF_mG_dLkduT3l7gokQ68hBtEpY5a9ebJVDH2r5BG8Opb6mUQhPgmQEB"/>
+ <add key="LiSecretKey" value="-WqKoGLodqWeVr9WqeOHnJG3xnPGJ2VynLb4ojZ-hnxbWreYH-ZQy_lfBghdEawN" />
+ </appSettings>
+</configuration>
65 InWFExample/Authorize.Designer.cs
@@ -0,0 +1,65 @@
+namespace InWFExample
+{
+ partial class Authorize
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.webBrowser1 = new System.Windows.Forms.WebBrowser();
+ this.SuspendLayout();
+ //
+ // webBrowser1
+ //
+ this.webBrowser1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.webBrowser1.Location = new System.Drawing.Point(0, 0);
+ this.webBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
+ this.webBrowser1.Name = "webBrowser1";
+ this.webBrowser1.Size = new System.Drawing.Size(672, 382);
+ this.webBrowser1.TabIndex = 0;
+ this.webBrowser1.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.webBrowser1_Navigating);
+ this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
+ this.webBrowser1.LocationChanged += new System.EventHandler(this.webBrowser1_LocationChanged);
+ this.webBrowser1.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.webBrowser1_Navigated);
+ //
+ // Authorize
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(672, 382);
+ this.Controls.Add(this.webBrowser1);
+ this.Name = "Authorize";
+ this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+ this.Text = "Verifier";
+ this.Load += new System.EventHandler(this.Verifier_Load);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.WebBrowser webBrowser1;
+ }
+}
104 InWFExample/Authorize.cs
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace InWFExample
+{
+ public partial class Authorize : Form
+ {
+ public delegate void AuthorizeCompletedDelegate(string oauth_token, string oauth_verifier);
+ public event AuthorizeCompletedDelegate AuthorizeCompleted;
+ private Timer tmrCloseCheck = new Timer();
+ public Authorize()
+ {
+ InitializeComponent();
+ }
+
+ private void Verifier_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ private void ShowOfflienContent(string offlineUrl)
+ {
+ String sitePath = null;
+ try
+ {
+ sitePath = Application.StartupPath + @"\OfflineDocs\" + offlineUrl;
+ webBrowser1.Navigate(sitePath);
+ }
+ catch (Exception exp)
+ {
+ MessageBox.Show(exp.ToString() + "\nSite Path: " + sitePath);
+ }
+ }
+
+ public void Navigate(string url)
+ {
+ ShowOfflienContent("Navigating.htm");
+ webBrowser1.Navigate(url);
+ }
+
+ private string oauth_token = null;
+ private string oauth_verifier = null;
+
+ private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ {
+ string responsed = e.Url.ToString();
+ if (responsed.StartsWith("http://localhost/inverify"))
+ {
+ responsed = responsed.Replace("http://localhost/inverify?", "");
+ string[] args = responsed.Split('&');
+ foreach(string arg in args)
+ {
+ string[] values = arg.Split('=');
+ if(values[0] == "oauth_token")
+ oauth_token = values[1];
+
+ if(values[0] == "oauth_verifier")
+ oauth_verifier = values[1];
+ }
+ }
+
+ if (oauth_token != null && oauth_verifier != null)
+ {
+ if (AuthorizeCompleted != null)
+ {
+ AuthorizeCompleted(oauth_token, oauth_verifier);
+ oauth_token = null;
+ oauth_verifier = null;
+ }
+ tmrCloseCheck.Interval = 2000;
+ tmrCloseCheck.Tick += new EventHandler(tmrCloseCheck_Tick);
+ tmrCloseCheck.Start();
+ ShowOfflienContent("Completed.htm");
+ }
+ }
+
+ void tmrCloseCheck_Tick(object sender, EventArgs e)
+ {
+ tmrCloseCheck.Stop();
+ tmrCloseCheck.Dispose();
+ this.Close();
+ }
+
+ private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
+ {
+ System.Diagnostics.Debug.WriteLine("webBrowser1_Navigating : " + e.Url);
+ }
+
+ private void webBrowser1_LocationChanged(object sender, EventArgs e)
+ {
+ System.Diagnostics.Debug.WriteLine("webBrowser1_LocationChanged");
+ }
+
+ private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
+ {
+ System.Diagnostics.Debug.WriteLine("webBrowser1_DocumentCompleted" + e.Url);
+ }
+ }
+}
120 InWFExample/Authorize.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
104 InWFExample/InWFExample.csproj
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9AF11DCC-09B1-4296-946A-8627588A1E9D}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>InWFExample</RootNamespace>
+ <AssemblyName>InWFExample</AssemblyName>
+ <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Drawing" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MainForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="MainForm.Designer.cs">
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </Compile>
+ <Compile Include="oAuthExt\oAuthBase2.cs" />
+ <Compile Include="oAuthExt\oAuthLinkedIn.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="MainForm.resx">
+ <DependentUpon>MainForm.cs</DependentUpon>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <EmbeddedResource Include="Authorize.resx">
+ <DependentUpon>Authorize.cs</DependentUpon>
+ </EmbeddedResource>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <None Include="App.config" />
+ <None Include="bin\Debug\InWFExample.exe.config" />
+ <None Include="bin\Debug\InWFExample.vshost.exe.config" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <Compile Include="Authorize.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="Authorize.Designer.cs">
+ <DependentUpon>Authorize.cs</DependentUpon>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="bin\Debug\InWFExample.exe" />
+ <Content Include="bin\Debug\InWFExample.pdb" />
+ <Content Include="bin\Debug\InWFExample.vshost.exe" />
+ <Content Include="bin\Debug\OfflineDocs\Completed.htm" />
+ <Content Include="bin\Debug\OfflineDocs\completed.png" />
+ <Content Include="bin\Debug\OfflineDocs\loading.gif" />
+ <Content Include="bin\Debug\OfflineDocs\Navigating.htm" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
5 InWFExample/InWFExample.csproj.user
@@ -0,0 +1,5 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ShowAllFiles</ProjectView>
+ </PropertyGroup>
+</Project>
344 InWFExample/MainForm.Designer.cs
@@ -0,0 +1,344 @@
+namespace InWFExample
+{
+ partial class MainForm
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.btnCreateAuthorization = new System.Windows.Forms.Button();
+ this.txtRequestToken = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtRequestTokenSecret = new System.Windows.Forms.TextBox();
+ this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.btnAuthorize = new System.Windows.Forms.Button();
+ this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.btnGetAcToken = new System.Windows.Forms.Button();
+ this.txtOauth_token = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtOauth_verify = new System.Windows.Forms.TextBox();
+ this.groupBox3 = new System.Windows.Forms.GroupBox();
+ this.txtOauth_Access_token = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.txtOauth_Access_tokenSecret = new System.Windows.Forms.TextBox();
+ this.groupBox4 = new System.Windows.Forms.GroupBox();
+ this.txtNewStatus = new System.Windows.Forms.TextBox();
+ this.label8 = new System.Windows.Forms.Label();
+ this.btnUpdateStatus = new System.Windows.Forms.Button();
+ this.btnGetProfileDetail = new System.Windows.Forms.Button();
+ this.txtAPIResponse = new System.Windows.Forms.TextBox();
+ this.groupBox1.SuspendLayout();
+ this.groupBox2.SuspendLayout();
+ this.groupBox3.SuspendLayout();
+ this.groupBox4.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // btnCreateAuthorization
+ //
+ this.btnCreateAuthorization.Location = new System.Drawing.Point(6, 22);
+ this.btnCreateAuthorization.Name = "btnCreateAuthorization";
+ this.btnCreateAuthorization.Size = new System.Drawing.Size(216, 23);
+ this.btnCreateAuthorization.TabIndex = 1;
+ this.btnCreateAuthorization.Text = "Create Authorization";
+ this.btnCreateAuthorization.UseVisualStyleBackColor = true;
+ this.btnCreateAuthorization.Click += new System.EventHandler(this.btnCreateAuthorization_Click);
+ //
+ // txtRequestToken
+ //
+ this.txtRequestToken.Location = new System.Drawing.Point(412, 19);
+ this.txtRequestToken.Name = "txtRequestToken";
+ this.txtRequestToken.Size = new System.Drawing.Size(233, 20);
+ this.txtRequestToken.TabIndex = 3;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(257, 22);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(118, 13);
+ this.label1.TabIndex = 4;
+ this.label1.Text = "oAuth Request Token :";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(257, 57);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(149, 13);
+ this.label2.TabIndex = 6;
+ this.label2.Text = "oAuth Request TokenSecret :";
+ //
+ // txtRequestTokenSecret
+ //
+ this.txtRequestTokenSecret.Location = new System.Drawing.Point(412, 54);
+ this.txtRequestTokenSecret.Name = "txtRequestTokenSecret";
+ this.txtRequestTokenSecret.Size = new System.Drawing.Size(233, 20);
+ this.txtRequestTokenSecret.TabIndex = 5;
+ //
+ // groupBox1
+ //
+ this.groupBox1.Controls.Add(this.btnAuthorize);
+ this.groupBox1.Controls.Add(this.txtRequestToken);
+ this.groupBox1.Controls.Add(this.label2);
+ this.groupBox1.Controls.Add(this.btnCreateAuthorization);
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.txtRequestTokenSecret);
+ this.groupBox1.Location = new System.Drawing.Point(12, 21);
+ this.groupBox1.Name = "groupBox1";
+ this.groupBox1.Size = new System.Drawing.Size(660, 100);
+ this.groupBox1.TabIndex = 7;
+ this.groupBox1.TabStop = false;
+ this.groupBox1.Text = "Authorization";
+ //
+ // btnAuthorize
+ //
+ this.btnAuthorize.Enabled = false;
+ this.btnAuthorize.Location = new System.Drawing.Point(6, 51);
+ this.btnAuthorize.Name = "btnAuthorize";
+ this.btnAuthorize.Size = new System.Drawing.Size(216, 23);
+ this.btnAuthorize.TabIndex = 7;
+ this.btnAuthorize.Text = "Authorize";
+ this.btnAuthorize.UseVisualStyleBackColor = true;
+ this.btnAuthorize.Click += new System.EventHandler(this.btnAuthorize_Click);
+ //
+ // groupBox2
+ //
+ this.groupBox2.Controls.Add(this.btnGetAcToken);
+ this.groupBox2.Controls.Add(this.txtOauth_token);
+ this.groupBox2.Controls.Add(this.label3);
+ this.groupBox2.Controls.Add(this.label4);
+ this.groupBox2.Controls.Add(this.txtOauth_verify);
+ this.groupBox2.Location = new System.Drawing.Point(18, 145);
+ this.groupBox2.Name = "groupBox2";
+ this.groupBox2.Size = new System.Drawing.Size(660, 100);
+ this.groupBox2.TabIndex = 8;
+ this.groupBox2.TabStop = false;
+ this.groupBox2.Text = "Authorization";
+ //
+ // btnGetAcToken
+ //
+ this.btnGetAcToken.Enabled = false;
+ this.btnGetAcToken.Location = new System.Drawing.Point(6, 51);
+ this.btnGetAcToken.Name = "btnGetAcToken";
+ this.btnGetAcToken.Size = new System.Drawing.Size(216, 23);
+ this.btnGetAcToken.TabIndex = 7;
+ this.btnGetAcToken.Text = "Get Access Token";
+ this.btnGetAcToken.UseVisualStyleBackColor = true;
+ this.btnGetAcToken.Click += new System.EventHandler(this.btnGetAcToken_Click);
+ //
+ // txtOauth_token
+ //
+ this.txtOauth_token.Location = new System.Drawing.Point(412, 19);
+ this.txtOauth_token.Name = "txtOauth_token";
+ this.txtOauth_token.Size = new System.Drawing.Size(233, 20);
+ this.txtOauth_token.TabIndex = 3;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(257, 57);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(77, 13);
+ this.label3.TabIndex = 6;
+ this.label3.Text = "oauth_verifier :";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(257, 22);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(76, 13);
+ this.label4.TabIndex = 4;
+ this.label4.Text = "oauth_token : ";
+ //
+ // txtOauth_verify
+ //
+ this.txtOauth_verify.Location = new System.Drawing.Point(412, 54);
+ this.txtOauth_verify.Name = "txtOauth_verify";
+ this.txtOauth_verify.Size = new System.Drawing.Size(233, 20);
+ this.txtOauth_verify.TabIndex = 5;
+ //
+ // groupBox3
+ //
+ this.groupBox3.Controls.Add(this.txtOauth_Access_token);
+ this.groupBox3.Controls.Add(this.label5);
+ this.groupBox3.Controls.Add(this.label6);
+ this.groupBox3.Controls.Add(this.txtOauth_Access_tokenSecret);
+ this.groupBox3.Location = new System.Drawing.Point(18, 267);
+ this.groupBox3.Name = "groupBox3";
+ this.groupBox3.Size = new System.Drawing.Size(660, 100);
+ this.groupBox3.TabIndex = 9;
+ this.groupBox3.TabStop = false;
+ this.groupBox3.Text = "Access Tokens";
+ //
+ // txtOauth_Access_token
+ //
+ this.txtOauth_Access_token.Location = new System.Drawing.Point(171, 24);
+ this.txtOauth_Access_token.Name = "txtOauth_Access_token";
+ this.txtOauth_Access_token.Size = new System.Drawing.Size(468, 20);
+ this.txtOauth_Access_token.TabIndex = 3;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(16, 62);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(148, 13);
+ this.label5.TabIndex = 6;
+ this.label5.Text = "oauth_Access_tokenSecret : ";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(16, 27);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(114, 13);
+ this.label6.TabIndex = 4;
+ this.label6.Text = "oauth_Access_token :";
+ //
+ // txtOauth_Access_tokenSecret
+ //
+ this.txtOauth_Access_tokenSecret.Location = new System.Drawing.Point(171, 59);
+ this.txtOauth_Access_tokenSecret.Name = "txtOauth_Access_tokenSecret";
+ this.txtOauth_Access_tokenSecret.Size = new System.Drawing.Size(468, 20);
+ this.txtOauth_Access_tokenSecret.TabIndex = 5;
+ //
+ // groupBox4
+ //
+ this.groupBox4.Controls.Add(this.txtAPIResponse);
+ this.groupBox4.Controls.Add(this.btnGetProfileDetail);
+ this.groupBox4.Controls.Add(this.btnUpdateStatus);
+ this.groupBox4.Controls.Add(this.txtNewStatus);
+ this.groupBox4.Controls.Add(this.label8);
+ this.groupBox4.Location = new System.Drawing.Point(24, 384);
+ this.groupBox4.Name = "groupBox4";
+ this.groupBox4.Size = new System.Drawing.Size(660, 212);
+ this.groupBox4.TabIndex = 10;
+ this.groupBox4.TabStop = false;
+ this.groupBox4.Text = "API Methods to Invoke";
+ //
+ // txtNewStatus
+ //
+ this.txtNewStatus.Location = new System.Drawing.Point(171, 24);
+ this.txtNewStatus.Name = "txtNewStatus";
+ this.txtNewStatus.Size = new System.Drawing.Size(468, 20);
+ this.txtNewStatus.TabIndex = 3;
+ this.txtNewStatus.Text = "It\'s working on windows";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(16, 27);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(112, 13);
+ this.label8.TabIndex = 4;
+ this.label8.Text = "Change my status to : ";
+ //
+ // btnUpdateStatus
+ //
+ this.btnUpdateStatus.Enabled = false;
+ this.btnUpdateStatus.Location = new System.Drawing.Point(19, 57);
+ this.btnUpdateStatus.Name = "btnUpdateStatus";
+ this.btnUpdateStatus.Size = new System.Drawing.Size(236, 23);
+ this.btnUpdateStatus.TabIndex = 5;
+ this.btnUpdateStatus.Text = "Send Status Update (PUT Request Example)";
+ this.btnUpdateStatus.UseVisualStyleBackColor = true;
+ this.btnUpdateStatus.Click += new System.EventHandler(this.btnUpdateStatus_Click);
+ //
+ // btnGetProfileDetail
+ //
+ this.btnGetProfileDetail.Enabled = false;
+ this.btnGetProfileDetail.Location = new System.Drawing.Point(261, 57);
+ this.btnGetProfileDetail.Name = "btnGetProfileDetail";
+ this.btnGetProfileDetail.Size = new System.Drawing.Size(236, 23);
+ this.btnGetProfileDetail.TabIndex = 6;
+ this.btnGetProfileDetail.Text = "Request User Profile (GET Request Example)";
+ this.btnGetProfileDetail.UseVisualStyleBackColor = true;
+ this.btnGetProfileDetail.Click += new System.EventHandler(this.btnGetProfileDetail_Click);
+ //
+ // txtAPIResponse
+ //
+ this.txtAPIResponse.Location = new System.Drawing.Point(13, 86);
+ this.txtAPIResponse.Multiline = true;
+ this.txtAPIResponse.Name = "txtAPIResponse";
+ this.txtAPIResponse.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
+ this.txtAPIResponse.Size = new System.Drawing.Size(626, 120);
+ this.txtAPIResponse.TabIndex = 7;
+ //
+ // MainForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(708, 608);
+ this.Controls.Add(this.groupBox4);
+ this.Controls.Add(this.groupBox3);
+ this.Controls.Add(this.groupBox2);
+ this.Controls.Add(this.groupBox1);
+ this.Name = "MainForm";
+ this.Text = "Form1";
+ this.groupBox1.ResumeLayout(false);
+ this.groupBox1.PerformLayout();
+ this.groupBox2.ResumeLayout(false);
+ this.groupBox2.PerformLayout();
+ this.groupBox3.ResumeLayout(false);
+ this.groupBox3.PerformLayout();
+ this.groupBox4.ResumeLayout(false);
+ this.groupBox4.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnCreateAuthorization;
+ private System.Windows.Forms.TextBox txtRequestToken;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtRequestTokenSecret;
+ private System.Windows.Forms.GroupBox groupBox1;
+ private System.Windows.Forms.Button btnAuthorize;
+ private System.Windows.Forms.GroupBox groupBox2;
+ private System.Windows.Forms.Button btnGetAcToken;
+ private System.Windows.Forms.TextBox txtOauth_token;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox txtOauth_verify;
+ private System.Windows.Forms.GroupBox groupBox3;
+ private System.Windows.Forms.TextBox txtOauth_Access_token;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox txtOauth_Access_tokenSecret;
+ private System.Windows.Forms.GroupBox groupBox4;
+ private System.Windows.Forms.TextBox txtNewStatus;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Button btnGetProfileDetail;
+ private System.Windows.Forms.Button btnUpdateStatus;
+ private System.Windows.Forms.TextBox txtAPIResponse;
+ }
+}
+
88 InWFExample/MainForm.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace InWFExample
+{
+ public partial class MainForm : Form
+ {
+ public MainForm()
+ {
+ InitializeComponent();
+ }
+
+
+ private oAuthLinkedIn _oauth = new oAuthLinkedIn();
+ private string _authLink = null;
+
+ private void btnCreateAuthorization_Click(object sender, EventArgs e)
+ {
+ _authLink = _oauth.AuthorizationLinkGet();
+ txtRequestToken.Text = _oauth.Token;
+ txtRequestTokenSecret.Text = _oauth.TokenSecret;
+
+ btnAuthorize.Enabled = true;
+ }
+
+
+ private void btnAuthorize_Click(object sender, EventArgs e)
+ {
+ Authorize authorizeForm = new Authorize();
+ authorizeForm.AuthorizeCompleted += new Authorize.AuthorizeCompletedDelegate(authorizeForm_AuthorizeCompleted);
+ authorizeForm.Show();
+ authorizeForm.Navigate(_authLink);
+ }
+
+ void authorizeForm_AuthorizeCompleted(string oauth_token, string oauth_verifier)
+ {
+ txtOauth_token.Text = oauth_token;
+ txtOauth_verify.Text = oauth_verifier;
+ btnGetAcToken.Enabled = true;
+ }
+
+ private void btnGetAcToken_Click(object sender, EventArgs e)
+ {
+ _oauth.Token = txtOauth_token.Text;
+ _oauth.TokenSecret = txtRequestTokenSecret.Text;
+ _oauth.Verifier = txtOauth_verify.Text;
+
+ _oauth.AccessTokenGet(txtOauth_token.Text);
+
+ txtOauth_Access_token.Text = _oauth.Token;
+ txtOauth_Access_tokenSecret.Text = _oauth.TokenSecret;
+ btnUpdateStatus.Enabled = true;
+ btnGetProfileDetail.Enabled = true;
+ }
+
+ private void btnUpdateStatus_Click(object sender, EventArgs e)
+ {
+ txtAPIResponse.Text = "";
+ _oauth.Token = txtOauth_Access_token.Text;
+ _oauth.TokenSecret = txtOauth_Access_tokenSecret.Text;
+ _oauth.Verifier = txtOauth_verify.Text;
+
+ string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+ xml += "<current-status>" + txtNewStatus.Text + "</current-status>";
+
+ string response = _oauth.APIWebRequest("PUT", "http://api.linkedin.com/v1/people/~/current-status", xml);
+ if (response == "")
+ txtAPIResponse.Text = "Your new status updated";
+ }
+
+ private void btnGetProfileDetail_Click(object sender, EventArgs e)
+ {
+ txtAPIResponse.Text = "";
+ _oauth.Token = txtOauth_Access_token.Text;
+ _oauth.TokenSecret = txtOauth_Access_tokenSecret.Text;
+ _oauth.Verifier = txtOauth_verify.Text;
+
+ string response = _oauth.APIWebRequest("GET", "https://api.linkedin.com/v1/people/~", null);
+ txtAPIResponse.Text = response;
+ }
+
+ }
+}
120 InWFExample/MainForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
20 InWFExample/Program.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Windows.Forms;
+
+namespace InWFExample
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new MainForm());
+ }
+ }
+}
36 InWFExample/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("InWFExample")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("InWFExample")]
+[assembly: AssemblyCopyright("Copyright © 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3f0b2572-867b-4730-9f64-826166bafa6c")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
71 InWFExample/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4959
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace InWFExample.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("InWFExample.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
117 InWFExample/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
30 InWFExample/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.4959
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace InWFExample.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
7 InWFExample/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
BIN InWFExample/bin/Debug/InWFExample.exe
Binary file not shown.
7 InWFExample/bin/Debug/InWFExample.exe.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="LiApiKey" value="5s5OSkySDF_mG_dLkduT3l7gokQ68hBtEpY5a9ebJVDH2r5BG8Opb6mUQhPgmQEB"/>
+ <add key="LiSecretKey" value="-WqKoGLodqWeVr9WqeOHnJG3xnPGJ2VynLb4ojZ-hnxbWreYH-ZQy_lfBghdEawN" />
+ </appSettings>
+</configuration>
BIN InWFExample/bin/Debug/InWFExample.pdb
Binary file not shown.
BIN InWFExample/bin/Debug/InWFExample.vshost.exe
Binary file not shown.
7 InWFExample/bin/Debug/InWFExample.vshost.exe.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="LiApiKey" value="5s5OSkySDF_mG_dLkduT3l7gokQ68hBtEpY5a9ebJVDH2r5BG8Opb6mUQhPgmQEB"/>
+ <add key="LiSecretKey" value="-WqKoGLodqWeVr9WqeOHnJG3xnPGJ2VynLb4ojZ-hnxbWreYH-ZQy_lfBghdEawN" />
+ </appSettings>
+</configuration>
13 InWFExample/bin/Debug/OfflineDocs/Completed.htm
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <img src="completed.png" />
+ <br />
+ <h2>Authorization Completed</h2>
+ <br />
+ Please wait until close this window..
+ </body>
+</html>
11 InWFExample/bin/Debug/OfflineDocs/Navigating.htm
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body style="text-align:center">
+ <img src="loading.gif" />
+ <br />
+ <h2>Navigating..</h2>
+ </body>
+</html>
BIN InWFExample/bin/Debug/OfflineDocs/completed.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN InWFExample/bin/Debug/OfflineDocs/loading.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
380 InWFExample/oAuthExt/oAuthBase2.cs
@@ -0,0 +1,380 @@
+/*
+ This file was modified by Fatih YASAR at 27.11.2009
+ */
+
+using System;
+using System.Security.Cryptography;
+using System.Collections.Generic;
+using System.Text;
+using System.Web;
+
+
+ public class oAuthBase2
+ {
+
+ /// <summary>
+ /// Provides a predefined set of algorithms that are supported officially by the protocol
+ /// </summary>
+ public enum SignatureTypes
+ {
+ HMACSHA1,
+ PLAINTEXT,
+ RSASHA1
+ }
+
+ /// <summary>
+ /// Provides an internal structure to sort the query parameter
+ /// </summary>
+ protected class QueryParameter
+ {
+ private string name = null;
+ private string value = null;
+
+ public QueryParameter(string name, string value)
+ {
+ this.name = name;
+ this.value = value;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+
+ public string Value
+ {
+ get { return value; }
+ }
+ }
+
+ /// <summary>
+ /// Comparer class used to perform the sorting of the query parameters
+ /// </summary>
+ protected class QueryParameterComparer : IComparer<QueryParameter>
+ {
+
+ #region IComparer<QueryParameter> Members
+
+ public int Compare(QueryParameter x, QueryParameter y)
+ {
+ if (x.Name == y.Name)
+ {
+ return string.Compare(x.Value, y.Value);
+ }
+ else
+ {
+ return string.Compare(x.Name, y.Name);
+ }
+ }
+
+ #endregion
+ }
+
+ protected const string OAuthVersion = "1.0";
+ protected const string OAuthParameterPrefix = "oauth_";
+
+ //
+ // List of know and used oauth parameters' names
+ //
+ protected const string OAuthConsumerKeyKey = "oauth_consumer_key";
+ protected const string OAuthCallbackKey = "oauth_callback";
+ protected const string OAuthVersionKey = "oauth_version";
+ protected const string OAuthSignatureMethodKey = "oauth_signature_method";
+ protected const string OAuthSignatureKey = "oauth_signature";
+ protected const string OAuthTimestampKey = "oauth_timestamp";
+ protected const string OAuthNonceKey = "oauth_nonce";
+ protected const string OAuthTokenKey = "oauth_token";
+ protected const string oAauthVerifier = "oauth_verifier";
+ protected const string OAuthTokenSecretKey = "oauth_token_secret";
+
+ protected const string HMACSHA1SignatureType = "HMAC-SHA1";
+ protected const string PlainTextSignatureType = "PLAINTEXT";
+ protected const string RSASHA1SignatureType = "RSA-SHA1";
+
+ protected Random random = new Random();
+
+ private string oauth_verifier;
+ public string Verifier { get { return oauth_verifier; } set { oauth_verifier = value; } }
+
+
+ protected string unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
+
+ /// <summary>
+ /// Helper function to compute a hash value
+ /// </summary>
+ /// <param name="hashAlgorithm">The hashing algoirhtm used. If that algorithm needs some initialization, like HMAC and its derivatives, they should be initialized prior to passing it to this function</param>
+ /// <param name="data">The data to hash</param>
+ /// <returns>a Base64 string of the hash value</returns>
+ private string ComputeHash(HashAlgorithm hashAlgorithm, string data)
+ {
+ if (hashAlgorithm == null)
+ {
+ throw new ArgumentNullException("hashAlgorithm");
+ }
+
+ if (string.IsNullOrEmpty(data))
+ {
+ throw new ArgumentNullException("data");
+ }
+
+ byte[] dataBuffer = System.Text.Encoding.ASCII.GetBytes(data);
+ byte[] hashBytes = hashAlgorithm.ComputeHash(dataBuffer);
+
+ return Convert.ToBase64String(hashBytes);
+ }
+
+ /// <summary>
+ /// Internal function to cut out all non oauth query string parameters (all parameters not begining with "oauth_")
+ /// </summary>
+ /// <param name="parameters">The query string part of the Url</param>
+ /// <returns>A list of QueryParameter each containing the parameter name and value</returns>
+ private List<QueryParameter> GetQueryParameters(string parameters)
+ {
+ if (parameters.StartsWith("?"))
+ {
+ parameters = parameters.Remove(0, 1);
+ }
+
+ List<QueryParameter> result = new List<QueryParameter>();
+
+ if (!string.IsNullOrEmpty(parameters))
+ {
+ string[] p = parameters.Split('&');
+ foreach (string s in p)
+ {
+ if (!string.IsNullOrEmpty(s) && !s.StartsWith(OAuthParameterPrefix))
+ {
+ if (s.IndexOf('=') > -1)
+ {
+ string[] temp = s.Split('=');
+ result.Add(new QueryParameter(temp[0], temp[1]));
+ }
+ else
+ {
+ result.Add(new QueryParameter(s, string.Empty));
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// This is a different Url Encode implementation since the default .NET one outputs the percent encoding in lower case.
+ /// While this is not a problem with the percent encoding spec, it is used in upper case throughout OAuth
+ /// </summary>
+ /// <param name="value">The value to Url encode</param>
+ /// <returns>Returns a Url encoded string</returns>
+ public string UrlEncode(string value)
+ {
+ StringBuilder result = new StringBuilder();
+
+ foreach (char symbol in value)
+ {
+ if (unreservedChars.IndexOf(symbol) != -1)
+ {
+ result.Append(symbol);
+ }
+ else
+ {
+ result.Append('%' + String.Format("{0:X2}", (int)symbol));
+ }
+ }
+
+ return result.ToString();
+ }
+
+ /// <summary>
+ /// Normalizes the request parameters according to the spec
+ /// </summary>
+ /// <param name="parameters">The list of parameters already sorted</param>
+ /// <returns>a string representing the normalized parameters</returns>
+ protected string NormalizeRequestParameters(IList<QueryParameter> parameters)
+ {
+ StringBuilder sb = new StringBuilder();
+ QueryParameter p = null;
+ for (int i = 0; i < parameters.Count; i++)
+ {
+ p = parameters[i];
+ sb.AppendFormat("{0}={1}", p.Name, p.Value);
+
+ if (i < parameters.Count - 1)
+ {
+ sb.Append("&");
+ }
+ }
+
+ return sb.ToString();
+ }
+
+ /// <summary>
+ /// Generate the signature base that is used to produce the signature
+ /// </summary>
+ /// <param name="url">The full url that needs to be signed including its non OAuth url parameters</param>
+ /// <param name="consumerKey">The consumer key</param>
+ /// <param name="token">The token, if available. If not available pass null or an empty string</param>
+ /// <param name="tokenSecret">The token secret, if available. If not available pass null or an empty string</param>
+ /// <param name="httpMethod">The http method used. Must be a valid HTTP method verb (POST,GET,PUT, etc)</param>
+ /// <param name="signatureType">The signature type. To use the default values use <see cref="OAuthBase.SignatureTypes">OAuthBase.SignatureTypes</see>.</param>
+ /// <returns>The signature base</returns>
+ public string GenerateSignatureBase(Uri url, string consumerKey, string token, string tokenSecret, string httpMethod, string timeStamp, string nonce, string signatureType, out string normalizedUrl, out string normalizedRequestParameters)
+ {
+ if (token == null)
+ {
+ token = string.Empty;
+ }
+
+ if (tokenSecret == null)
+ {
+ tokenSecret = string.Empty;
+ }
+
+ if (string.IsNullOrEmpty(consumerKey))
+ {
+ throw new ArgumentNullException("consumerKey");
+ }
+
+ if (string.IsNullOrEmpty(httpMethod))
+ {
+ throw new ArgumentNullException("httpMethod");
+ }
+
+ if (string.IsNullOrEmpty(signatureType))
+ {
+ throw new ArgumentNullException("signatureType");
+ }
+
+ normalizedUrl = null;
+ normalizedRequestParameters = null;
+
+ List<QueryParameter> parameters = GetQueryParameters(url.Query);
+ parameters.Add(new QueryParameter(OAuthVersionKey, OAuthVersion));
+ parameters.Add(new QueryParameter(OAuthNonceKey, nonce));
+ parameters.Add(new QueryParameter(OAuthTimestampKey, timeStamp));
+ parameters.Add(new QueryParameter(OAuthSignatureMethodKey, signatureType));
+ parameters.Add(new QueryParameter(OAuthConsumerKeyKey, consumerKey));
+
+ if (!string.IsNullOrEmpty(token))
+ {
+ parameters.Add(new QueryParameter(OAuthTokenKey, token));
+ }
+
+ if (!string.IsNullOrEmpty(oauth_verifier))
+ {
+ parameters.Add(new QueryParameter(oAauthVerifier, oauth_verifier));
+ }
+
+
+ parameters.Sort(new QueryParameterComparer());
+
+
+ normalizedUrl = string.Format("{0}://{1}", url.Scheme, url.Host);
+ if (!((url.Scheme == "http" && url.Port == 80) || (url.Scheme == "https" && url.Port == 443)))
+ {
+ normalizedUrl += ":" + url.Port;
+ }
+ normalizedUrl += url.AbsolutePath;
+ normalizedRequestParameters = NormalizeRequestParameters(parameters);
+
+ StringBuilder signatureBase = new StringBuilder();
+ signatureBase.AppendFormat("{0}&", httpMethod.ToUpper());
+ signatureBase.AppendFormat("{0}&", UrlEncode(normalizedUrl));
+ signatureBase.AppendFormat("{0}", UrlEncode(normalizedRequestParameters));
+
+ return signatureBase.ToString();
+ }
+
+
+ /// <summary>
+ /// Generate the signature value based on the given signature base and hash algorithm
+ /// </summary>
+ /// <param name="signatureBase">The signature based as produced by the GenerateSignatureBase method or by any other means</param>
+ /// <param name="hash">The hash algorithm used to perform the hashing. If the hashing algorithm requires initialization or a key it should be set prior to calling this method</param>
+ /// <returns>A base64 string of the hash value</returns>
+ public string GenerateSignatureUsingHash(string signatureBase, HashAlgorithm hash)
+ {
+ return ComputeHash(hash, signatureBase);
+ }
+
+ /// <summary>
+ /// Generates a signature using the HMAC-SHA1 algorithm
+ /// </summary>
+ /// <param name="url">The full url that needs to be signed including its non OAuth url parameters</param>
+ /// <param name="consumerKey">The consumer key</param>
+ /// <param name="consumerSecret">The consumer seceret</param>
+ /// <param name="token">The token, if available. If not available pass null or an empty string</param>
+ /// <param name="tokenSecret">The token secret, if available. If not available pass null or an empty string</param>
+ /// <param name="httpMethod">The http method used. Must be a valid HTTP method verb (POST,GET,PUT, etc)</param>
+ /// <returns>A base64 string of the hash value</returns>
+ public string GenerateSignature(Uri url, string consumerKey, string consumerSecret, string token, string tokenSecret, string httpMethod, string timeStamp, string nonce, out string normalizedUrl, out string normalizedRequestParameters)
+ {
+ return GenerateSignature(url, consumerKey, consumerSecret, token, tokenSecret, httpMethod, timeStamp, nonce, SignatureTypes.HMACSHA1, out normalizedUrl, out normalizedRequestParameters);
+ }
+
+ /// <summary>
+ /// Generates a signature using the specified signatureType
+ /// </summary>
+ /// <param name="url">The full url that needs to be signed including its non OAuth url parameters</param>
+ /// <param name="consumerKey">The consumer key</param>
+ /// <param name="consumerSecret">The consumer seceret</param>
+ /// <param name="token">The token, if available. If not available pass null or an empty string</param>
+ /// <param name="tokenSecret">The token secret, if available. If not available pass null or an empty string</param>
+ /// <param name="httpMethod">The http method used. Must be a valid HTTP method verb (POST,GET,PUT, etc)</param>
+ /// <param name="signatureType">The type of signature to use</param>
+ /// <returns>A base64 string of the hash value</returns>
+ public string GenerateSignature(Uri url, string consumerKey, string consumerSecret, string token, string tokenSecret, string httpMethod, string timeStamp, string nonce, SignatureTypes signatureType, out string normalizedUrl, out string normalizedRequestParameters)
+ {
+ normalizedUrl = null;
+ normalizedRequestParameters = null;
+
+ switch (signatureType)
+ {
+ case SignatureTypes.PLAINTEXT:
+ return HttpUtility.UrlEncode(string.Format("{0}&{1}", consumerSecret, tokenSecret));
+ case SignatureTypes.HMACSHA1:
+ string signatureBase = GenerateSignatureBase(url, consumerKey, token, tokenSecret, httpMethod, timeStamp, nonce, HMACSHA1SignatureType, out normalizedUrl, out normalizedRequestParameters);
+
+ HMACSHA1 hmacsha1 = new HMACSHA1();
+ hmacsha1.Key = Encoding.ASCII.GetBytes(string.Format("{0}&{1}", UrlEncode(consumerSecret), string.IsNullOrEmpty(tokenSecret) ? "" : UrlEncode(tokenSecret)));
+
+ return GenerateSignatureUsingHash(signatureBase, hmacsha1);
+ case SignatureTypes.RSASHA1:
+ throw new NotImplementedException();
+ default:
+ throw new ArgumentException("Unknown signature type", "signatureType");
+ }
+ }
+
+ /// <summary>
+ /// Generate the timestamp for the signature
+ /// </summary>
+ /// <returns></returns>
+
+ public virtual string GenerateTimeStamp()
+ {
+ // Default implementation of UNIX time of the current UTC time
+ TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ return Convert.ToInt64(ts.TotalSeconds).ToString();
+ }
+
+ /*
+ public virtual string GenerateTimeStamp() {
+ // Default implementation of UNIX time of the current UTC time
+ TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
+ string timeStamp = ts.TotalSeconds.ToString();
+ timeStamp = timeStamp.Substring(0, timeStamp.IndexOf(","));
+ return Convert.ToInt64(timeStamp).ToString();
+ }*/
+
+ /// <summary>
+ /// Generate a nonce
+ /// </summary>
+ /// <returns></returns>
+ public virtual string GenerateNonce()
+ {
+ // Just a simple implementation of a random number between 123400 and 9999999
+ return random.Next(123400, 9999999).ToString();
+ }
+
+ }
334 InWFExample/oAuthExt/oAuthLinkedIn.cs
@@ -0,0 +1,334 @@
+using System;
+using System.Data;
+using System.Configuration;
+using System.Web;
+using System.Web.Security;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Web.UI.WebControls.WebParts;
+using System.Web.UI.HtmlControls;
+using System.Net;
+using System.IO;
+using System.Collections.Specialized;
+using System.Runtime.Remoting.Messaging;
+using System.Text;
+
+
+public class oAuthLinkedIn : oAuthBase2
+ {
+ public enum Method { GET, POST, PUT, DELETE };
+ public const string REQUEST_TOKEN = "https://api.linkedin.com/uas/oauth/requestToken";
+ public const string AUTHORIZE = "https://api.linkedin.com/uas/oauth/authorize";
+ public const string ACCESS_TOKEN = "https://api.linkedin.com/uas/oauth/accessToken";
+
+ private string _consumerKey = "";
+ private string _consumerSecret = "";
+ private string _token = "";
+ private string _tokenSecret = "";
+
+#region Properties
+ public string ConsumerKey
+ {
+ get
+ {
+ if (_consumerKey.Length == 0)
+ {
+ _consumerKey = System.Configuration.ConfigurationSettings.AppSettings["LiApiKey"];
+ }
+ return _consumerKey;
+ }
+ set { _consumerKey = value; }
+ }
+
+ public string ConsumerSecret {
+ get {
+ if (_consumerSecret.Length == 0)
+ {
+ _consumerSecret = System.Configuration.ConfigurationSettings.AppSettings["LiSecretKey"];
+ }
+ return _consumerSecret;
+ }
+ set { _consumerSecret = value; }
+ }
+
+ public string Token { get { return _token; } set { _token = value; } }
+ public string TokenSecret { get { return _tokenSecret; } set { _tokenSecret = value; } }
+#endregion
+
+ /// <summary>
+ /// Get the link to Twitter's authorization page for this application.
+ /// </summary>
+ /// <returns>The url with a valid request token, or a null string.</returns>
+ public string AuthorizationLinkGet()
+ {
+ string ret = null;
+
+ string response = oAuthWebRequest(Method.POST, REQUEST_TOKEN, String.Empty);
+ if (response.Length > 0)
+ {
+ //response contains token and token secret. We only need the token.
+ //oauth_token=36d1871d-5315-499f-a256-7231fdb6a1e0&oauth_token_secret=34a6cb8e-4279-4a0b-b840-085234678ab4&oauth_callback_confirmed=true
+ NameValueCollection qs = HttpUtility.ParseQueryString(response);
+ if (qs["oauth_token"] != null)
+ {
+ this.Token = qs["oauth_token"];
+ this.TokenSecret = qs["oauth_token_secret"];
+ ret = AUTHORIZE + "?oauth_token=" + this.Token;
+ }
+ }
+ return ret;
+ }
+
+ /// <summary>
+ /// Exchange the request token for an access token.
+ /// </summary>
+ /// <param name="authToken">The oauth_token is supplied by Twitter's authorization page following the callback.</param>
+ public void AccessTokenGet(string authToken)
+ {
+ this.Token = authToken;
+
+ string response = oAuthWebRequest(Method.POST, ACCESS_TOKEN, string.Empty);
+
+ if (response.Length > 0)
+ {
+ //Store the Token and Token Secret
+ NameValueCollection qs = HttpUtility.ParseQueryString(response);
+ if (qs["oauth_token"] != null)
+ {
+ this.Token = qs["oauth_token"];
+ }
+ if (qs["oauth_token_secret"] != null)
+ {
+ this.TokenSecret = qs["oauth_token_secret"];
+ }
+ }
+ }
+
+ /// <summary>
+ /// Submit a web request using oAuth.
+ /// </summary>
+ /// <param name="method">GET or POST</param>
+ /// <param name="url">The full url, including the querystring.</param>
+ /// <param name="postData">Data to post (querystring format)</param>
+ /// <returns>The web server response.</returns>
+ public string oAuthWebRequest(Method method, string url, string postData)
+ {
+ string outUrl = "";
+ string querystring = "";
+ string ret = "";
+
+
+ //Setup postData for signing.
+ //Add the postData to the querystring.
+ if (method == Method.POST)
+ {
+ if (postData.Length > 0)
+ {
+ //Decode the parameters and re-encode using the oAuth UrlEncode method.
+ NameValueCollection qs = HttpUtility.ParseQueryString(postData);
+ postData = "";
+ foreach (string key in qs.AllKeys)
+ {
+ if (postData.Length > 0)
+ {
+ postData += "&";
+ }
+ qs[key] = HttpUtility.UrlDecode(qs[key]);
+ qs[key] = this.UrlEncode(qs[key]);
+ postData += key + "=" + qs[key];
+
+ }
+ if (url.IndexOf("?") > 0)
+ {
+ url += "&";
+ }
+ else
+ {
+ url += "?";
+ }
+ url += postData;
+ }
+ }
+
+ Uri uri = new Uri(url);
+
+ string nonce = this.GenerateNonce();
+ string timeStamp = this.GenerateTimeStamp();
+
+ //Generate Signature
+ string sig = this.GenerateSignature(uri,
+ this.ConsumerKey,
+ this.ConsumerSecret,
+ this.Token,
+ this.TokenSecret,
+ method.ToString(),
+ timeStamp,
+ nonce,
+ out outUrl,
+ out querystring);
+
+
+ querystring += "&oauth_signature=" + HttpUtility.UrlEncode(sig);
+
+ //Convert the querystring to postData
+ if (method == Method.POST)
+ {
+ postData = querystring;
+ querystring = "";
+ }
+
+ if (querystring.Length > 0)
+ {
+ outUrl += "?";
+ }
+
+ if (method == Method.POST || method == Method.GET)
+ ret = WebRequest(method, outUrl + querystring, postData);
+ //else if (method == Method.PUT)
+ //ret = WebRequestWithPut(outUrl + querystring, postData);
+ return ret;
+ }
+
+
+
+ /// <summary>
+ /// WebRequestWithPut
+ /// </summary>
+ /// <param name="method">WebRequestWithPut</param>
+ /// <param name="url"></param>
+ /// <param name="postData"></param>
+ /// <returns></returns>
+ public string APIWebRequest(string method, string url, string postData)
+ {
+ Uri uri = new Uri(url);
+ string nonce = this.GenerateNonce();
+ string timeStamp = this.GenerateTimeStamp();
+
+ string outUrl, querystring;
+
+ //Generate Signature
+ string sig = this.GenerateSignature(uri,
+ this.ConsumerKey,
+ this.ConsumerSecret,
+ this.Token,
+ this.TokenSecret,
+ method,
+ timeStamp,
+ nonce,
+ out outUrl,
+ out querystring);
+
+ //querystring += "&oauth_signature=" + HttpUtility.UrlEncode(sig);
+ //NameValueCollection qs = HttpUtility.ParseQueryString(querystring);
+
+ //string finalGetUrl = outUrl + "?" + querystring;
+
+ HttpWebRequest webRequest = null;
+
+ //webRequest = System.Net.WebRequest.Create(finalGetUrl) as HttpWebRequest;
+ webRequest = System.Net.WebRequest.Create(url) as HttpWebRequest;
+ //webRequest.ContentType = "text/xml";
+ webRequest.Method = method;
+ webRequest.Credentials = CredentialCache.DefaultCredentials;
+ webRequest.AllowWriteStreamBuffering = true;
+
+ webRequest.PreAuthenticate = true;
+ webRequest.ServicePoint.Expect100Continue = false;
+ ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
+
+ webRequest.Headers.Add("Authorization", "OAuth realm=\"http://api.linkedin.com/\",oauth_consumer_key=\"" + this.ConsumerKey + "\",oauth_token=\"" + this.Token + "\",oauth_signature_method=\"HMAC-SHA1\",oauth_signature=\"" + HttpUtility.UrlEncode(sig) + "\",oauth_timestamp=\"" + timeStamp + "\",oauth_nonce=\"" + nonce + "\",oauth_verifier=\"" + this.Verifier + "\", oauth_version=\"1.0\"");
+ //webRequest.Headers.Add("Authorization", "OAuth oauth_nonce=\"" + nonce + "\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"" + timeStamp + "\", oauth_consumer_key=\"" + this.ConsumerKey + "\", oauth_token=\"" + this.Token + "\", oauth_signature=\"" + HttpUtility.UrlEncode(sig) + "\", oauth_version=\"1.0\"");
+ if (postData != null)
+ {
+ byte[] fileToSend = Encoding.UTF8.GetBytes(postData);
+ webRequest.ContentLength = fileToSend.Length;
+
+ Stream reqStream = webRequest.GetRequestStream();
+
+ reqStream.Write(fileToSend, 0, fileToSend.Length);
+ reqStream.Close();
+ }
+
+ string returned = WebResponseGet(webRequest);
+
+ return returned;
+ }
+
+
+ /// <summary>
+ /// Web Request Wrapper
+ /// </summary>
+ /// <param name="method">Http Method</param>
+ /// <param name="url">Full url to the web resource</param>
+ /// <param name="postData">Data to post in querystring format</param>
+ /// <returns>The web server response.</returns>
+ public string WebRequest(Method method, string url, string postData)
+ {
+ HttpWebRequest webRequest = null;
+ StreamWriter requestWriter = null;
+ string responseData = "";
+
+ webRequest = System.Net.WebRequest.Create(url) as HttpWebRequest;
+ webRequest.Method = method.ToString();
+ webRequest.ServicePoint.Expect100Continue = false;
+ //webRequest.UserAgent = "Identify your application please.";
+ //webRequest.Timeout = 20000;
+
+ if (method == Method.POST)
+ {
+ webRequest.ContentType = "application/x-www-form-urlencoded";
+
+ //POST the data.
+ requestWriter = new StreamWriter(webRequest.GetRequestStream());
+ try
+ {
+ requestWriter.Write(postData);
+ }
+ catch
+ {
+ throw;
+ }
+ finally
+ {
+ requestWriter.Close();
+ requestWriter = null;
+ }
+ }
+
+ responseData = WebResponseGet(webRequest);
+
+ webRequest = null;
+
+ return responseData;
+
+ }
+
+ /// <summary>
+ /// Process the web response.
+ /// </summary>
+ /// <param name="webRequest">The request object.</param>
+ /// <returns>The response data.</returns>
+ public string WebResponseGet(HttpWebRequest webRequest)
+ {
+ StreamReader responseReader = null;
+ string responseData = "";
+
+ try
+ {
+ responseReader = new StreamReader(webRequest.GetResponse().GetResponseStream());
+ responseData = responseReader.ReadToEnd();
+ }
+ catch
+ {
+ throw;
+ }
+ finally
+ {
+ webRequest.GetResponse().GetResponseStream().Close();
+ responseReader.Close();
+ responseReader = null;
+ }
+
+ return responseData;
+ }
+ }
BIN InWFExample/obj/Debug/InWFExample.Authorize.resources
Binary file not shown.
BIN InWFExample/obj/Debug/InWFExample.MainForm.resources
Binary file not shown.
BIN InWFExample/obj/Debug/InWFExample.Properties.Resources.resources
Binary file not shown.
10 InWFExample/obj/Debug/InWFExample.csproj.FileListAbsolute.txt
@@ -0,0 +1,10 @@
+C:\InWFExample\InWFExample\bin\Debug\InWFExample.exe
+C:\InWFExample\InWFExample\bin\Debug\InWFExample.pdb
+C:\InWFExample\InWFExample\obj\Debug\ResolveAssemblyReference.cache
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.Properties.Resources.resources
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.csproj.GenerateResource.Cache
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.exe
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.pdb
+C:\InWFExample\InWFExample\bin\Debug\InWFExample.exe.config
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.MainForm.resources
+C:\InWFExample\InWFExample\obj\Debug\InWFExample.Authorize.resources
BIN InWFExample/obj/Debug/InWFExample.csproj.GenerateResource.Cache
Binary file not shown.
BIN InWFExample/obj/Debug/InWFExample.exe
Binary file not shown.
BIN InWFExample/obj/Debug/InWFExample.pdb
Binary file not shown.
0 README
No changes.

0 comments on commit ce573b2

Please sign in to comment.
Something went wrong with that request. Please try again.