Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > Windows Azure > Windows Azure (Mobile Services) and Windows Phone (WP8) > ตอนที่ 3 : การสร้าง Windows Phone(WP) กับ Mobile Services และการเรียกใช้งาน



Clound SSD Virtual Server

ตอนที่ 3 : การสร้าง Windows Phone(WP) กับ Mobile Services และการเรียกใช้งาน

ตอนที่ 3 : การสร้าง Windows Phone(WP) กับ Mobile Services และการเรียกใช้งาน หลังจากที่ได้เตรียมความพร้อมและติดตั้ง Windows Phone SDK กับ Visual Studio สำหรับการเขียน Windows Phone เรียบร้อยแล้ว บทความนี้จะเป็นการเริ่มต้นการสร้าง Mobile Services บน Windows Azure และการเริ่มต้นการใช้งาน Mobile Services กับ Windows Phone ง่าย ๆ ด้วยการดาวน์โหลด Sample Project มาทดสอบการทำงานบน Visual Studio ว่า Windows Phone สามารถทำการเชื่อมต่อไปยัง Mobile Services ได้หรือไม่

ก่อนจะเริ่มทำการสร้าง Mobile Services กับ Windows Phone ขอเพิ่มเติมในส่วนของภาษาที่ใช้ในการเขียน ว่า ในการเขียน Windows Phone จะใช้เทคโนโลยี่ของ .Net Framework ร่วมกับ .Net Silverlight และในปัจจุบันรองรับการเขียน 2 ภาษาก็คือ VB.Net และ C# แต่ในบทความของ Windows Azure เองจะแนะนำให้เขียนด้วยภาษา C# ซะมากกว่า เหตุผลหนึ่งภาษา C# มีโครงสร้างที่แข็งแรง และสามารถพัฒนาได้ง่ายกกว่า VB.Net

เกี่ยวกับ Windows Phone กับ Silverlight และ .NET Framework ด้วย VB.NET / C#


เริ่มต้นการสร้าง Mobile Services กับ Windows Phone

Windows Phone(WP) Mobile Services

ในหน้าจอบน Portal Management ของ Windows Azure ให้เลือก Service ของ Mobile Services เราสามารถคลิกที่ Create a new Mobile Service ได้ในทันที

Windows Phone(WP) Mobile Services

เลือก COMPUTE -> MOBILE SERVICE -> CREATE

Windows Phone(WP) Mobile Services

บริการ Mobile Services จะต้องมีการกำหนด URL ซึ่งจะอยู่ภายใต้ Subdomain ของ azure-mobile.net และเลือก Create a new SQL database instance

Windows Phone(WP) Mobile Services

กำหนดชื่อ Database รวมทั้งเลือก New SQL database server พร้อมกับกำหนด Username และ Password ในการ Login

Windows Phone(WP) Mobile Services

จากนั้นเราจะได้ Mobile Services ขึ้นมา 1 รายการ ให้คลิกเข้าไปในหน้าหลัก

Windows Phone(WP) Mobile Services

ในหน้าหลักให้เราเลือก Platform เป็นของ Windows Phone และเลือก CREATE A NEW WINDOWS PHONE APP

Windows Phone(WP) Mobile Services

ใหคลิกที่ Step 2 และ Step 3 เพื่อดาวน์โหลดไฟล์ (ส่วน Step 1 เราได้ติดตั้งในบทความตอนที่ 2 เรียบร้อยแล้ว)

Windows Phone(WP) Mobile Services

จากนั้นเราจะได้ไฟล์ Prject ของ Visual Studio ที่มี Package ของ Windows Phone SDK พร้อมที่จะนำไปใช้ได้ทันที สามารถเปิดเพื่อเรียกใช้งานบน Visual Studio

Windows Phone(WP) Mobile Services

จากนั้นให้เลือกที่ BUILD -> Build Solution

Windows Phone(WP) Mobile Services

จะเห็นว่าตอนนี้ยังมี Error อยู่

Windows Phone(WP) Mobile Services

รายการ Error ต่าง ๆ

Windows Phone(WP) Mobile Services

ให้ไปที่เมนู TOOL -> Options...

Windows Phone(WP) Mobile Services

เลือก Package Manager -> General -> Allow Neget to download missing packages during build

Windows Phone(WP) Mobile Services

เลือกที่ BUILD -> Build Solution อีกครั้ง

Windows Phone(WP) Mobile Services

ถ้า Build ผ่านจะเห็นว่าจะมีการดาวน์โหลดไฟล์และ Add ลงใน Library ต่าง ๆ

