// Get CoreCon WP7 SDK DatastoreManager dsmgrObj = new DatastoreManager(1033); Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK" ); * This source code was highlighted with Source Code Highlighter .
// Get CoreCon WP7 SDK DatastoreManager dsmgrObj = new DatastoreManager(1033); Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK" ); * This source code was highlighted with Source Code Highlighter .
// Get CoreCon WP7 SDK DatastoreManager dsmgrObj = new DatastoreManager(1033); Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK" ); * This source code was highlighted with Source Code Highlighter .
// Get CoreCon WP7 SDK DatastoreManager dsmgrObj = new DatastoreManager(1033); Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK" ); * This source code was highlighted with Source Code Highlighter .
// Get CoreCon WP7 SDK DatastoreManager dsmgrObj = new DatastoreManager(1033); Platform WP7SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "New Windows Mobile 7 SDK" ); * This source code was highlighted with Source Code Highlighter .
* This source code was highlighted with Source Code Highlighter .
- // Get Emulator / Device
- bool useEmulator = true ;
- Device WP7Device = null ;
- if (useEmulator)
- WP7Device = WP7SDK.GetDevices (). Single (d => d.Name == "Windows Phone 7 Emulator" );
- else
- WP7Device = WP7SDK.GetDevices (). Single (d => d.Name == "Windows Phone 7 Device" );
* This source code was highlighted with Source Code Highlighter .
- // Connect to WP7 Emulator / Device
- Console .WriteLine ( "Connecting to Windows Phone 7 Emulator / Device ..." );
- WP7Device.Connect ();
- Console .WriteLine ( "Windows Phone 7 Emulator / Device Connected ..." );
* This source code was highlighted with Source Code Highlighter .
- Guid appID = new Guid ( "{5e75bba1-fbf6-463c-94ac-fa4a78f8fd12}" );
- RemoteApplication app;
- if (WP7Device.IsApplicationInstalled (appID))
- {
- Console .WriteLine ( "Uninstalling sample XAP to Windows Phone 7 Emulator / Device ..." );
- app = WP7Device.GetApplication (appID);
- app.Uninstall ();
- Console .WriteLine ( "Sample XAP Uninstalled from Windows Phone 7 Emulator / Device ..." );
- }
* This source code was highlighted with Source Code Highlighter .
- // Install XAP
- Console .WriteLine ( "Installing sample XAP to Windows Phone 7 Emulator / Device ..." );
- app = WP7Device.InstallApplication (
- appID,
- appID,
- "NormalApp" ,
- @ "D: \ visual studio 2010 \ Projects \ ConsoleApplication1 \ WindowsPhoneApplication1 \ ApplicationIcon.png" ,
- @ "D: \ visual studio 2010 \ Projects \ ConsoleApplication1 \ WindowsPhoneApplication1 \ Bin \ Debug \ WindowsPhoneApplication1.xap" );
- Console .WriteLine ( "Sample XAP installed to Windows Phone 7 Emulator ..." );
* This source code was highlighted with Source Code Highlighter .
- // Launch Application
- Console .WriteLine ( "Launching sample app on Windows Phone 7 Emulator ..." );
- app.Launch ();
- Console .WriteLine ( "Launched sample app on Windows Phone 7 Emulator ..." );
* This source code was highlighted with Source Code Highlighter .
- public MainPage ()
- {
- Initializecomponent ();
- SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
- using ( var isoStore = IsolatedStorageFile.GetUserStoreForApplication ())
- using ( var sw = new StreamWriter (isoStore.OpenFile ( "Foo.txt" , FileMode .OpenOrCreate, FileAccess.Write)))
- {
- sw.Write ( "Hello WP7! (Written from WP7 IsoStore, read by Console Harness!)" );
- }
- }
* This source code was highlighted with Source Code Highlighter .
- Thread.Sleep (10,000);
- //app.GetIsolatedStore (); <- Throws NotImplementedException
- object ConManServer = WP7Device.GetType (). GetField ( "mConmanServer" , BindingFlags.NonPublic | BindingFlags.Instance) .GetValue (WP7Device);
- FileDeployer f = (FileDeployer) typeof (FileDeployer) .GetConstructors (BindingFlags. Instance | BindingFlags. NonPublic) [0] .Invoke ( new object [] {ConManServer});
* This source code was highlighted with Source Code Highlighter .
- f.ReceiveFile ( @ "\ Applications \ Data \" + appID + @ " \ data \ isolatedstore \ Foo.txt ", @ " \ Foo.txt "); Console.WriteLine ("\ t " + File.ReadAllText (@ " foo.txt"));
* This source code was highlighted with Source Code Highlighter .
- // Get CoreCon WP7 SDK
- DatastoreManager dsmgrObj = new DatastoreManager (1033);
- Platform WP7SDK = dsmgrObj.GetPlatforms (). Single (p => p.Name == "New Windows Mobile 7 SDK" );
- // Get Emulator / Device
- bool useEmulator = true ;
- Device WP7Device = null ;
- if (useEmulator)
- WP7Device = WP7SDK.GetDevices (). Single (d => d.Name == "Windows Phone 7 Emulator" );
- else
- WP7Device = WP7SDK.GetDevices (). Single (d => d.Name == "Windows Phone 7 Device" );
- // Connect to WP7 Emulator / Device
- Console .WriteLine ( "Connecting to Windows Phone 7 Emulator / Device ..." );
- WP7Device.Connect ();
- Console .WriteLine ( "Windows Phone 7 Emulator / Device Connected ..." );
- Guid appID = new Guid ( "{5e75bba1-fbf6-463c-94ac-fa4a78f8fd12}" );
- RemoteApplication app;
- if (WP7Device.IsApplicationInstalled (appID))
- {
- Console .WriteLine ( "Uninstalling sample XAP to Windows Phone 7 Emulator / Device ..." );
- app = WP7Device.GetApplication (appID);
- app.Uninstall ();
- Console .WriteLine ( "Sample XAP Uninstalled from Windows Phone 7 Emulator / Device ..." );
- }
- // Install XAP
- Console .WriteLine ( "Installing sample XAP to Windows Phone 7 Emulator / Device ..." );
- app = WP7Device.InstallApplication (
- appID,
- appID,
- "NormalApp" ,
- @ "D: \ visual studio 2010 \ Projects \ ConsoleApplication1 \ WindowsPhoneApplication1 \ ApplicationIcon.png" ,
- @ "D: \ visual studio 2010 \ Projects \ ConsoleApplication1 \ WindowsPhoneApplication1 \ Bin \ Debug \ WindowsPhoneApplication1.xap" );
- Console .WriteLine ( "Sample XAP installed to Windows Phone 7 Emulator ..." );
- // Launch Application
- Console .WriteLine ( "Launching sample app on Windows Phone 7 Emulator ..." );
- app.Launch ();
- Console .WriteLine ( "Launched sample app on Windows Phone 7 Emulator ..." );
- Console .WriteLine ( "Reading Foo.txt Isolated Storage file:" );
- Thread.Sleep (10,000);
- //app.GetIsolatedStore (); <- Throws NotImplementedException
- object ConManServer = WP7Device.GetType (). GetField ( "mConmanServer" , BindingFlags.NonPublic | BindingFlags.Instance) .GetValue (WP7Device);
- FileDeployer f = (FileDeployer) typeof (FileDeployer) .GetConstructors (BindingFlags. Instance | BindingFlags. NonPublic) [0] .Invoke ( new object [] {ConManServer});
- f.ReceiveFile ( @ "\ Applications \ Data \" + appID + @ " \ data \ isolatedstore \ Foo.txt ", @ " \ Foo.txt "); Console.WriteLine ("\ t " + File.ReadAllText (@ " foo.txt"));
- Console .ReadLine ();
Source: https://habr.com/ru/post/117294/