2012-11-16 20 views
5

का उपयोग कर से कनेक्ट मैं बहुत विंडोज फोन के विकास के लिए नया हूँ। मैं एक ऐप विकसित करना चाहता हूं जिसे लॉन्च किया जाएगा जब मैं अपने विंडोज 8 फोन को अपने लैपटॉप से ​​कनेक्ट करता हूं। मैं इस ट्यूटोरियल (http://justinangel.net/WindowsPhone7EmulatorAutomation) निम्न और मेरे विंडोज 7 फोन/एमुलेटर से कनेक्ट करने में सक्षम था लेकिन मैं अपने विंडोज़ 8 फोन या एमुलेटर से कनेक्ट करने में सक्षम नहीं हूँ था। विंडोज 8 फोन से कनेक्ट करने का कोई और तरीका है?विंडोज फोन 8 सांत्वना आवेदन

कृपया मुझे पता है, अगर वहाँ इस के लिए किसी भी संभव समाधान करते हैं,

आप

उत्तर

7

मैं अभी तक इस ब्लॉग पोस्ट को अद्यतन करने का मौका नहीं मिला धन्यवाद। डेल्विस गोमेज़ (मेरा एक सहयोगी) ने अंतिम कोड नमूना अपडेट किया है और इसे स्वतंत्र रूप से वितरित करने के लिए ठीक किया है। मैं भविष्य में WP8 के लिए है कि ब्लॉग पोस्ट को अपडेट कर देंगे, लेकिन इस बीच में यहाँ कैसे WP8 एम्यूलेटर स्वचालित करने के लिए पर एक बहुत अच्छी तरह से प्रलेखित कोड स्निपेट है।

इसके अलावा, Microsoft.SmartDevice.MultiTargeting.Connectivity तरह की जरूरत नई DLLs के लिए एक संदर्भ जोड़ने के लिए सुनिश्चित करें।

Microsoft.SmartDevice.Connectivity.Interface 
Microsoft.SmartDevice.MultiTargeting.Connectivity 

यहाँ जहां मैं उन्हें मिल गया है::

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading; 
using System.IO; 
using System.Reflection; 

// Libraries needed to connect to the Windows Phone X Emulator 
using Microsoft.SmartDevice.Connectivity; 
using Microsoft.SmartDevice.Connectivity.Interface; 
using Microsoft.SmartDevice.MultiTargeting.Connectivity; 
using System.Globalization; 
using System.Collections.ObjectModel; 


namespace AutomatedUnitTestDriver 
{ 
    class Program 
    { 
     static void Main(string[] args) 
     { 
      MultiTargetingConnectivity connectivity = new MultiTargetingConnectivity(CultureInfo.CurrentUICulture.LCID); 

      // Get a connectable device for a specific Device ID (from the CoreCon datastore) 
      string deviceId = "5E7661DF-D928-40ff-B747-A4B1957194F9"; 
      ConnectableDevice connectableDevice = connectivity.GetConnectableDevice(deviceId); 
      Console.WriteLine("Found Connectable Device \'" + connectableDevice.Name + "\' for Device id {" + connectableDevice.Id + "}."); 

      // Connect to the Device 
      Console.WriteLine("Connecting to Device..."); 
      IDevice iDevice = connectableDevice.Connect(); 
      Console.WriteLine("Done!"); 

      // Check if the application is already install, if it is remove it (From WMAppManifect.xml) 
      Guid appID = new Guid("{b6635769-b7ac-41a5-915d-5a7b0ae34481}"); 

      if (iDevice.IsApplicationInstalled(appID)) 
      { 
       Console.WriteLine("Uninstalling application..."); 
       iDevice.GetApplication(appID).Uninstall(); 
       Console.WriteLine("Done!"); 
      } 

      Guid productId = appID; 
      Guid instanceId = appID; 
      string applicationGenre = "NormalApp"; 
      string iconPath = @"C:\Share\LatestAPI\TestCode\Automated\AutomatedUnitTests\Bin\Debug\ApplicationIcon.png"; 
      string xapPackage = @"C:\Share\LatestAPI\TestCode\Automated\AutomatedUnitTests\Bin\Debug\AutomatedUnitTests.xap"; 

      // Install the application 
      Console.WriteLine("Installing the application..."); 
      IRemoteApplication remoteApplication = iDevice.InstallApplication(appID, appID, applicationGenre, iconPath, xapPackage); 
      Console.WriteLine("Done!"); 

      // Launch the application 
      Console.WriteLine("Starting the application..."); 
      remoteApplication.Launch(); 

      int startStopWaitTime = 1000; // msec 
      int executionWaitTime = 180000; // msec 

      // Note that IRemoteApplication has a 'IsRunning' method but it is not implemented. 
      // So, for the moment we sleep few msec. 
      Thread.Sleep(startStopWaitTime); 
      Console.WriteLine("Done!"); 

      // Allow application to complete 
      Console.WriteLine("Application is running! Waiting few seconds..."); 
      Thread.Sleep(executionWaitTime); 

      try 
      { 
       IRemoteIsolatedStorageFile remoteIsolatedStorageFile = remoteApplication.GetIsolatedStore(); 
       string sourceDeviceFilePath = (object)Path.DirectorySeparatorChar + "TestResults.trx"; 
       string targetDesktopFilePath = @"C:\Share\LatestAPI\TestCode\Automated\AutomatedUnitTests\Bin\Debug\" + "TestResults.trx"; 
       remoteIsolatedStorageFile.ReceiveFile(sourceDeviceFilePath, targetDesktopFilePath,true); 
      } 
      catch (Exception exception) 
      { 
       Console.WriteLine("Exception \'" + exception.Message + "\' reading file from device."); 
      } 

      // Terminate application 
      Console.WriteLine("Terminating the application..."); 
      remoteApplication.TerminateRunningInstances(); 

      Thread.Sleep(startStopWaitTime); 
      Console.WriteLine("\nDone!"); 

      // Disconnect from the emulator 
      Console.WriteLine("Disconnecting Device..."); 
      iDevice.Disconnect(); 
      Console.WriteLine("\nDone!"); 
     } 
    } 
} 
+0

आप जबाब और समाधान के लिए बहुत बहुत धन्यवाद। मैं विंडोज फोन विकास के लिए बहुत नया हूं और यह मेरे लिए एक बड़ी मदद है। धन्यवाद! – user1720839

+0

मुझे डीएलएल कहां मिल सकता है। मैं Microsoft.Smartdevice.Connectivity.dll पाया (मैं WP7 के लिए यह प्रयोग किया जाता है), लेकिन मैं न एक Microsoft.SmartDevice.MultiTargeting.Connectivity है। कोई विचार? –

+0

यह विंडोज 8 मशीन पर विंडोज फोन 8 पर काम करता है। लेकिन विंडोज 7 के लिए यह काम नहीं कर रहा है। –

0

मैं मुसीबत को स्वीकार कर लिया समाधान क्योंकि मैं इन नामस्थान के लिए संदर्भ याद आ रही थी को लागू करने के लिए किया था

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\ 
    Microsoft.SmartDevice.Connectivity.Interface\ 
    v4.0_11.0.0.0__b03f5f7f11d50a3a\ 
    Microsoft.Smartdevice.Connectivity.Interface.dll 

और

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\ 
    Microsoft.SmartDevice.MultiTargeting.Connectivity\ 
    v4.0_11.0.0.0__b03f5f7f11d50a3a\ 
    Microsoft.Smartdevice.MultiTargeting.Connectivity.dll 

ध्यान दें कि इन पथों, विशेष रूप से v4.0_11.0.0.0__b03f5f7f11d50a3a भाग, आपके सिस्टम पर भिन्न हो सकते हैं। अपनी परियोजना में इन डीएलएल के संदर्भ जोड़ें, और सब कुछ ठीक से काम करना चाहिए।