Windows Phone(WP) Mobile Services

ตอนนี้ใน References จะไม่ Error แล้ว

Windows Phone(WP) Mobile Services

กลับมายังหน้าจอบน Visual Studio ของ Project Windows Phone ในส่วนของ Mobile Services Key เราจะเก็บไว้ที่ App.xaml.cs

        public static MobileServiceClient MobileService = new MobileServiceClient(
            "https://thaicreate.azure-mobile.net/",
            "xexBNAFBIujPJbbmYJIyBdDqxZXGXM66"
            );


กรณีที่เราจะเปลี่ยนพวก Url หรือ Key ก็สามารถมาเปลี่ยนได้ที่ Url นี้

Windows Phone(WP) Mobile Services

ทดสอบการรันโปรแกรมโดยไปที่ Emulator WVGA 512MB

Windows Phone(WP) Mobile Services

แสดงหน้าจอของ Emulator ของ Windows Phone และ App ก็จะแสดงขึ้นมาทันที

Windows Phone(WP) Mobile Services

ทดสอบการเพิ่มข้อมูล

Windows Phone(WP) Mobile Services

รายการข้อมูลจะปรากฏขึ้น

Windows Phone(WP) Mobile Services

ทดสอบเพิ่มรายการอื่น ๆ

Windows Phone(WP) Mobile Services

รายการที่ถูกเพิ่ม

Windows Phone(WP) Mobile Services

เมื่อกลับไปดูที่ Mobile Services ของ Windows Azure

Windows Phone(WP) Mobile Services

รายการข้อมูลก็จะถูกเพิ่มเข้ามาในตาราง Table ที่เราได้สร้างไว้

สำหนับตัวอย่างนี้จะเป็นการดาวน์โหลด Project ที่เป็น Sample Project แต่ถ้าเราต้องการที่จะสร้าง Project ของเราเอง หรือมี Project อยู่แล้วก็สามารถที่จะทำการ Add Library ตัว Windows Phone SDK เข้ามาใน Project ของเราได้เช่นเดียวกัน สามารถหาได้จากบทความถัดไป

บทความถัดไปที่แนะนำให้อ่าน


บทความที่เกี่ยวข้อง







   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2013-05-11 21:14:53 / 2013-05-13 17:13:15
  Download : Download  ตอนที่ 3 : การสร้าง  Windows  Phone(WP) กับ Mobile Services และการเรียกใช้งาน
 Sponsored Links / Related

 
ตอนที่ 1 : Windows Phone(WP) กับ Mobile Services บน Windows Azure คืออะไร
Rating :

 
ตอนที่ 2 : เตรียม Windows Phone(WP) ก่อนที่จะเขียนบน Azure Mobile Services
Rating :

 
ตอนที่ 4 : สร้าง Project Windows Phone(WP) และการเชื่อมต่อกับ Mobile Services
Rating :

 
ตอนที่ 5 : Widows Phone สร้าง Table บน Mobile Services และการ Insert ข้อมูล
Rating :

 
ตอนที่ 6 : Windows Phone (WP) อ่าน Data จาก Table ของ Azure Mobile Service
Rating :

 
ตอนที่ 7 : อ่านข้อมูล Mobile Services การใช้ Where แสดงผลบน Windows Phone
Rating :

 
ตอนที่ 8 : การทำ Authentication in Azure Mobile Services ด้วย Windows Phone
Rating :

 
ตอนที่ 9 : การทำ Push Notifications in Mobile Services ด้วย Windows Phone
Rating :

 
ตอนที่ 10 : Validate และ Modify data in Mobile Services บน Windows Phone
Rating :

 
ตอนที่ 11 : สร้าง Refine Mobile Services queries with paging บน Windows Phone
Rating :

 
ตอนที่ 12 : Scripts to authorize users in Mobile Services บน Windows Phone
Rating :

 
ตอนที่ 13 : Show Case 1 : Register Form (WP and Mobile Services)
Rating :

 
ตอนที่ 14 : Show Case 2 : Login User Password (WP and Mobile Services)
Rating :

 
ตอนที่ 15 : Show Case 3 : Update Data (WP and Mobile Services)
Rating :

 
ตอนที่ 16 : Show Case 4 : Delete Data (WP and Mobile Services)
Rating :

 
ตอนที่ 17 : บทความอื่น ๆ เกี่ยวกับ Windows Phone กับ Azure Mobile Services
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่