<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://students.netindonesia.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Alexander Rahardjo&amp;#39;s Blog</title><subtitle type="html" /><id>http://students.netindonesia.net/blogs/alexrhd/atom.aspx</id><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/default.aspx" /><link rel="self" type="application/atom+xml" href="http://students.netindonesia.net/blogs/alexrhd/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20611.960">Community Server</generator><updated>2010-11-18T11:25:00Z</updated><entry><title>Membuat Aplikasi Translator pada Microsoft Word 2010 menggunakan VSTO 4.0</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/03/18/membuat-aplikasi-translator-pada-microsoft-word-2010-menggunakan-vsto-4-0.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/03/18/membuat-aplikasi-translator-pada-microsoft-word-2010-menggunakan-vsto-4-0.aspx</id><published>2011-03-17T17:57:06Z</published><updated>2011-03-17T17:57:06Z</updated><content type="html">&lt;p&gt;Setelah membaca dan mencoba tutorial saya yang sebelumnya mengenai VSTO, sekarang saatnya kita mencoba sesuatu dengan VSTO ini ke tingkat yang lebih tinggi &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_7DF42F16.png" /&gt;. Pada tutorial kali ini kita akan mencoba bersama membuat sebuah kakas penerjemah atau add-ins untuk Microsoft Word 2010 dengan menggunakan VSTO dan nama aplikasi kali ini saya namakan WordTranslator dimana aplikasi ini digunakan untuk melakukan translasi dalam Microsoft Word 2010 dan aplikasi ini menggunakan layanan yang berasal dari Google dan Bing sebagai translator.&lt;/p&gt;  &lt;p&gt;Sebelum melakukan pembuatan aplikasi ini berikut adalah kakas dan library yang anda butuhkan dalam pengembangan aplikasi ini harus telah tersedia dalam komputer anda:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Microsoft Visual Studio 2010 &lt;/li&gt;    &lt;li&gt;Microsoft Office 2010 &lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.google.com/p/google-api-for-dotnet/"&gt;Google Translate API&lt;/a&gt; (versi yang saya gunakan pada tutorial ini adalah 3.0) &lt;/li&gt;    &lt;li&gt;Mendaftarkan diri di &lt;a href="http://www.bing.com/developers/appids.aspx"&gt;http://www.bing.com/developers/appids.aspx&lt;/a&gt; untuk mendapatkan appID &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Setelah itu, berikut adalah langkah-langkah pembuatan aplikasi:&lt;/p&gt;  &lt;p&gt;1. Buka Visual Studio 2010 anda.&lt;/p&gt;  &lt;p&gt;2. Buat sebuah project baru, pilih office, kemudian pilih Word 2010 Add-in, lalu tuliskan nama project yang anda kehendaki, di sini saya&amp;#160;&amp;#160; menuliskan “WordTranslator2010”, lalu tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;3. Kemudian tambahkan User Control pada project anda dengan cara klik kanan pada project anda lalu pilih Add User Control, maka akan tampil jendela berikut. Isi nama User Control kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb1_thumb_38DB61E0.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" class="aligncenter" title="image_thumb1_thumb" border="0" alt="image_thumb1_thumb" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb1_thumb_thumb_728ACF3F.png" width="464" height="307" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. Kemudian tambahkan Ribbon pada project anda dengan cara klik kanan pada project anda lalu pilih Add New Item, maka akan tampil jendela berikut. Isi nama Ribbon kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb4_thumb_3CB53E4B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" class="aligncenter" title="image_thumb4_thumb" border="0" alt="image_thumb4_thumb" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb4_thumb_thumb_2B0507E6.png" width="460" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. Kemudian pastikan bahwa 2 item tadi telah berada dalam project anda.&lt;/p&gt;  &lt;p&gt;6. Tambahkan kontrol ToggleButton ke Ribbon anda melalui toolbox bagian Office Ribbon Controls. Anda dapat mengganti nama dari Ribbon anda yang semula group1, saya mengubahnya menjadi “WordTranslator”.&lt;/p&gt;  &lt;p&gt;7. Ubah label ToggleButton tadi melalui jendela properties, pada project saya, saya mengubahnya menjadi “WordTranslator 2010”.&lt;/p&gt;  &lt;p&gt;8. Lalu Ribbon anda akan tampak seperti gambar berikut.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_603DF47E.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_3E721BED.png" width="91" height="123" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;9. Kemudian masukkan beberapa kontrol pada User Control dan ubah propertiesnya sesuai kebutuhan anda.&lt;/p&gt;  &lt;p&gt;10. Berikut adalah tampilan User Control buatan saya.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_55BD205E.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_4012C1F4.png" width="121" height="297" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;11. Setelah itu lakukan add reference kemudian pilih library GoogleTranslate yang telah anda unduh tadi, dll yang digunakan adalah: GoogleTranslateAPI.dll.&lt;/p&gt;  &lt;p&gt;12. Kemudian lakukan add service renference dengan mengisikan web service berikut &lt;a title="http://api.microsofttranslator.com/V2/Soap.svc" href="http://api.microsofttranslator.com/V2/Soap.svc"&gt;http://api.microsofttranslator.com/V2/Soap.svc&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;13. Buat sebuah App.config dengan cara Add New Item lalu isikan dengan konfigurasi sebagai berikut:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_65300C60.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_35FE20C9.png" width="258" height="93" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;14. Setelah itu masukkan kode berikut pada User Control, dengan melakukan klik 2x setiap kontrol.&lt;/p&gt;  &lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1:     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; partial &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; WTUserControl : UserControl
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2:     {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _srcGoogle;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _destGoogle;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _srcBing;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _destBing;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _srcBingName;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:         List&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _destBingName;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:         BingTranslatorService.LanguageServiceClient _proxy;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:         TranslateClient _client;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11:         
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13:         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; WTUserControl()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15:             InitializeComponent();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 16:             InitGoogleTranslate();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 17:             InitBingTranslate();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 18:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 19: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 20:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; InitGoogleTranslate()
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 21:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 22:             _srcGoogle = Google.API.Translate.Language.TranslatableCollection.Select(a =&amp;gt; a.ToString()).ToList();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 23:             _destGoogle = Google.API.Translate.Language.TranslatableCollection.Select(a =&amp;gt; a.ToString()).ToList();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 24:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 25: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 26:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; InitBingTranslate()
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 27:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 28:             _proxy = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; BingTranslatorService.LanguageServiceClient();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 29:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;[] languageCodes = _proxy.GetLanguagesForTranslate(AppId);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 30:             _srcBing = languageCodes.ToList();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 31:             _destBing = languageCodes.ToList();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 32:             _srcBingName = _proxy.GetLanguageNames(AppId, &amp;quot;&lt;span style="color:#8b0000;"&gt;en&lt;/span&gt;&amp;quot;, languageCodes).ToList();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 33:             _destBingName = _proxy.GetLanguageNames(AppId, &amp;quot;&lt;span style="color:#8b0000;"&gt;en&lt;/span&gt;&amp;quot;, languageCodes).ToList();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 34:             
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 35:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 36: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 37:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnTranslate_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 38:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 39:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 40:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; src;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 41:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; dest;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 42:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; srcName;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 43:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; destName;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 44:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; translated;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 45: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 46:             &lt;span style="color:#008000;"&gt;//get text from active document&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 47:             text = Globals.ThisAddIn.Application.ActiveDocument.Content.Text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 48: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 49:             &lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 50:             {   
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 51:                 &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (rbGoogle.Checked)  &lt;span style="color:#008000;"&gt;//user checked Google&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 52:                 {   
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 53:                     src = _srcGoogle[cmbSrcLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 54:                     dest = _destGoogle[cmbDestLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 55:                     label3.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 56:                     label3.Text = src + &amp;quot;&lt;span style="color:#8b0000;"&gt; to &lt;/span&gt;&amp;quot; + dest;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 57:                     _client = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TranslateClient(&amp;quot;&lt;span style="color:#8b0000;"&gt;&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 58:                     translated = _client.Translate(text, GetLang(src),GetLang(dest));
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 59:                     txtResult.Text = translated;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 60:                 }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 61:                 &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (rbBing.Checked)  &lt;span style="color:#008000;"&gt;//user checked Bing&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 62:                 {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 63:                     src = _srcBing[cmbSrcLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 64:                     dest = _destBing[cmbDestLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 65:                     srcName = _srcBingName[cmbSrcLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 66:                     destName = _destBingName[cmbDestLang.SelectedIndex];
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 67:                     label3.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 68:                     label3.Text = srcName + &amp;quot;&lt;span style="color:#8b0000;"&gt; to &lt;/span&gt;&amp;quot; + destName;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 69:                     translated = _proxy.Translate(AppId, text, src, dest,&amp;quot;&lt;span style="color:#8b0000;"&gt;&lt;/span&gt;&amp;quot;,&amp;quot;&lt;span style="color:#8b0000;"&gt;&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 70:                     txtResult.Text = translated;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 71:                 }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 72:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 73:             &lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (Exception ex)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 74:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 75:                 MessageBox.Show(&amp;quot;&lt;span style="color:#8b0000;"&gt;Error, &lt;/span&gt;&amp;quot; + ex.Message);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 76:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 77:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 78: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 79:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FillLanguageGoogle()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 80:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 81:             cmbSrcLang.Items.Clear();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 82:             cmbSrcLang.Items.AddRange(_srcGoogle.ToArray());
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 83:             cmbSrcLang.SelectedIndex = 0;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 84: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 85:             cmbDestLang.Items.Clear();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 86:             cmbDestLang.Items.AddRange(_destGoogle.ToArray());
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 87:             cmbDestLang.SelectedIndex = 0;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 88: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 89:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 90: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 91:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; FillLanguageBing()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 92:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 93:             cmbSrcLang.Items.Clear();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 94:             cmbSrcLang.Items.AddRange(_srcBingName.ToArray());
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 95:             cmbSrcLang.SelectedIndex = 0;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 96: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 97:             cmbDestLang.Items.Clear();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 98:             cmbDestLang.Items.AddRange(_destBingName.ToArray());
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 99:             cmbDestLang.SelectedIndex = 0;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;100:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;101: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;102:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; rbGoogle_CheckedChanged(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;103:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;104:             FillLanguageGoogle();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;105:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;106: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;107:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; rbBing_CheckedChanged(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;108:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;109:             FillLanguageBing();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;110:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;111: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;112:         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Language GetLang(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; lang)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;113:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;114:             &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (Language language &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; Google.API.Translate.Language.TranslatableCollection)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;115:             {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;116:                 &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (language.ToString().Equals(lang))
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;117:                 {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;118:                     &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; language;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;119:                 }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;120:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;121:             &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; Language.English;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;122:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;123: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;124:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; AppId
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;125:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;126:             &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; ConfigurationManager.AppSettings[&amp;quot;&lt;span style="color:#8b0000;"&gt;appID&lt;/span&gt;&amp;quot;]; }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;127:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;128: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;129:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnDetect_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;130:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;131:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; text = Globals.ThisAddIn.Application.ActiveDocument.Content.Text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;132:             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (rbGoogle.Checked)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;133:             {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;134:                 &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; reliable;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;135:                 &lt;span style="color:#0000ff;"&gt;double&lt;/span&gt; confidence;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;136:                 _client = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TranslateClient(&amp;quot;&lt;span style="color:#8b0000;"&gt;&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;137:                 MessageBox.Show(&amp;quot;&lt;span style="color:#8b0000;"&gt;Your current language is &lt;/span&gt;&amp;quot;+_client.Detect(text, &lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; reliable, &lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; confidence));
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;138:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;139:             &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (rbBing.Checked)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;140:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;141:                 MessageBox.Show(_proxy.Detect(AppId,text));
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;142:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;143:         }        
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;144:     }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;15. Tambahkan kode berikut pada ThisAddIn.cs.&lt;/p&gt;

&lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1:     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ThisAddIn
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2:     {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:         Microsoft.Office.Tools.CustomTaskPane _ctp;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; void ThisAddIn_Startup(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, System.EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:             _ctp = Globals.ThisAddIn.CustomTaskPanes.Add(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WTUserControl(), &amp;quot;&lt;span style="color:#8b0000;"&gt;WordTranslator&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; void ShowWordTranslator()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11:             _ctp.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14:         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; void HideWordTranslator()
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 16:             _ctp.Visible = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 17:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 18: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 19:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; void ThisAddIn_Shutdown(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, System.EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 20:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 21:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 22: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 23:         #region VSTO generated code
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 24: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 25:         /// &amp;lt;summary&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 26:         /// Required method &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt; Designer support - &lt;span style="color:#0000ff;"&gt;do&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;not&lt;/span&gt; modify
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 27:         /// the contents &lt;span style="color:#0000ff;"&gt;of&lt;/span&gt; this method &lt;span style="color:#0000ff;"&gt;with&lt;/span&gt; the code editor.
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 28:         /// &amp;lt;/summary&amp;gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 29:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; void InternalStartup()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 30:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 31:             this.Startup += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.EventHandler(ThisAddIn_Startup);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 32:             this.Shutdown += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.EventHandler(ThisAddIn_Shutdown);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 33:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 34:         
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 35:         #endregion
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 36:     }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;16. Kemudian tambahkan kode berikut pada Ribbon dengan melakukan klik 2x pada ToggleButton.&lt;/p&gt;

&lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; void toggleButton1_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, RibbonControlEventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (toggleButton1.Checked)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:                 Globals.ThisAddIn.ShowWordTranslator();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:             &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:                 Globals.ThisAddIn.HideWordTranslator();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11:         }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;17. Kemudian jalankan program anda dengan menekan tombol F5. Berikut adalah tampilan aplikasi:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_01111B8C.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_725649D9.png" width="516" height="316" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demikian tutorial dari saya kali ini yang mengaplikasikan 2 buah API yang salah satunya berupa web service. Semoga bermanfaat &lt;img style="border-bottom-style:none;border-left-style:none;border-top-style:none;border-right-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_7DF42F16.png" /&gt;.&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=1141" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="VSTO" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/VSTO/default.aspx" /></entry><entry><title>Microsoft Technology Update Road Trip 2011 @Ma Chung, Malang</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/03/05/microsoft-technology-update-road-trip-2011-ma-chung-malang.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/03/05/microsoft-technology-update-road-trip-2011-ma-chung-malang.aspx</id><published>2011-03-05T16:20:00Z</published><updated>2011-03-05T16:20:00Z</updated><content type="html">&lt;h4&gt;Pendahuluan&lt;/h4&gt;  &lt;p&gt;Pada hari Jumat tanggal 4 Maret 2011, &lt;a href="http://www.facebook.com/home.php?sk=group_174250869267302"&gt;MSP Regional Jawa Timur&lt;/a&gt; bekerja sama dengan MUGI Ma Chung mengadakan acara &lt;a href="http://students.netindonesia.net/blogs/msp/archive/2011/02/22/microsoft-technology-update-road-trip-2011.aspx"&gt;Microsoft Technology Update Road Trip 2011&lt;/a&gt; di &lt;a href="http://www.machung.ac.id/"&gt;Universitas Ma Chung, Malang&lt;/a&gt;. Tujuan utama dari acara ini adalah memberikan &lt;em&gt;update &lt;/em&gt;mengenai teknologi terbaru dan pengenalan program-program akademik dari Microsoft. Pembicara dalam kegiatan ini, yaitu: Julius Fenata (Academic Developer Advisor Microsoft Indonesia), &lt;a href="http://students.netindonesia.net/blogs/jeffrey/default.aspx"&gt;Jeffrey Hermanto Halimsetiawan&lt;/a&gt; (MSP ITS), &lt;a href="http://students.netindonesia.net/blogs/alexrhd"&gt;Alexander Rahardjo&lt;/a&gt; (MSP ITS),&amp;#160; dan &lt;a href="http://students.netindonesia.net/blogs/izzuddin/default.aspx"&gt;Izzuddin Gumilar&lt;/a&gt; (MSP ITS).&lt;/p&gt;  &lt;h4&gt;&lt;b&gt;Pelaksanaan&lt;/b&gt;&lt;/h4&gt;  &lt;ul&gt;   &lt;li&gt;Hari / Tanggal : Jumat, 4 Maret 2011 &lt;/li&gt;    &lt;li&gt;Waktu : 15.00 - 18.00 WIB &lt;/li&gt;    &lt;li&gt;Tempat : Balai Pertiwi, Univ Ma Chung&lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;&lt;b&gt;Agenda&lt;/b&gt;&lt;/h4&gt;  &lt;p&gt;Acara ini dibuka dengan sesi pertama oleh Julius Fenata yang memberikan penjelasan mulai dari MSDN AA, Did You Know?, showcase aplikasi WPF, Silverlight, XNA dan Microsoft Surface dalam bentuk video serta Imagine Cup sebagai kompetisi IT terbesar di dunia.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/185631_1814351965903_1453171189_1953763_7209951_n_6B8EB8D8.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="185631_1814351965903_1453171189_1953763_7209951_n" border="0" alt="185631_1814351965903_1453171189_1953763_7209951_n" src="http://students.netindonesia.net/blogs/alexrhd/185631_1814351965903_1453171189_1953763_7209951_n_thumb_2133D866.jpg" width="180" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Acara dilanjutkan dengan sesi kedua yang diisi oleh &lt;a href="http://students.netindonesia.net/blogs/jeffrey/default.aspx"&gt;Jeffrey Hermanto Halimsetiawan&lt;/a&gt;(MSP ITS) mengenai Windows Phone 7 yang merupakan Smartphone OS terbaru yang dikeluarkan oleh Microsoft. Penjelasan ini dimulai dari &lt;em&gt;hardware&lt;/em&gt; dari Windows Phone 7 lalu Windows Phone 7 dari sisi c&lt;em&gt;onsumer&lt;/em&gt; dan &lt;em&gt;developer&lt;/em&gt;. Di dalam sesi ini dijelaskan mengenai pembangunan aplikasi mobile pada Windows Phone 7 OS dan dilengkapi dengan demo aplikasi Windows Phone 7 yang dikembangkan bernama &lt;a href="http://students.netindonesia.net/blogs/jeffrey/archive/2011/01/26/petualangan-aksara-di-tanah-jawa-for-wp7.aspx"&gt;Petualangan Aksara di Tanah Jawa for WP7&lt;/a&gt;. Dalam sesi ini peserta cukup antusias dalam mencoba aplikasi yang didemokan ini.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/183048_1814352125907_1453171189_1953764_5242708_n_53B735D8.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="183048_1814352125907_1453171189_1953764_5242708_n" border="0" alt="183048_1814352125907_1453171189_1953764_5242708_n" src="http://students.netindonesia.net/blogs/alexrhd/183048_1814352125907_1453171189_1953764_5242708_n_thumb_0F36F8FF.jpg" width="295" height="203" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Berikut adalah materi presentasi Windows Phone 7:&lt;/p&gt; &lt;iframe src="http://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD2BDF91F60CC2716D!267&amp;amp;p4=" frameborder="0"&gt;&lt;/iframe&gt;  &lt;p&gt;Kemudian dilanjutkan dengan sesi ketiga yang diisi oleh &lt;a href="http://students.netindonesia.net/blogs/alexrhd"&gt;Alexander Rahardjo&lt;/a&gt;(MSP ITS). Pada sesi ini dijelaskan mengenai asal mula teknologi MultiPoint, penerapan aplikasi MultiPoint melalui sebuah video, sekilas mengenai Windows MultiPoint Mouse SDK 1.5.1, membangun aplikasi Flash dengan memanfaatkan Microsoft MultiPoint SDK 1.1 dan diakhiri demo aplikasi Flash MultiPoint bernama &lt;a href="http://www.facebook.com/album.php?id=126999137357194&amp;amp;aid=19471"&gt;Petualangan Aksara di Tanah Jawa&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/189132_1814352245910_1453171189_1953765_6370915_n_0F07493F.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="189132_1814352245910_1453171189_1953765_6370915_n" border="0" alt="189132_1814352245910_1453171189_1953765_6370915_n" src="http://students.netindonesia.net/blogs/alexrhd/189132_1814352245910_1453171189_1953765_6370915_n_thumb_7EBB35AB.jpg" width="306" height="211" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Berikut adalah materi presentasi MultiPoint:&lt;/p&gt; &lt;iframe src="http://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD2BDF91F60CC2716D!378&amp;amp;p4=" frameborder="0"&gt;&lt;/iframe&gt;  &lt;p&gt;Selanjutnya sesi keempat diisi oleh &lt;a href="http://students.netindonesia.net/blogs/izzuddin/default.aspx"&gt;Izzuddin Gumilar&lt;/a&gt; (MSP ITS) mengenai Microsoft Webmatrix dan Razor View Engine. Di dalam sesi ini, dijelaskan mudahnya membangun sebuah aplikasi web yang bresifat pre-build application dengan menggunakan Microsoft webmatrix yang disertai dengan demo dengan menggunakan web template and gallery yang telah disediakan oleh webmatrix. Selain itu sesi ini dilengkapi dengan penjelasan mengenai Razor View Engine yang merupakan salah satu option view engine yang dimiliki oleh asp.net framework yang juga merupakan komponen yang dibundle di dalam Microsoft Webmatrix.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/190125_1814352365913_1453171189_1953766_583331_n_541F54CE.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="190125_1814352365913_1453171189_1953766_583331_n" border="0" alt="190125_1814352365913_1453171189_1953766_583331_n" src="http://students.netindonesia.net/blogs/alexrhd/190125_1814352365913_1453171189_1953766_583331_n_thumb_77B830CE.jpg" width="314" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Berikut adalah materi presentasi Microsoft Webmatrix:&lt;/p&gt; &lt;iframe src="http://r.office.microsoft.com/r/rlidPowerPointEmbed?p1=1&amp;amp;p2=1&amp;amp;p3=SD2BDF91F60CC2716D!331&amp;amp;p4=" frameborder="0"&gt;&lt;/iframe&gt;  &lt;p&gt;Acara terakhir dimeriahkan dengan demo langsung game &lt;em&gt;Kinect Adventures &lt;/em&gt;dengan Microsoft Kinect&lt;em&gt; &lt;/em&gt;oleh para MSP yang kemudian dicoba secara langsung oleh beberapa peserta. Demo Kinect ini memperoleh antusias yang sangat besar dari penonton.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4704_4FC50BA2.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4704" border="0" alt="IMG_4704" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4704_thumb_1EC2089D.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4708_3E4132A5.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4708" border="0" alt="IMG_4708" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4708_thumb_6B25AE0C.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Acara ditutup dengan penyerahan penghargaan bagi para pembicara oleh panitia acara dari Universitas Ma Chung, kemudian dilanjutkan dengan foto bersama.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4711_5A5E035E.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4711" border="0" alt="IMG_4711" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4711_thumb_7F2B5270.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4712_6FC7CA94.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4712" border="0" alt="IMG_4712" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4712_thumb_40656D96.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4715_1635BFAE.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4715" border="0" alt="IMG_4715" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4715_thumb_5C62B45C.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4720_07C6D557.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;padding-top:0px;" title="IMG_4720" border="0" alt="IMG_4720" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4720_thumb_1EA192D4.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Berikut adalah beberapa foto yang menunjukkan antusiasme peserta acara ini.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4661_081ECE80.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4661" border="0" alt="IMG_4661" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4661_thumb_2FD15C78.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/IMG_4677_1373F48B.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="IMG_4677" border="0" alt="IMG_4677" src="http://students.netindonesia.net/blogs/alexrhd/IMG_4677_thumb_79ABD029.jpg" width="260" height="180" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Puji syukur acara &lt;a href="http://students.netindonesia.net/blogs/msp/archive/2011/02/22/microsoft-technology-update-road-trip-2011.aspx"&gt;Microsoft Technology Update Road Trip 2011&lt;/a&gt;di Universitas Ma Chung ini dapat berjalan sukses dan lancar, tidak lupa kami sampaikan terima kasih kepada MUGI Universitas Ma Chung yang telah bekerja sama dalam menyelenggarakan acara ini. Semoga dengan adanya acara ini dapat menumbuhkan motivasi mahasiswa Ma Chung untuk berkarya dengan menggunakan teknologi-teknologi terbaru Microsoft untuk berkompetisi dalam Imagine Cup 2012 tahun depan. &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_47847FDF.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=1033" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author></entry><entry><title>Membuat Aplikasi Twitter pada Microsoft Word 2010 menggunakan VSTO 4.0</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/22/membuat-aplikasi-twitter-pada-microsoft-word-2010-menggunakan-vsto-4-0.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/22/membuat-aplikasi-twitter-pada-microsoft-word-2010-menggunakan-vsto-4-0.aspx</id><published>2011-02-22T05:53:00Z</published><updated>2011-02-22T05:53:00Z</updated><content type="html">&lt;p&gt;Setelah menulis tutorial untuk membuat &lt;a href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/21/word-mini-browser-2010-untuk-microsoft-word-2010-menggunakan-vsto-4-0.aspx"&gt;Word Mini Browser 2010&lt;/a&gt; yaitu sebuah aplikasi yang memungkinkan pengguna untuk menjelajah web melalui Microsoft Word 2010, saat ini saya akan menuliskan sebuah tutorial yang tidak kalah seru dari yang lalu yaitu tutorial mengenai pembuatan sebuah add-in untuk Microsoft Word 2010 yang kegunaannya untuk melakukan tweet pada akun twitter anda melalui Word 2010, aplikasi ini saya namai WordTweet 2010.&lt;/p&gt;  &lt;p&gt;Sebelum melakukan pembuatan aplikasi ini berikut adalah kakas dan library yang anda butuhkan dalam pengembangan aplikasi ini harus telah tersedia dalam komputer anda:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Microsoft Visual Studio 2010 &lt;/li&gt;    &lt;li&gt;Microsoft Office 2010 &lt;/li&gt;    &lt;li&gt;&lt;a href="http://tweetsharp.codeplex.com/releases"&gt;TweetSharp&lt;/a&gt; (yang saya gunakan pada tutorial kali ini adalah v2.0) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Sebelum itu anda terlebih dahulu perlu mendaftarkan diri pada alamat ini &lt;a title="http://dev.twitter.com/apps" href="http://dev.twitter.com/apps"&gt;http://dev.twitter.com/apps&lt;/a&gt; dengan langkah-langkah sebagai berikut:&lt;/p&gt;  &lt;p&gt;1. Klik pada &lt;strong&gt;&lt;font color="#2a2a2a"&gt;Register a new app&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;2. Isi form tersebut, untuk &lt;strong&gt;ApplicationType &lt;/strong&gt;pilih &lt;strong&gt;Client&lt;/strong&gt;, sedangkan untuk &lt;strong&gt;Default Access Type &lt;/strong&gt;pilih &lt;strong&gt;Read &amp;amp; Writer&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Setelah itu, berikut adalah langkah-langkah pembuatan aplikasi:&lt;/p&gt;  &lt;p&gt;1. Buka Visual Studio 2010 anda.&lt;/p&gt;  &lt;p&gt;2. Buat sebuah project baru, pilih office, kemudian pilih Word 2010 Add-in, lalu tuliskan nama project yang anda kehendaki, di sini saya&amp;#160;&amp;#160; menuliskan “WordTweet2010”, lalu tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/1_thumb1_20BE2CC5.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="1_thumb[1]" border="0" alt="1_thumb[1]" src="http://students.netindonesia.net/blogs/alexrhd/1_thumb1_thumb_4A615C1E.png" width="457" height="302" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. Kemudian tambahkan User Control pada project anda dengan cara klik kanan pada project anda lalu pilih Add User Control, maka akan tampil jendela berikut. Isi nama User Control kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb1_097F3A22.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[1]" border="0" alt="image_thumb[1]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb1_thumb_3B1A0BDD.png" width="464" height="307" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. Kemudian tambahkan Ribbon pada project anda dengan cara klik kanan pada project anda lalu pilih Add New Item, maka akan tampil jendela berikut. Isi nama Ribbon kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb4_1B2B5C88.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[4]" border="0" alt="image_thumb[4]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb4_thumb_2E2C3D9A.png" width="460" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. Kemudian pastikan bahwa 2 item tadi telah berada dalam project anda.&lt;/p&gt;  &lt;p&gt;6. Tambahkan kontrol ToggleButton ke Ribbon anda melalui toolbox bagian Office Ribbon Controls. Anda dapat mengganti nama dari Ribbon anda yang semula group1, saya mengubahnya menjadi “WordTweet”.&lt;/p&gt;  &lt;p&gt;7. Ubah label ToggleButton tadi melalui jendela properties, pada project saya, saya mengubahnya menjadi “WordTweet 2010”.&lt;/p&gt;  &lt;p&gt;8. Lalu Ribbon anda akan tampak seperti gambar berikut.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb14_5E827676.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[14]" border="0" alt="image_thumb[14]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb14_thumb_6AE073D2.png" width="291" height="158" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;9. Kemudian masukkan beberapa kontrol pada User Control dan ubah propertiesnya sebagai berikut:&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Panel; Dock: Fill &lt;/li&gt;      &lt;li&gt;Label; Text: Enter your PIN; Enable: false &lt;/li&gt;      &lt;li&gt;Label; Text: Your Tweet; Enable: false &lt;/li&gt;      &lt;li&gt;Textbox; Enable: false &lt;/li&gt;      &lt;li&gt;Button; Name: btnGetPin, Text: Get PIN &lt;/li&gt;      &lt;li&gt;Button; Name: btnTweet, Text: Tweet it!; Enable: false&amp;#160; &lt;/li&gt;      &lt;li&gt;RichTextbox; Enable: false&amp;#160; &lt;/li&gt;      &lt;li&gt;Label; Visible: false &lt;/li&gt;      &lt;li&gt;PictureBox &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;10. Kemudian User Control anda akan tampak seperti gambar berikut.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb25_6DC5B2B8.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[25]" border="0" alt="image_thumb[25]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb25_thumb_725BBD72.png" width="131" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;11. Setelah itu lakukan add reference kemudian pilih library TweetSharp yang telah anda unduh tadi, dll yang digunakan adalah:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;TweetSharp.dll &lt;/li&gt;    &lt;li&gt;Hammock.ClientProfile.dll &lt;/li&gt;    &lt;li&gt;Newtonsoft.Json.dll &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;12. Buat sebuah App.config dengan cara Add New Item lalu isikan dengan konfigurasi sebagai berikut:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb33_1AAAEFC7.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[33]" border="0" alt="image_thumb[33]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb33_thumb_50603521.png" width="382" height="127" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;13. Setelah itu masukkan kode berikut pada User Control, dengan melakukan klik 2x setiap kontrol.&lt;/p&gt;  &lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; WTUserControl()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:     InitializeComponent();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:     _twitterClientInfo = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TwitterClientInfo();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:     _twitterClientInfo.ConsumerKey = ConsumerKey; &lt;span style="color:#008000;"&gt;//Read ConsumerKey out of the app.config&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:     _twitterClientInfo.ConsumerSecret = ConsumerSecret; &lt;span style="color:#008000;"&gt;//Read the ConsumerSecret out the app.config&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:     _twitterService = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TwitterService(_twitterClientInfo);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10: }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnTweet_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13: {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14:    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (richTextBox1.Text.Length &amp;lt;= MAX_TWEET)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15:     {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 16:         &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.IsNullOrEmpty(_token) || &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.IsNullOrEmpty(_tokenSecret))
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 17:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 18:             &lt;span style="color:#008000;"&gt;//Get the pin from text box&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 19:             &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; pin = textBox1.Text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 20: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 21:             OAuthAccessToken accessToken = _twitterService.GetAccessToken(_requestToken, pin);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 22:             &lt;span style="color:#008000;"&gt;//Now we need the Token and TokenSecret&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 23:             _token = accessToken.Token;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 24:             _tokenSecret = accessToken.TokenSecret;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 25: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 26:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 27: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 28:         _twitterService.AuthenticateWith(_token, _tokenSecret);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 29:         &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; tweetMessage = richTextBox1.Text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 30:         _twitterService.SendTweet(tweetMessage);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 31:         label4.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 32:         label4.Text = &amp;quot;&lt;span style="color:#8b0000;"&gt;Your Tweet has been posted!&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 33:     }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 34:     &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 35:     {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 36:         label4.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 37:         label4.Text = &amp;quot;&lt;span style="color:#8b0000;"&gt;Too many character!&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 38:     }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 39: }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 40: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 41: #region ConsumerKey &amp;amp; ConsumerSecret
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 42: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; ConsumerSecret
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 43: {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 44:     &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; ConfigurationManager.AppSettings[&amp;quot;&lt;span style="color:#8b0000;"&gt;ConsumerSecret&lt;/span&gt;&amp;quot;]; }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 45: }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 46: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 47: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; ConsumerKey
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 48: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 49:     &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt; { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; ConfigurationManager.AppSettings[&amp;quot;&lt;span style="color:#8b0000;"&gt;ConsumerKey&lt;/span&gt;&amp;quot;]; }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 50: }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 51: #endregion
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 52: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 53: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnGetPin_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 54: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 55:     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.IsNullOrEmpty(_token) || &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.IsNullOrEmpty(_tokenSecret))
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 56:     {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 57:         &lt;span style="color:#008000;"&gt;//Firstly we need the RequestToken and the AuthorisationUrl&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 58:         _requestToken = _twitterService.GetRequestToken();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 59:         Uri authUrl = _twitterService.GetAuthorizationUri(_requestToken);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 60: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 61:         &lt;span style="color:#008000;"&gt;//authUrl is just a URL we can open IE and paste it in if we want&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 62:         &lt;span style="color:#008000;"&gt;//Please Allow This App to send Tweets on your behalf&amp;quot;);&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 63:         Process.Start(authUrl.AbsoluteUri); &lt;span style="color:#008000;"&gt;//Launches a browser that&amp;#39;ll go to the AuthUrl.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 64:         textBox1.Enabled = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 65:         richTextBox1.Enabled = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 66:         btnTweet.Enabled = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 67:     }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 68: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 69: }&lt;/pre&gt;&lt;/pre&gt;

&lt;br /&gt;14. Tambahkan kode berikut pada ThisAddIn.cs. 

&lt;br /&gt;

&lt;p&gt;
  &lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1: Microsoft.Office.Tools.CustomTaskPane _ctp;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ThisAddIn_Startup(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, System.EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3: {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:     _ctp = Globals.ThisAddIn.CustomTaskPanes.Add(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WMBUserControl(), &amp;quot;&lt;span style="color:#8b0000;"&gt;WordTweet&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5: }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ShowMiniBrowser()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:     _ctp.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10: }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12: &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; HideMiniBrowser()
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13: {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14:     _ctp.Visible = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15: }&lt;/pre&gt;&lt;/pre&gt;

  &lt;br /&gt;15. Kemudian tambahkan kode berikut pada Ribbon dengan melakukan klik 2x pada ToggleButton.&lt;/p&gt;

&lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1: &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; toggleButton1_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, RibbonControlEventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:     &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (toggleButton1.Checked)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:     {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:         Globals.ThisAddIn.ShowMiniBrowser();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:     }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:     &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:     {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:         Globals.ThisAddIn.HideMiniBrowser();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:     }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11: }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;16. Kemudian jalankan program anda dengan menekan tombol F5.&lt;/p&gt;

&lt;p&gt;17. Pilih tombol “Get PIN” terlebih dahulu, kemudian secara otomatis aplikasi akan menampilkan browser anda, lalu masuk ke dalam twitter anda dan pilih “Allow” aplikasi. Kemudian PIN akan muncul.&lt;/p&gt;

&lt;p align="center"&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/3_thumb7_5AD0E374.png"&gt;&lt;img style="background-image:none;border-right-width:0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="3_thumb[7]" border="0" alt="3_thumb[7]" src="http://students.netindonesia.net/blogs/alexrhd/3_thumb7_thumb_39CD4B00.png" width="408" height="240" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;18. Masukkan PIN tersebut ke dalam aplikasi anda dan masukkan tweet anda, kemudian klik tombol “Tweet It!”&lt;/p&gt;

&lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb35_11AA7614.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[35]" border="0" alt="image_thumb[35]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb35_thumb_446A56BB.png" width="429" height="264" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;19. Apabila berhasil, maka hasilnya akan tampak seperti gambar berikut.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_thumb42_33C23600.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image_thumb[42]" border="0" alt="image_thumb[42]" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb42_thumb_1594784C.png" width="298" height="119" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demikian tutorial membuat aplikasi twitter pada Microsoft Word 2010 menggunakan VSTO dari saya. Semoga bermanfaat &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_00564CD7.png" /&gt;&lt;/p&gt;

&lt;p&gt;Selamat mencoba &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_00564CD7.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=955" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Visual Studio 2010" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Visual+Studio+2010/default.aspx" /><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="VSTO" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/VSTO/default.aspx" /><category term="Microsoft Word" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Microsoft+Word/default.aspx" /><category term="Twitter" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Twitter/default.aspx" /></entry><entry><title>Word Mini Browser 2010 untuk Microsoft Word 2010 menggunakan VSTO 4.0</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/21/word-mini-browser-2010-untuk-microsoft-word-2010-menggunakan-vsto-4-0.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/21/word-mini-browser-2010-untuk-microsoft-word-2010-menggunakan-vsto-4-0.aspx</id><published>2011-02-21T04:38:00Z</published><updated>2011-02-21T04:38:00Z</updated><content type="html">&lt;p&gt;Pada tutorial kali ini, terlebih dahulu saya akan menjelaskan sedikit mengenai VSTO.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Apa itu VSTO?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;b&gt;VSTO &lt;/b&gt;merupakan suatu kakas pengembang yang berupa add in dari Visual Studio dan sebuah &lt;b&gt;runtime &lt;/b&gt;yang mengijinkan &lt;b&gt;Microsoft Office &lt;/b&gt;untuk menggunakan .NET dengan membuka fungsi - fungsi dari Microsoft Office itu menggunakan cara-cara .NET. Dengan cara tersebut maka, seseorang dapat membuat suatu fungsionalitas atau &lt;b&gt;add in&lt;/b&gt; ke dalam Microsoft Office dengan menggunakan bahasa-bahasa yang di support oleh &lt;b&gt;.NET&lt;/b&gt; (&lt;b&gt;C#, VB.NET, C++ Managed&lt;/b&gt;). Cara- cara lama di dalam mengembangkan suatu add in pada office yang sebelumnya di dominasi oleh C++ (Unmanaged) dan VBA, membutuhkan waktu yang relatif lebih lama secara perlahan-lahan bisa di lengkapi atau bahkan di gantikan dengan pengembangan menggunakan .NET. VSTO 4.0 digunakan pada Microsoft Office 2010.&lt;/p&gt;  &lt;p&gt;Setelah memahami sedikit mengenai VSTO, selanjutnya saya akan membimbing anda sekalian membangun sebuah project sederhana yang saya beri nama &lt;strong&gt;Word Mini Browser 2010&lt;/strong&gt;, aplikasi ini ditujukan penggunaannya pada Microsoft Word 2010 dan pembangunan aplikasi ini menggunakan VSTO 4.0. Pembuatan aplikasi ini bertujuan untuk memudahkan anda dalam melakukan browsing sekaligus mengerjakan pekerjaan anda pada Microsoft Word 2010.&lt;/p&gt;  &lt;p&gt;Sebelum melakukan pembuatan aplikasi ini berikut adalah kakas yang anda butuhkan dalam pengembangan aplikasi ini harus telah tersedia dalam komputer anda:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Microsoft Visual Studio 2010 &lt;/li&gt;    &lt;li&gt;Microsoft Office 2010 &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Setelah itu, berikut adalah langkah-langkah pembuatan aplikasi:&lt;/p&gt;  &lt;p&gt;1. Buka Visual Studio 2010 anda.&lt;/p&gt;  &lt;p&gt;2. Buat sebuah project baru, pilih office, kemudian pilih Word 2010 Add-in, lalu tuliskan nama project yang anda kehendaki, di sini saya&amp;#160;&amp;#160; menuliskan “WordMiniBrowser”, lalu tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_7259A471.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_7209A917.png" width="480" height="323" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. Kemudian tambahkan User Control pada project anda dengan cara klik kanan pada project anda lalu pilih Add User Control, maka akan tampil jendela berikut. Isi nama User Control kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_38D2807B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_1E421BFD.png" width="489" height="323" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;4. Kemudian tambahkan Ribbon pada project anda dengan cara klik kanan pada project anda lalu pilih Add New Item, maka akan tampil jendela berikut. Isi nama Ribbon kemudian tekan tombol “OK”.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_3DD0AA2B.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_3EC547B0.png" width="495" height="327" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;5. Kemudian pastikan bahwa 2 item tadi telah berada dalam project anda.&lt;/p&gt;  &lt;p&gt;6. Tambahkan kontrol ToggleButton ke Ribbon anda melalui toolbox bagian Office Ribbon Controls. Anda dapat mengganti nama dari Ribbon anda yang semula group1, saya mengubahnya menjadi “WMB Add-Ins”.&lt;/p&gt;  &lt;p&gt;7. Ubah label ToggleButton tadi melalui jendela properties, pada project saya, saya mengubahnya menjadi “Word Mini Browser Pane”.&lt;/p&gt;  &lt;p&gt;8. Lalu Ribbon anda akan tampak seperti gambar berikut.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_4FA929F9.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_1832F2FE.png" width="328" height="277" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;9. Kemudian masukkan beberapa kontrol pada User Control dan ubah propertiesnya sebagai berikut:&lt;/p&gt;  &lt;ol&gt;   &lt;ol&gt;     &lt;li&gt;Panel; Dock: Fill &lt;/li&gt;      &lt;li&gt;Label; Text: Insert URL &lt;/li&gt;      &lt;li&gt;ComboBox; Anchor: Top, Left, Right &lt;/li&gt;      &lt;li&gt;Button; Name: btnGo, Text: Go &lt;/li&gt;      &lt;li&gt;Button; Name: btnStop, Text: Stop &lt;/li&gt;      &lt;li&gt;Button; Name: btnBack, Text: &amp;lt;&amp;lt; &lt;/li&gt;      &lt;li&gt;Button; Name: btnForward, Text: &amp;gt;&amp;gt; &lt;/li&gt;      &lt;li&gt;WebBrowser; Anchor: Top, Bottom, Left, Right &lt;/li&gt;   &lt;/ol&gt; &lt;/ol&gt;  &lt;p&gt;10. Kemudian User Control anda akan tampak seperti gambar berikut.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_7ACD7566.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_6C322DA7.png" width="314" height="320" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;11. Setelah itu masukkan kode berikut pada User Control, dengan melakukan klik 2x setiap kontrol.&lt;/p&gt;  &lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnGo_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt;(comboBox1.Text.Trim() != &amp;quot;&lt;span style="color:#8b0000;"&gt;&lt;/span&gt;&amp;quot;)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:                 webBrowser1.Navigate(comboBox1.Text);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:                 comboBox1.Items.Add(comboBox1.Text);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:                 &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (comboBox1.Items.Count &amp;gt; 5)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:                 {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:                     comboBox1.Items.RemoveAt(1);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:                 }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11:             }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnStop_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 16:             webBrowser1.Stop();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 17:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 18: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 19:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnBack_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 20:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 21:             webBrowser1.GoBack();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 22:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 23: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 24:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; btnForward_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 25:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 26:             webBrowser1.GoForward();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 27:         }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;12. Kemudian tambahkan kode berikut pada Ribbon dengan melakukan klik 2x pada ToggleButton.&lt;/p&gt;

&lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1:         &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; void toggleButton1_Click(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, RibbonControlEventArgs e)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3:             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (toggleButton1.Checked)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5:                 Globals.ThisAddIn.ShowMiniBrowser();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7:             &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9:                 Globals.ThisAddIn.HideMiniBrowser();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11:         }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;13. Kemudian jalankan program anda dengan menekan tombol F5.&lt;/p&gt;

&lt;p&gt;14. Masukkan alamat situs yang ingin anda buka lalu tekan tombol “Go”.&lt;/p&gt;

&lt;p&gt;15. Apabila berhasil, maka hasilnya akan tampak seperti gambar berikut.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_79C49E15.png"&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:block;float:none;margin-left:auto;border-top:0px;margin-right:auto;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_7706E6F1.png" width="630" height="375" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demikian tutorial mengenai salah satu project menggunakan VSTO dari saya. Semoga bermanfaat &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_4F6C7C95.png" /&gt;&lt;/p&gt;

&lt;p&gt;Selamat mencoba &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_4F6C7C95.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=948" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Visual Studio 2010" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Visual+Studio+2010/default.aspx" /><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="VSTO" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/VSTO/default.aspx" /><category term="Microsoft Word" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Microsoft+Word/default.aspx" /></entry><entry><title>MultiPoint pada XNA</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/15/multipoint-pada-xna.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/15/multipoint-pada-xna.aspx</id><published>2011-02-14T19:45:00Z</published><updated>2011-02-14T19:45:00Z</updated><content type="html">&lt;p&gt;MultiPoint merupakan sebuah teknologi yang memungkinkan banyak tetikus (mouse) terhubung dalam sebuah komputer. Teknologi MultiPoint memungkinkan beberapa pengguna mengakses satu komputer secara bersama-sama. Microsoft sendiri telah mengembangkan teknologi ini pada Windows Presentation Foundation (WPF) melalui &lt;a href="http://www.microsoft.com/multipoint/mouse-sdk/"&gt;MultiPoint Mouse SDK&lt;/a&gt;. Namun pada kenyataannya MultiPoint tidak hanya dapat diterapkan pada WPF namun dapat diterapkan pada platform lain, salah satunya yaitu XNA yang tentu saja tidak menggunakan SDK dari Microsoft.&lt;/p&gt;  &lt;p&gt;Pada kesempatan kali ini, saya akan memperkenalkan sebuah teknologi MultiPoint yang dikembangkan pada XNA dan library yang digunakan adalah &lt;a href="http://www.multimolti.com/blog/2009/03/22/multiinput-class-multiple-mice-in-your-xna-game/"&gt;MultiInput&lt;/a&gt;. Tentu saja dengan adanya teknologi ini memungkinkan kita untuk mengembangkan sebuah permainan yang menarik dan interaktif karena XNA merupakan sebuah teknologi untuk pengembangan permainan yang dibuat oleh Microsoft.&lt;/p&gt;  &lt;p&gt;Namun sayangnya berdasarkan uji coba yang telah saya lakukan, library ini masih terdapat kekurangan khususnya apabila dijalankan pada Sistem Operasi Windows 7. Library ini tidak dapat mendeteksi jumlah tetikus yang terhubung dengan komputer secara tepat.&lt;/p&gt;  &lt;p&gt;Berikut adalah langkah-langkah untuk membuat sebuah project MultiPoint pada XNA:&lt;/p&gt;  &lt;p&gt;1. Buat sebuah project XNA&lt;/p&gt;  &lt;p&gt;2. Unduh library MultiInput di &lt;a href="http://www.multimolti.com/blog/2009/03/22/multiinput-class-multiple-mice-in-your-xna-game/"&gt;sini&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. Kemudian masukkan kode berikut pada project anda:&lt;/p&gt;  &lt;pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;padding-bottom:5px;background-color:#fbfbfb;min-height:40px;padding-left:5px;width:650px;padding-right:5px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding-top:5px;"&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  1: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  2: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  3: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  4: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  5: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Audio;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  6: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Content;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  7: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.GamerServices;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  8: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Graphics;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;  9: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Input;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 10: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Media;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 11: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Net;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 12: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Storage;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 13: &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; MultiInput;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 14: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 15: &lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; Game1
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 16: {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 17:     &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 18:     &lt;span style="color:#808080;"&gt;/// This is the main type for your game&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 19:     &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 20:     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Game1 : Microsoft.Xna.Framework.Game
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 21:     {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 22:         GraphicsDeviceManager _graphics;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 23:         SpriteBatch _spriteBatch;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 24: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 25:         MultiInputController _inputController;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 26:         Color[] _mousecolors = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Color[] { Color.Red, Color.Blue,
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 27:             Color.Green, Color.Yellow, Color.White, Color.Pink };
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 28: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 29:         Texture2D _cursor;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 30: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 31:         SpriteFont _font; 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 32: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 33:         &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Game1()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 34:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 35:             _graphics = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; GraphicsDeviceManager(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 36:             _graphics.PreferredBackBufferWidth = 800;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 37:             _graphics.PreferredBackBufferHeight = 600;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 38:             &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Window.Title = &amp;quot;&lt;span style="color:#8b0000;"&gt;MultiPoint XNA&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 39:             Content.RootDirectory = &amp;quot;&lt;span style="color:#8b0000;"&gt;Content&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 40:             _inputController = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; MultiInputController(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Window.Handle);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 41:             
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 42:         }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 43: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 44:         &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 45:         &lt;span style="color:#808080;"&gt;/// Allows the game to perform any initialization it needs to before starting to run.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 46:         &lt;span style="color:#808080;"&gt;/// This is where it can query for any required services and load any non-graphic&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 47:         &lt;span style="color:#808080;"&gt;/// related content.  Calling base.Initialize will enumerate through any components&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 48:         &lt;span style="color:#808080;"&gt;/// and initialize them as well.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 49:         &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 50:         &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 51:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 52:             &lt;span style="color:#008000;"&gt;// TODO: Add your initialization logic here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 53: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 54:             &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Initialize();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 55:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 56: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 57:         &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 58:         &lt;span style="color:#808080;"&gt;/// LoadContent will be called once per game and is the place to load&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 59:         &lt;span style="color:#808080;"&gt;/// all of your content.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 60:         &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 61:         &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; LoadContent()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 62:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 63:             &lt;span style="color:#008000;"&gt;// Create a new SpriteBatch, which can be used to draw textures.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 64:             _spriteBatch = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; SpriteBatch(GraphicsDevice);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 65: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 66:             _cursor = &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Content.Load&amp;lt;Texture2D&amp;gt;(@&amp;quot;&lt;span style="color:#8b0000;"&gt;Sprite\hand&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 67:             _font = &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Content.Load&amp;lt;SpriteFont&amp;gt;(@&amp;quot;&lt;span style="color:#8b0000;"&gt;Fonts\Pericles&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 68:             &lt;span style="color:#008000;"&gt;// TODO: use this.Content to load your game content here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 69:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 70: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 71:         &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 72:         &lt;span style="color:#808080;"&gt;/// UnloadContent will be called once per game and is the place to unload&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 73:         &lt;span style="color:#808080;"&gt;/// all content.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 74:         &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 75:         &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; UnloadContent()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 76:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 77:             &lt;span style="color:#008000;"&gt;// TODO: Unload any non ContentManager content here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 78:             &lt;span style="color:#008000;"&gt;// YOU MUST!!! USE THIS LINE, otherwise your game won&amp;#39;t exit&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 79:             _inputController.Dispose();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 80: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 81:             &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Content.Unload();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 82: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 83:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 84: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 85:         &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 86:         &lt;span style="color:#808080;"&gt;/// Allows the game to run logic such as updating the world,&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 87:         &lt;span style="color:#808080;"&gt;/// checking for collisions, gathering input, and playing audio.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 88:         &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 89:         &lt;span style="color:#808080;"&gt;/// &amp;lt;param name=&amp;quot;gameTime&amp;quot;&amp;gt;Provides a snapshot of timing values.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 90:         &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Update(GameTime gameTime)
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 91:         {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 92:             &lt;span style="color:#008000;"&gt;// Allows the game to exit&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 93:             &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 94:                 &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.Exit();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 95: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 96:             &lt;span style="color:#008000;"&gt;// TODO: Add your update logic here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 97:             &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (RawMouse rawmouse &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; _inputController.Mice)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 98:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt; 99:                 &lt;span style="color:#008000;"&gt;// do whatever you like here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;100:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;101: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;102:             &lt;span style="color:#008000;"&gt;//hidden mouse for temporary&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;103:             Mouse.SetPosition(_graphics.GraphicsDevice.Viewport.Width / 2, _graphics.GraphicsDevice.Viewport.Height / 2);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;104: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;105:             
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;106:             &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Update(gameTime);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;107:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;108: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;109:         &lt;span style="color:#808080;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;110:         &lt;span style="color:#808080;"&gt;/// This is called when the game should draw itself.&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;111:         &lt;span style="color:#808080;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;112:         &lt;span style="color:#808080;"&gt;/// &amp;lt;param name=&amp;quot;gameTime&amp;quot;&amp;gt;Provides a snapshot of timing values.&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;113:         &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(GameTime gameTime)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;114:         {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;115:             GraphicsDevice.Clear(Color.CornflowerBlue);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;116: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;117:             &lt;span style="color:#008000;"&gt;// TODO: Add your drawing code here&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;118: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;119:             _spriteBatch.Begin();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;120: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;121:             &lt;span style="color:#008000;"&gt;// Draw mouse count&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;122:             _spriteBatch.DrawString(_font, &amp;quot;&lt;span style="color:#8b0000;"&gt;Jumlah mouse = &lt;/span&gt;&amp;quot; + _inputController.MiceCount, &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(0, 0), Color.White);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;123: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;124:             &lt;span style="color:#008000;"&gt;// Draw each cursor&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;125:             &lt;span style="color:#0000ff;"&gt;for&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; i = 0; i &amp;lt; _inputController.MiceCount; i++)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;126:             {
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;127:                 RawMouse mouse = _inputController.Mice[i];
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;128:                 _spriteBatch.Draw(_cursor,
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;129: &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2((&lt;span style="color:#0000ff;"&gt;float&lt;/span&gt;)(mouse.X - _cursor.Width/2),
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;130: (&lt;span style="color:#0000ff;"&gt;float&lt;/span&gt;)(mouse.Y - _cursor.Height/2)), _mousecolors[i]);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;131:                
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;132:             }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;133: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;134:             _spriteBatch.End();
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;135: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;136: 
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;137: 
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;138:             &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Draw(gameTime);
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;139:         }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;140:     }
&lt;/pre&gt;&lt;pre style="background-color:#fbfbfb;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;141: }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:11px;"&gt;142: &lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;4. Hasil run dari project ini adalah sebagai berikut:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://students.netindonesia.net/blogs/alexrhd/image_0548E8F7.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://students.netindonesia.net/blogs/alexrhd/image_thumb_6FFA97B4.png" width="445" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Selamat mencoba dan semoga bermanfaat &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_2A45E7C9.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=923" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="XNA" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/XNA/default.aspx" /><category term="MultiInput" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/MultiInput/default.aspx" /><category term="MultiPoint" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/MultiPoint/default.aspx" /></entry><entry><title>Tutorial XNA Project Menggunakan Farseer Physics Engine</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/10/tutorial-xna-project-menggunakan-farseer-physic-engine.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2011/02/10/tutorial-xna-project-menggunakan-farseer-physic-engine.aspx</id><published>2011-02-09T23:12:00Z</published><updated>2011-02-09T23:12:00Z</updated><content type="html">&lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Farseer_Physics_Engine"&gt;Farseer Physic Engine&lt;/a&gt; merupakan engine fisika yang open source untuk .NET.     &lt;br /&gt;Pada tutorial kali ini kita akan mencoba membuat contoh implementasi dari sebuah kotak dan lingkaran. Kotak dan lingkaran tersebut dapat digerakkan dan bertabrakan satu sama lain.&lt;/p&gt;  &lt;h5&gt;Program yang diperlukan (yang digunakan dalam tutorial ini) :&lt;/h5&gt;  &lt;p&gt;-&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://www.microsoft.com/express/Downloads/Download-2008.aspx"&gt;Microsoft Visual Studio 2008 SP 1&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;-&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=80782277-d584-42d2-8024-893fcd9d3e82&amp;amp;displaylang=en"&gt;XNAGS 31&lt;/a&gt;&lt;/p&gt;  &lt;h5&gt;Packages atau project yang dibutuhkan :&lt;/h5&gt;  &lt;p&gt;-&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://farseerphysics.codeplex.com/releases/view/35490#DownloadId=91164"&gt;Farseer Physics 2.1.3 XNA&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;-&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;a href="http://farseerphysics.codeplex.com/releases/view/35490#DownloadId=91168"&gt;DemoBaseXNA&lt;/a&gt;&lt;/p&gt;  &lt;h5&gt;Langkah-langkah :&lt;/h5&gt;  &lt;p&gt;&lt;strong&gt;Buat project baru XNA Game Studio 3.1 -&amp;gt; Windows Game 3.1&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://programmerdiary.files.wordpress.com/2010/04/farseer_newproject.jpg" width="325" height="237" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Add Packages Farseer Physics 2.1.3 XNA &amp;amp; DemoBaseXNA&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://programmerdiary.files.wordpress.com/2010/04/farseer_addpackage.jpg" width="409" height="208" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Add Reference Farseer Physics 2.1.3 XNA &amp;amp; DemoBaseXNA&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;img src="http://programmerdiary.files.wordpress.com/2010/04/farseer_addrefrence.jpg" width="303" height="253" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Buat Class yang diturunkan dari class DemoBaseXNA.ScreenSystem.GameScreen&lt;/strong&gt;&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Text;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; DemoBaseXNA;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; DemoBaseXNA.DrawingSystem;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; DemoBaseXNA.ScreenSystem;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; FarseerGames.FarseerPhysics;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; FarseerGames.FarseerPhysics.Dynamics;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; FarseerGames.FarseerPhysics.Factories;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Graphics;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.Xna.Framework.Input;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; WindowsGame2.Contoh1
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;{
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;    &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; contoh1:GameScreen
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//inisialisasi awal gamescreen&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//load object, digunakan untuk load lingkaran dan kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; LoadContent()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//digunakan untuk menggambar objek ke layar&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(GameTime gameTime)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//handle input state dari gamescreen&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; HandleInput(InputState input)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//handle input dari keyboard&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; HandleKeyboardInput(InputState input)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//text detail saat dilayar pause&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetDetails()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Inisialisasi Class GameScreen&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//inisialisasi physic simulator&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            PhysicsSimulator = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; PhysicsSimulator(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(0, 0));
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//add physic simulator ke view&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            PhysicsSimulatorView = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; hysicsSimulatorView(PhysicsSimulator);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Initialize();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Load objek gambar geometry yang akan diload&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; LoadContent()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//membuat brush untuk draw lingkaran&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//radius, fill color, border color&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _circleBrush = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; CircleBrush(64, Color.White, Color.Black);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _circleBrush.Load(ScreenManager.GraphicsDevice);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//membuat body dari lingkaran untuk simulasi gaya dan impuls&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//radius, masa&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _circleBody = BodyFactory.Instance.CreateCircleBody(PhysicsSimulator, 64, 1);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _circleBody.Position = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(500, 384);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//mmebuat geometri untuk deteksi tabrakan dari lingkaran&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//body, radius, jumlah edge/garis&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            GeomFactory.Instance.CreateCircleGeom(PhysicsSimulator, _circleBody, 64, 20);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//membuat body kotak untuk simulasi gaya dan impuls&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//width, height, mass&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBody = BodyFactory.Instance.CreateRectangleBody(PhysicsSimulator, 128, 128, 1);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBody.Position = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(256, 384);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//membuat geometri untuk deteksi tabrakan dari kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//width, height&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            GeomFactory.Instance.CreateRectangleGeom(PhysicsSimulator, _rectangleBody, 128, 128);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//membuat brush untuk draw kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//width, height, fill color, border color&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBrush = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; RectangleBrush(128, 128, Color.Gold, Color.Black);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBrush.Load(ScreenManager.GraphicsDevice);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.LoadContent();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Draw brush model sesuai dengan bodynya&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Draw(GameTime gameTime)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//memulai proses drawing pada SpriteBatch&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            ScreenManager.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//menggambar brush lingkaran sesuai dengan body lingkaran&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _circleBrush.Draw(ScreenManager.SpriteBatch, _circleBody.Position);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//menggambar brush kotak sesuai dengan body kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBrush.Draw(ScreenManager.SpriteBatch, _rectangleBody.Position, _rectangleBody.Rotation);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//menutup SpriteBatch&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            ScreenManager.SpriteBatch.End();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Draw(gameTime);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Mengatur handle input&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; HandleInput(InputState input)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//jika gamescreen pertama kali dijalankan&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (firstRun)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;                &lt;span style="color:#008000;"&gt;//tambah pause screen ke screen manager&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;                ScreenManager.AddScreen(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; PauseScreen(GetTitle(), GetDetails()));
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;                firstRun = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//jika screen dalam keadaan pause/ berhentei sejenak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.PauseGame)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;                ScreenManager.AddScreen(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; PauseScreen(GetTitle(), GetDetails()));
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//handle input keyboard&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            HandleKeyboardInput(input);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.HandleInput(input);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; HandleKeyboardInput(InputState input)
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set besarnya penambahan gaya jika user menekan A/S/D/W&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; forceAmount = 50;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set gaya awal sebesar 0/ diam&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            Vector2 force = Vector2.Zero;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set Y negatif/ ke bawah&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            force.Y = -force.Y;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol A&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.A)) { force += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(-forceAmount, 0); }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol S&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.S)) { force += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(0, forceAmount); }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol D&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.D)) { force += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(forceAmount, 0); }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol W&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.W)) { force += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Vector2(0, -forceAmount); }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//berikan gaya pada body kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBody.ApplyForce(force);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set besarnya pertambahan torsi pada kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; torqueAmount = 1000;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set torsi awal menjadi 0/ tidak berputar&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;float&lt;/span&gt; torque = 0;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol left&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.Left)) { torque -= torqueAmount; }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//user menekan tombol right&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (input.CurrentKeyboardState.IsKeyDown(Keys.Right)) { torque += torqueAmount; }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//berikan torsi pada kotak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            _rectangleBody.ApplyTorque(torque);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Set atribut lain dalam GameSreen&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#008000;"&gt;//judul dari GameScreen&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetTitle()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &amp;quot;&lt;span style="color:#8b0000;"&gt;Contoh 1 : kotak dan lingkaran&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#008000;"&gt;//Deskripsi dari GameScreen (akan dipasang di pause screen)&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetDetails()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            StringBuilder sb = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; StringBuilder();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;Contoh isi dari layar pause/menu&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;object attached.&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Empty);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;Keyboard:&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;  -Rotasi : panah kanan atau kiri&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;  -Gerak: A,S,D,W&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Empty);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;Mouse&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            sb.AppendLine(&amp;quot;&lt;span style="color:#8b0000;"&gt;  -Tahan mouse kiri lalu drag mouse&lt;/span&gt;&amp;quot;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; sb.ToString();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Set constructor Game, add GameScreen ke Game&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; Game1()
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            graphics = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; GraphicsDeviceManager(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set judul game&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            Window.Title = &amp;quot;&lt;span style="color:#8b0000;"&gt;Contoh Farseer Physics Engine XNA&lt;/span&gt;&amp;quot;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            graphics.SynchronizeWithVerticalRetrace = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            TargetElapsedTime = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; TimeSpan(0, 0, 0, 0, 10);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            IsFixedTimeStep = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set ukuran jendela game&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            graphics.PreferredBackBufferWidth = 800;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            graphics.PreferredBackBufferHeight = 600;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            graphics.IsFullScreen = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set apakah mouse di draw atau tidak&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            IsMouseVisible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//Set window defaults. Parent game can override in constructor&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            Window.AllowUserResizing = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//new-up components and add to Game.Components&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            ScreenManager screenmanager= &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ScreenManager(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            Components.Add(screenmanager);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//set frame counter&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            FrameRateCounter frameRateCounter = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; FrameRateCounter(screenmanager);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            frameRateCounter.DrawOrder = 101;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            Components.Add(frameRateCounter);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//tambah GameScreen yang sudah Anda buat(contoh1)&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            screenmanager.MainMenuScreen.AddMainMenuItem(contoh1.GetTitle(), &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; contoh1());
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            screenmanager.MainMenuScreen.AddMainMenuItem(&amp;quot;&lt;span style="color:#8b0000;"&gt;Keluar&lt;/span&gt;&amp;quot;, &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;);
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            &lt;span style="color:#008000;"&gt;//arahkan game ke main menu&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;            screenmanager.GoToMainMenu();
&lt;/pre&gt;&lt;pre style="background-color:#ffffff;margin:0em;width:100%;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;font-size:12px;"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Selesai&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Dan berikut adalah hasil akhir dari tutorial di atas &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_60C1585C.png" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src="http://programmerdiary.files.wordpress.com/2010/04/farseer_result.jpg?w=300&amp;amp;h=223" alt="" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=909" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="Physics Engine" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Physics+Engine/default.aspx" /><category term="XNA" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/XNA/default.aspx" /><category term="Farseer" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Farseer/default.aspx" /></entry><entry><title>Coded UI Test With Assertion pada Visual Studio 2010</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/22/coded-ui-test-with-assertion-pada-visual-studio-2010.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/22/coded-ui-test-with-assertion-pada-visual-studio-2010.aspx</id><published>2010-12-21T20:18:39Z</published><updated>2010-12-21T20:18:39Z</updated><content type="html">&lt;p&gt;Setelah mencoba tutorial sebelumnya yaitu &lt;a href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/04/coded-ui-test-asp-net-mvc-2-pada-visual-studio-2010.aspx"&gt;Coded UI Test pada Visual Studio 2010&lt;/a&gt;, sampai pada tahap tersebut yang dilakukan oleh Visual Studio 2010 hanyalah merekam langkah-langkah yang dilakukan. Bagaimana jika anda ingin melakukan pengujian akan output dari aplikasi?&lt;/p&gt;  &lt;p&gt;Sekarang saatnya saya mencoba memberikan tambahan testing pada GUI test yaitu Coded UI Test With Assertion&lt;/p&gt;  &lt;p&gt;Untuk melakukan testing ini saya menggunakan aplikasi yang sama dengan pada tutorial sebelumnya :)&lt;/p&gt;  &lt;p&gt;Berikut adalah langkah-langkahnya:&lt;/p&gt;  &lt;p&gt;1. Setelah melakukan testing Coded UI pada &lt;a href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/04/coded-ui-test-asp-net-mvc-2-pada-visual-studio-2010.aspx"&gt;Coded UI Test pada Visual Studio 2010&lt;/a&gt; kemudian masuk ke menu Test kemudian pilih&lt;strong&gt; Generate Code for Coded UI Test &amp;gt; Use Coded UI Test Builder&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/newtest2.png" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Setelah itu akan muncul windows di sebelah kanan anda untuk melakukan test GUI&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/testbuilder.jpg" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;3. Kemudian jalankan IE 8&lt;/p&gt;  &lt;p&gt;4. Buka aplikasi, dalam hal ini saya melakukan uji coba terhadap Login Administrator&lt;/p&gt;  &lt;p&gt;5. Setelah melakukan Login akan muncul halaman baru&lt;/p&gt;  &lt;p&gt;6. Klik kiri tahan dengan mouse anda Assertion pada Window UIMap - Coded UI Test Builder&lt;/p&gt;  &lt;p&gt;7. Arahkan pointer mouse anda ke hasil yang ingin dibandingkan kemudian lepaskan klik, dalam hal ini saya membandingkan dari isi halaman&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/assert.jpg" width="553" height="267" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;8. Kemudian akan muncul jendela properti dan tambahkan properti pengecekan dengan mengklik tombol &amp;quot;Add Assertion&amp;quot; setelah anda memilih properti mana yang akan diberi Assertion, dalam hal ini saya memilih &amp;quot;IsNotNull&amp;quot; lalu klik OK&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/properti.jpg" width="273" height="252" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;9. Lalu klik tombol paling kanan/generate code/ALT+G dan isikan nama method anda dan klik tombol Add and Generate&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/generate1.jpg" width="254" height="116" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;10. Kemudian secara otomatis Visual Studio 2010 akan melakukan generate program untuk assert test UI&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/code.jpg" width="536" height="228" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;11. Setelah itu, karena akan melakukan testing terhadap halaman Login, maka halaman tersebut harus diakses secara otomatis oleh sistem oleh karena itu diperlukan adanya test gabungan antara GUI test yang pada tahap awal dengan assert GUI test ini. Caranya memanggil method assert tadi ketika dilakukan GUI test atau cara yang paling mudah yaitu dengan menyalin code dari method assert anda ke dalam method GUI test yang ada pada tahap awal tujuannya agar pada saat test dijalankan kedua test ini akan berjalan&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/paste.jpg" width="534" height="222" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;12. Lalu untuk melakukan test anda cukup klik kanan pada method yang baru digenerate oleh Visual Studio 2010 tersebut lalu pilih Run Tests&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/methodtest.jpg" width="350" height="271" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;13. Proses GUI Testing dan GUI Assert Testing akan terlaksana secara otomatis (jangan menyentuh keyboard atau mouse karena akan mengganggu proses testing&amp;#160; :))&lt;/p&gt;  &lt;p&gt;14. Apabila proses testing berjalan dengan baik maka akan keluar tanda passed pada Test Result di Visual Studio anda&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/passed1.jpg" width="658" height="122" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;15. Apabila Anda ingin melakukan test lagi maka anda perlu masuk ke menu Test kemudian pilih&lt;strong&gt; Generate Code for Coded UI Test &amp;gt; Use Coded UI Test Builder&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="display:block;float:none;margin-left:auto;margin-right:auto;" src="http://programmerdiary.files.wordpress.com/2010/06/newtest2.png" alt="" /&gt;&lt;/p&gt;  &lt;p&gt;Demikian tutorial dari saya mengenai &lt;strong&gt;Coded UI Test With Assertion&lt;/strong&gt; pada &lt;strong&gt;Visual Studio 2010&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Selamat mencoba &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_12E053BA.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=709" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author></entry><entry><title>Coded UI Test ASP.NET MVC 2 pada Visual Studio 2010</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/04/coded-ui-test-asp-net-mvc-2-pada-visual-studio-2010.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/12/04/coded-ui-test-asp-net-mvc-2-pada-visual-studio-2010.aspx</id><published>2010-12-03T17:05:01Z</published><updated>2010-12-03T17:05:01Z</updated><content type="html">&lt;p&gt;Setelah saya menjelaskan mengenai salah satu fitur baru pada &lt;strong&gt;Visual Studio 2010&lt;/strong&gt; pada artikel sebelumnya &lt;a href="http://programmerdiary.wordpress.com/2010/06/03/generate-sequence-diagram-pada-visual-studio-2010/"&gt;Generate Sequence Diagram from Visual Studio 2010&lt;/a&gt; dan &lt;a href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/24/unit-testing-asp-net-mvc-2-dengan-visual-studio-2010.aspx"&gt;Unit Testing ASP.NET MVC 2 pada Visual Studio 2010&lt;/a&gt;. Selanjutnya pada kesempatan kali ini saya akan mengenalkan sebuah fitur baru yang dimiliki oleh Visual Studio 2010 yang tentunya belum dimiliki oleh versi sebelumnya &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_43DD74B1.png" /&gt;.&lt;/p&gt;  &lt;p&gt;Fitur yang satu ini cukup menarik yaitu &lt;strong&gt;Coded UI Test &lt;/strong&gt;yang digunakan untuk GUI Test, dimana tester dimudahkan untuk melakukan testing GUI pada suatu perangkat lunak.&lt;/p&gt;  &lt;p&gt;Pada kesempatan kali ini saya akan memberikan tutorial untuk menggunakan fitur baru tersebut. Adapun perangkat lunak yang saya gunakan di sini adalah &lt;strong&gt;ASP.NET MVC 2, Visual Studio 2010&lt;/strong&gt;, dan &lt;strong&gt;Windows XP SP 3.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;     &lt;br /&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Berikut adalah tutorialnya:&lt;/p&gt;  &lt;p&gt;1. Buka perangkat lunak anda pada Visual Studio 2010&lt;/p&gt;  &lt;p&gt;2. Pilih menu Test, lalu new test&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/newtest1.jpg"&gt;&lt;img title="newTest" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/newtest1.jpg" width="529" height="318" /&gt;&lt;/a&gt;   &lt;p&gt;3. Lalu akan keluar sebuah windows dimana anda harus memilih Coded UI Test dan isikan nama test anda, dalam tutorial ini saya mengisikan AdminUITest, lalu klik OK&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/popup1.jpg"&gt;&lt;img title="popup" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/popup1.jpg" width="348" height="299" /&gt;&lt;/a&gt;   &lt;p&gt;4. Apabila anda belum memiliki project test maka akan keluar windows untuk new project, dalam tutorial ini saya mengisikan MvcMusicStoreUI.Tests, lalu klik OK&lt;/p&gt;  &lt;p&gt;5. Setelah itu akan muncul windows baru lagi, dimana anda harus memilih option yang atas Record actions, edit UI map or add assertions, lalu klik OK&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/option.jpg"&gt;&lt;img title="option" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/option.jpg" width="471" height="276" /&gt;&lt;/a&gt;   &lt;p&gt;6. Setelah itu akan muncul windows di sebelah kanan anda untuk melakukan test GUI&lt;/p&gt;  &lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/testbuilder.jpg"&gt;&lt;img class="aligncenter size-full wp-image-233" title="testBuilder" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/testbuilder.jpg" width="224" height="61" /&gt;&lt;/a&gt;     &lt;br /&gt;fungsi dari windows di atas antara lain (dari kiri ke kanan): &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Record : berguna jika anda ingin mulai merekan aktivitas testing.&lt;/li&gt;    &lt;li&gt;Show Recorded Steps : untuk menunjukkan langkah-langkah mana saja yang telah dieksekusi.&lt;/li&gt;    &lt;li&gt;Assertion : untuk menambahkan asersi/ pengencekan terhapa output dari aplikasi yang sedang ditest&lt;/li&gt;    &lt;li&gt;Generate Code : untuk menerjemahkan kode hasil rekaman tadi&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;7. Lalu klik tombol paling kiri/start recording/ALT+R&lt;/p&gt;  &lt;p&gt;8. Karena saya menggunakan ASP.NET maka saya menggunakan &lt;a href="http://www.microsoft.com/windows/internet-explorer/default.aspx"&gt;Internet Explorer 8 ( IE 8 ) &lt;/a&gt;untuk melakukan GUI testing ini     &lt;br /&gt;9. Setelah itu jalankan IE 8 dan lakukan yang anda ingin testing (dalam tutorial ini saya melakukan testing terhadap GUI Admin, dengan melakukan masukan username dan password)     &lt;br /&gt;10. Visual Studio 2010 akan secara otomatis melakukan record perilaku anda terhadap GUI yang anda test     &lt;br /&gt;11. Setelah selesai melakukan testing klik tombol paling kiri/pause recording/ALT+P     &lt;br /&gt;12. Dan anda dapat melihat hasil/step yang anda lakukan pada testing tadi dengan mengklik tombol Show Recorded Steps/ALT+S&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/actions.jpg"&gt;&lt;img title="actions" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/actions.jpg" width="380" height="180" /&gt;&lt;/a&gt;   &lt;p&gt;13. Lalu klik tombol paling kanan/generate code/ALT+G dan isikan nama method anda dan klik tombol Add and Generate&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/generate.jpg"&gt;&lt;img title="generate" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/generate.jpg" width="350" height="160" /&gt;&lt;/a&gt;   &lt;p&gt;14. Kemudian secara otomatis Visual Studio 2010 akan melakukan generate program untuk test UI&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/generatecode.jpg"&gt;&lt;img title="generateCode" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/generatecode.jpg" width="588" height="200" /&gt;&lt;/a&gt;   &lt;p&gt;15. Sebelum melakukan test jangan lupa untuk menutup program yang dijalankan tadi&lt;/p&gt;  &lt;p&gt;16. Lalu untuk melakukan test anda cukup klik kanan pada method yang baru digenerate oleh Visual Studio 2010 tersebut lalu pilih Run Tests&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/methodtest.jpg"&gt;&lt;img title="methodTest" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/methodtest.jpg" width="364" height="282" /&gt;&lt;/a&gt;   &lt;p&gt;17. Proses GUI Testing akan terlaksana secara otomatis (jangan menyentuh keyboard atau mouse karena akan mengganggu proses testing &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_43DD74B1.png" /&gt;)     &lt;br /&gt;18. Apabila proses testing berjalan dengan baik maka akan keluar tanda passed pada Test Result di Visual Studio anda&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/passed.jpg"&gt;&lt;img title="passed" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/passed1.jpg" width="594" height="113" /&gt;&lt;/a&gt;   &lt;p&gt;19. Apabila Anda ingin melakukan test lagi maka anda perlu masuk ke menu Test kemudian pilih&lt;strong&gt; Generate Code for Coded UI Test &amp;gt; Use Coded UI Test Builder&lt;/strong&gt;&lt;/p&gt; &lt;a href="http://programmerdiary.files.wordpress.com/2010/06/newtest2.png"&gt;&lt;img title="newTest2" alt="" src="http://programmerdiary.files.wordpress.com/2010/06/newtest2.png" width="491" height="50" /&gt;&lt;/a&gt;   &lt;p&gt;Demikian tutorial dari saya mengenai &lt;strong&gt;Coded UI Test &lt;/strong&gt;pada &lt;strong&gt;Visual Studio 2010&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Selamat mencoba &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://students.netindonesia.net/blogs/alexrhd/wlEmoticon-smile_43DD74B1.png" /&gt;&lt;/p&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=533" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Visual Studio 2010" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Visual+Studio+2010/default.aspx" /><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="ASP.NET MVC 2" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/ASP.NET+MVC+2/default.aspx" /><category term="ASP.NET" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/ASP.NET/default.aspx" /><category term="Coded UI Test" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Coded+UI+Test/default.aspx" /></entry><entry><title>Tutorial Posting Wordpress Menggunakan Windows Live Writer</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/26/tutorial-posting-wordpress-menggunakan-windows-live-writer.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/26/tutorial-posting-wordpress-menggunakan-windows-live-writer.aspx</id><published>2010-11-26T05:31:00Z</published><updated>2010-11-26T05:31:00Z</updated><content type="html">&lt;p&gt;Mungkin sudah banyak yang tahu mengenai penggunaan Windows Live Writer untuk menulis artikel di &lt;a href="http://students.netindonesia.net/blogs/"&gt;blog students&lt;/a&gt; ini. Namun pada tulisan kali ini saya mencoba berbagi mengenai penggunaan &lt;a href="http://explore.live.com/windows-live-writer?os=other"&gt;Windows Live Writer&lt;/a&gt; pada blog account lainnya, yang cukup terkenal juga, seperti &lt;a href="http://wordpress.com/"&gt;Wordpress&lt;/a&gt;.&lt;/p&gt;  &lt;p style="text-align:center;"&gt;&lt;img class="aligncenter" title="Windows Live Writer" alt="" src="http://pearcemayfield.typepad.com/patrick_mayfield/WindowsLiveWriter/Windows%20Live%20Writer.gif" width="448" height="197" /&gt;&lt;/p&gt; Pertama-tama mari kita ketahui terlebih dahulu apa itu &lt;a href="http://explore.live.com/windows-live-writer?os=other"&gt;Windows Live Writer&lt;/a&gt;. &lt;a href="http://explore.live.com/windows-live-writer?os=other"&gt;Windows Live Writer&lt;/a&gt; merupakan aplikasi &lt;a href="http://www.microsoft.com/en/us/default.aspx"&gt;Microsoft&lt;/a&gt; untuk post dan manajemen blog. Dengan menggunakan aplikasi ini anda dapat menuliskan blog secara offline dan mempublishkannya kemudian. Banyak terdapat tools yang dapat membantu kita dalam membuat suatu artikel blog menjadi lebih mudah seperti:   &lt;ul&gt;   &lt;li&gt;Penggunaan themes pada blog anda secara WYSIWIG &lt;/li&gt;    &lt;li&gt;Manipulasi gambar &lt;/li&gt;    &lt;li&gt;&lt;em&gt;Spell checker&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Terdapat tabel HTML &lt;/li&gt;    &lt;li&gt;Terdapat &lt;em&gt;Virtual Earth&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;dan masih banyak lagi &lt;/li&gt; &lt;/ul&gt; Lalu cara menggunakan aplikasi ini akan saya tunjukkan kepada anda melalui artikel ini. Berikut adalah langkah-langkahnya: Download dan install aplikasi Windows Live Writer pada link berikut &lt;a href="http://explore.live.com/windows-live-writer?os=other"&gt;http://explore.live.com/windows-live-writer?os=other&lt;/a&gt; Setelah Windows Live Writer-nya terbuka, masuk ke menu “Blogs” –&amp;gt; “Add blog account”. Lalu pilih Wordpress. &lt;a href="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer1.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="windows_live_writer1" border="0" alt="windows_live_writer1" src="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer1_thumb.jpg" width="304" height="261" /&gt;&lt;/a&gt; Kemudian masukkan alamat blog anda pada menu ini dan jangan lupa untuk memasukkan &lt;em&gt;username&lt;/em&gt; dan &lt;em&gt;password&lt;/em&gt; blog anda &lt;a href="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer2.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="windows_live_writer2" border="0" alt="windows_live_writer2" src="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer2_thumb.jpg" width="304" height="261" /&gt;&lt;/a&gt; Setelah itu akan muncul jendela seperti di bawah ini. Hal ini menunjukkan anda telah berhasil dan aplikasi sedang melakukan sinkronisasi dengan blog anda. &lt;a href="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer3.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="windows_live_writer3" border="0" alt="windows_live_writer3" src="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer3_thumb.jpg" width="244" height="209" /&gt;&lt;/a&gt; Setelah menunggu kemudian akan muncul jendela berikut yang menunjukkan anda telah siap untuk melakukan posting pada Wordpress &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://programmerdiary.files.wordpress.com/2010/11/wlemoticon-smile.png" /&gt;. Ketikkan artikel anda kemudian klik &amp;quot;Publish&amp;quot;. &lt;a href="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer4.jpg"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:5px auto;padding-left:0px;padding-right:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="windows_live_writer4" border="0" alt="windows_live_writer4" src="http://programmerdiary.files.wordpress.com/2010/11/windows_live_writer4_thumb.jpg" width="504" height="301" /&gt;&lt;/a&gt; Demikian tutorial saya kali ini mengenai Windows Live Writer yang merupakan salah satu aplikasi dari Microsoft yang tentu saja akan sangat mempermudah kita dalam melakukan posting pada blog dan juga akan membuat aktifitas &lt;em&gt;blogging&lt;/em&gt; menjadi lebih menyenangkan bukan. Saya sendiri telah mencobanya untuk melakukan posting di &lt;a href="http://programmerdiary.wordpress.com/"&gt;blog&lt;/a&gt; saya, seperti postingan untuk artikel ini juga saya posting menggunakan Windows Live Writer &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://programmerdiary.files.wordpress.com/2010/11/wlemoticon-smile.png" /&gt;. Sekian dan semoga membantu &lt;img style="border-bottom-style:none;border-right-style:none;border-top-style:none;border-left-style:none;" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://programmerdiary.files.wordpress.com/2010/11/wlemoticon-smile.png" /&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=480" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /></entry><entry><title>Unit Testing ASP.NET MVC 2 dengan Visual Studio 2010</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/24/unit-testing-asp-net-mvc-2-dengan-visual-studio-2010.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/24/unit-testing-asp-net-mvc-2-dengan-visual-studio-2010.aspx</id><published>2010-11-23T23:56:00Z</published><updated>2010-11-23T23:56:00Z</updated><content type="html">Pada kesempatan kali ini saya akan memaparkan mengenai Unit Testing pada Visual Studio 2010 yang berjalan pada OS Windows XP SP 3
&lt;br /&gt;
Pada Unit Testing pertama-tama anda harus mempersiapkan aplikasi anda yang akan ditesting berikut dengan dokumen-dokumennya seperti usecase dan sequence diagram serta Test Skenario nya dimana yang telah saya paparkan pada &lt;a href="http://programmerdiary.wordpress.com/2010/06/03/teknik-pengujian-software-testing/" target="_blank"&gt;artikel sebelumnya&lt;/a&gt; dan anda juga dapat dengan mudah melakukan generate sequence diagram seperti pada &lt;a href="http://programmerdiary.wordpress.com/2010/06/03/generate-sequence-diagram-pada-visual-studio-2010/" target="_blank"&gt;tutorial sebelumnya&lt;/a&gt;

&lt;p&gt;Dalam tutorial ini saya menggunakan aplikasi ASP.NET MVC 2. Framework ASP.NET MVC sendiri telah dirancang agar mudah digunakan dengan objek mock yang diperlukan dalam unit testing tertentu. Mock adalah objek-objek yang sengaja diciptakan untuk meniru objek yang sesungguhnya, namun jauh lebih sederhana dan bisa dikondisikan dengan konteks test  unit tertentu. Objek-objek yang sering di-mock dalam sebuah program web diantaranya adalah HTTP Context, HTTP Request, dan HTTP Response. Oleh karena itu anda membutuhkan library Moq untuk keperluan pembuatan mocking terhadap objek. Library Moq versi terbaru bisa di-download dari alamat berikut ini: &lt;a href="http://code.google.com/p/moq/"&gt;http://code.google.com/p/moq/&lt;/a&gt; dan anda juga membutuhkan MvcMockHelpers yang dapat anda lihat di &lt;a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx" target="_blank"&gt;sini&lt;/a&gt; atau &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd942838.aspx" target="_blank"&gt;ini&lt;/a&gt;. Selanjutnya buka aplikasi anda :) &lt;/p&gt;
&lt;br /&gt;&lt;br /&gt;
Langkah-langkahnya adalah sebagai berikut:
&lt;br /&gt;&lt;br /&gt;
1. Buka project ASP.NET MVC 2 anda pada Visual Studio 2010
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/open.jpg"&gt;&lt;img class="aligncenter size-full wp-image-228" title="open" src="http://programmerdiary.files.wordpress.com/2010/06/open.jpg" alt="" width="430" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;
2. Pilih menu Test, lalu new test
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/newtest.jpg"&gt;&lt;img class="aligncenter size-full wp-image-229" title="newTest" src="http://programmerdiary.files.wordpress.com/2010/06/newtest.jpg" alt="" width="430" height="260" /&gt;&lt;/a&gt;&lt;/p&gt;
3. Lalu akan keluar sebuah windows dimana anda harus memilih Unit Test Wizard dan isikan nama project test anda, dalam tutorial ini saya mengisikan MvcMusicStore.Tests, lalu klik Create

&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/addnewtest.jpg"&gt;&lt;img class="aligncenter size-full wp-image-289" title="addNewTest" src="http://programmerdiary.files.wordpress.com/2010/06/addnewtest.jpg" alt="" width="504" height="433" /&gt;&lt;/a&gt;&lt;/p&gt;

4. Setelah itu akan muncul windows lagi dimana anda harus memilih method pada project anda yang akan anda test, pada tutorial ini saya akan mengetes method LogOn() yang digunakan untuk Login, lalu klik OK
&lt;p&gt;&lt;img class="aligncenter" title="createUnitTest" src="http://programmerdiary.files.wordpress.com/2010/06/createunittest.jpg" alt="" width="565" height="430" /&gt;&lt;/p&gt;
5. Kemudian secara otomatis Visual Studio 2010 akan melakukan generate pada program test anda.
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/createunittest.jpg"&gt;&lt;/a&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/generatecode1.jpg"&gt;&lt;img class="aligncenter size-full wp-image-291" title="generateCode" src="http://programmerdiary.files.wordpress.com/2010/06/generatecode1.jpg" alt="" width="678" height="287" /&gt;&lt;/a&gt;&lt;/p&gt;
6. Namun karena kita akan melakukan testing terhadap ASP.NET MVC 2, maka kita tidak akan bisa menggunakan code dasar yang di-generate oleh Visual Studio 2010. Yang anda harus lakukan adalah memberikan code sebagai berikut pada method tersebut:

&lt;pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt;1:  // Setup  
2:        var formsAuthenticationMock = new Mock&amp;lt;IFormsAuthenticationService&amp;gt;();  
3:        var membershipProviderMock = new Mock&amp;lt;IMembershipService&amp;gt;();  
4:        AccountController target = new AccountController(formsAuthenticationMock.Object, membershipProviderMock.Object);  
5:        target.SetFakeControllerContext();  
6:        // Execute  
7:        ViewResult result = target.LogOn() as ViewResult;  
8:        // Verify  
9:        ViewDataDictionary viewData = result.ViewData;  
10:        Assert.AreEqual(&amp;quot;LoginGet&amp;quot;, viewData[&amp;quot;Title&amp;quot;]);  
11:        Assert.AreEqual(1, viewData.Count);  
&lt;/code&gt;&lt;/pre&gt;

7. Setelah itu jangan lupa anda perlu menghapus code bagian ini pada method tersebut, karena testing akan berjalan bukan pada browser.

&lt;pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt;1:  [HostType(&amp;quot;ASP.NET&amp;quot;)]  
2:      [AspNetDevelopmentServerHost(&amp;quot;C:\\Documents and Settings\\Alexander Rahardjo\\Desktop\\Verval_MusicStoreMVC\\tutorial\\2\\Source\\MvcMusicStore&amp;quot;, &amp;quot;/&amp;quot;)]  
3:      [UrlToTest(&amp;quot;http://localhost:1397/&amp;quot;)]  
&lt;/code&gt;&lt;/pre&gt;

8. Maka secara keseluruhan code anda akan menjadi seperti ini

&lt;pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt;1:  [TestMethod()]  
2:      public void LogOnTest()  
3:      {  
4:        // Setup  
5:        var formsAuthenticationMock = new Mock&amp;lt;IFormsAuthenticationService&amp;gt;();  
6:        var membershipProviderMock = new Mock&amp;lt;IMembershipService&amp;gt;();  
7:        AccountController target = new AccountController(formsAuthenticationMock.Object, membershipProviderMock.Object);  
8:        target.SetFakeControllerContext();  
9:        // Execute  
10:        ViewResult result = target.LogOn() as ViewResult;  
11:        // Verify  
12:        ViewDataDictionary viewData = result.ViewData;  
13:        Assert.AreEqual(&amp;quot;LoginGet&amp;quot;, viewData[&amp;quot;Title&amp;quot;]);  
14:        Assert.AreEqual(1, viewData.Count);  
15:      }  
&lt;/code&gt;&lt;/pre&gt;
9. Lalu setelah ini anda perlu melakukan klik kanan pada method yang akan di tes tadi dan pilih Run Tests
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/runtest.jpg"&gt;&lt;img class="aligncenter size-full wp-image-292" title="runTest" src="http://programmerdiary.files.wordpress.com/2010/06/runtest.jpg" alt="" width="682" height="439" /&gt;&lt;/a&gt;&lt;/p&gt;
10. Dan berikut adalah hasilnya pada Test Results
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/pass1.jpg"&gt;&lt;img class="aligncenter size-full wp-image-293" title="pass1" src="http://programmerdiary.files.wordpress.com/2010/06/pass1.jpg" alt="" width="678" height="147" /&gt;&lt;/a&gt;&lt;/p&gt;
11. Setelah itu pada tutorial ini saya mengetes 2 method LogOn() yang awalnya saya test adalah LogOn() untuk GET dan sekarang akan saya test LogOn() untuk POST

12. Dan berikut adalah contoh code untuk LogOn() POST:
&lt;pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt;1:  [TestMethod()]  
2:      public void LogOnTest2()  
3:      {  
4:        //AccountController target = new AccountController(); // TODO: Initialize to an appropriate value  
5:        //ActionResult expected = null; // TODO: Initialize to an appropriate value  
6:        //ActionResult actual;  
7:        //actual = target.LogOff();  
8:        //Assert.AreEqual(expected, actual);  
9:        //Assert.Inconclusive(&amp;quot;Verify the correctness of this test method.&amp;quot;);  
10:        // Setup  
11:        var formsAuthenticationMock = new Mock&amp;lt;IFormsAuthenticationService&amp;gt;();  
12:        var membershipProviderMock = new Mock&amp;lt;IMembershipService&amp;gt;();  
13:        string username = &amp;quot;Administrator&amp;quot;;  
14:        string password = &amp;quot;password123&amp;quot;;  
15:        string returnUrl = &amp;quot;StoreManager&amp;quot;;  
16:        bool rememberMe = false;  
17:        LogOnModel model = new LogOnModel();  
18:        model.UserName = username;  
19:        model.Password = password;  
20:        model.RememberMe = rememberMe;  
21:        formsAuthenticationMock.Expect(f =&amp;gt; f.SignIn(username, rememberMe));  
22:        AccountController target = new AccountController(formsAuthenticationMock.Object, membershipProviderMock.Object);  
23:        target.SetFakeControllerContext();  
24:        target.HttpContext.Request.SetHttpMethodResult(&amp;quot;POST&amp;quot;);  
25:        //// Execute  
26:        //RedirectToRouteResult result = target.LogOn(model,returnUrl) as RedirectToRouteResult;  
27:        // Execute  
28:        ViewResult result = target.LogOn(model, returnUrl) as ViewResult;  
29:        membershipProviderMock  
30:          .Expect(m =&amp;gt; m.ValidateUser(username, password))  
31:          .Returns(true);  
32:        // Verify  
33:        ViewDataDictionary viewData = result.ViewData;  
34:        Assert.AreEqual(&amp;quot;LoginPost&amp;quot;, viewData[&amp;quot;Title&amp;quot;]);  
35:        Assert.AreEqual(1, viewData.Count);  
36:      }  
&lt;/code&gt;&lt;/pre&gt;

13. Lakukan Run Test lagi dan berikut adalah hasilnya pada Test Results
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/pass2.jpg"&gt;&lt;img class="aligncenter size-full wp-image-294" title="pass2" src="http://programmerdiary.files.wordpress.com/2010/06/pass2.jpg" alt="" width="677" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;
14. Anda juga dapat menjalankan 2 test tadi sekaligus, caranya adalah dengan pilih menu Tests--&amp;gt;Windows--&amp;gt;Test List Editor
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/testlisteditor.jpg"&gt;&lt;img class="aligncenter size-full wp-image-295" title="testListEditor" src="http://programmerdiary.files.wordpress.com/2010/06/testlisteditor.jpg" alt="" width="699" height="288" /&gt;&lt;/a&gt;&lt;/p&gt;
15. Setelah itu akan keluar windows seperti di bawah ini:Anda hanya perlu memilih test mana yang akan anda jalankan, dalam tutorial ini saya menjalankan LogOnTest() dan LogOnTest2()
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/testlisteditor2.jpg"&gt;&lt;img class="aligncenter size-full wp-image-296" title="testListEditor2" src="http://programmerdiary.files.wordpress.com/2010/06/testlisteditor2.jpg" alt="" width="678" height="284" /&gt;&lt;/a&gt;&lt;/p&gt;
16. Setelah itu anda perlu mengklik tombol Run Checked Tests pada ujung kiri

17. Dan berikut adalah hasilnya pada Test Results
&lt;p&gt;&lt;a href="http://programmerdiary.files.wordpress.com/2010/06/pass3.jpg"&gt;&lt;img class="aligncenter size-full wp-image-297" title="pass3" src="http://programmerdiary.files.wordpress.com/2010/06/pass3.jpg" alt="" width="682" height="146" /&gt;&lt;/a&gt;&lt;/p&gt;
Demikian tutorial dari saya mengenai Unit Test menggunakan Visual Studio 2010.

Selamat mencoba :)

Dan untuk testing berikutnya yaitu GUI Testing akan saya paparkan pada artikel berikutnya. GUI Testing akan menggunakan sebuah fitur baru pada Visual Studio 2010 :)
&lt;div&gt;&lt;span style="color:#0000ee;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=468" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="Visual Studio 2010" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Visual+Studio+2010/default.aspx" /><category term="Unit Testing" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Unit+Testing/default.aspx" /><category term="Tutorial" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Tutorial/default.aspx" /><category term="ASP.NET MVC 2" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/ASP.NET+MVC+2/default.aspx" /><category term="ASP.NET" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Gathering MSP Regional Jawa Timur - Tunjungan Plaza</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/19/gathering-msp-regional-jawa-timur-tunjungan-plaza.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/19/gathering-msp-regional-jawa-timur-tunjungan-plaza.aspx</id><published>2010-11-19T02:15:00Z</published><updated>2010-11-19T02:15:00Z</updated><content type="html">Hari Jumat, tanggal 18 November 2010 tepatnya, kami para MSP Regional Jawa Timur baik dari ITS, PENS, dan juga UNAIR berkumpul bersama di Tunjungan Plaza Surabaya. Pada acara kumpul bersama kali ini dihadiri juga oleh Bapak Julius yang memang sengaja datang ke Surabaya untuk mengisi acara &lt;a href="http://programmerdiary.wordpress.com/2010/11/17/road-to-imagine-cup-2011/"&gt;Road to Imagine Cup 2011&lt;/a&gt; yang diadakan di Teknik Informatika ITS. Acara kumpul kali ini juga ditujukan untuk saling sharing bersama Bapak Julius dan melakukan persiapan untuk acara &lt;a href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/18/road-to-imagine-cup-2011.aspx"&gt;Road to Imagine Cup 2011&lt;/a&gt; dan tak kalah pentingnya pada acara kumpul kali ini, kami juga menunjuk MSP Lead Regional Jawa Timur yang baru, yaitu Jeffrey yang menggantikan Vincent yang merupakan MSP Lead periode sebelumnya :). Selamat kepada Jeffrey dan terima kasih banyak kepada Bapak Julius yang telah berkenan hadir dan menjadi sponsor pada acara gathering pada kali ini hehe :). Kami juga tidak lupa foto-foto, berikut adalah fotonya :)
&lt;br /&gt;&lt;br /&gt;
&lt;a href="http://programmerdiary.files.wordpress.com/2010/11/msp-gathering-18-nov-2010.jpg"&gt;&lt;img class="aligncenter size-full wp-image-350" title="MSP Gathering 18 Nov 2010" src="http://programmerdiary.files.wordpress.com/2010/11/msp-gathering-18-nov-2010.jpg" alt="" width="300" height="200" /&gt;&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;

FYI: untuk melihat laporan dari gathering ini dapat berkunjung ke &lt;a href="http://students.netindonesia.net/blogs/jeffrey/archive/2010/11/19/msp-gathering-regional-jawa-timur-fy11-msp-kick-off.aspx"&gt; link ini &lt;/a&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=435" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="MSP" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/MSP/default.aspx" /><category term="Event" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Event/default.aspx" /><category term="Gathering" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Gathering/default.aspx" /></entry><entry><title>Road to Imagine Cup 2011 - ITS</title><link rel="alternate" type="text/html" href="http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/18/road-to-imagine-cup-2011.aspx" /><id>http://students.netindonesia.net/blogs/alexrhd/archive/2010/11/18/road-to-imagine-cup-2011.aspx</id><published>2010-11-18T04:25:00Z</published><updated>2010-11-18T04:25:00Z</updated><content type="html">Halo teman-teman terutama yang berada di ITS dan PENS, kami Microsoft Students Partner Jawa Timur bekerja sama dengan HMTC akan mengadakan sebuah acara yang kami sebut Road to Imagine Cup 2011, dimana pada acara tersebut akan diisi juga oleh Bapak Julius Fenata selaku Academic Developer Evangelist Microsoft. Pada acara ini juga akan diperkenalkan teknologi-teknologi terbaru dari Microsoft. Penasaran dengan acaranya? Ayo segera mendaftar dan bagi 100 pendaftar pertama akan diberi CD Multipoint.
&lt;br /&gt;&lt;br /&gt;

&lt;img align="center" title="Imagine Cup 2011" src="http://programmerdiary.files.wordpress.com/2010/11/imagine-cup.jpg" alt="" width="600" height="825" /&gt;

&lt;br /&gt;&lt;br /&gt;
Untuk mengetahui lebih lanjut mengenai Imagine Cup 2011 itu sendiri bisa dikunjungi di &lt;a href="http://www.imaginecup.com/" target="_blank"&gt;situs ini&lt;/a&gt;&lt;img src="http://students.netindonesia.net/aggbug.aspx?PostID=432" width="1" height="1"&gt;</content><author><name>alexrhd</name><uri>http://students.netindonesia.net/members/alexrhd.aspx</uri></author><category term="MSP" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/MSP/default.aspx" /><category term="Imagine Cup" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Imagine+Cup/default.aspx" /><category term="Event" scheme="http://students.netindonesia.net/blogs/alexrhd/archive/tags/Event/default.aspx" /></entry></feed>