コード例 #1
0
        /// <summary>
        /// Starts the web browser, pointing at a given address.
        /// </summary>
        /// /// <param name="applicationProductId"></param>
        /// <param name="applicationGenre">The genre of the application being installed</param>
        /// <param name="pathToXap">The path to the local XAP file.</param>
        /// <param name="update">If true, the application will be updated if already on the device; otherwise, the application will be uninstalled before being reinstalled</param>
        public void Start(Guid applicationProductId, string applicationGenre, string pathToXap, bool update)
        {
            this.Start();

            if (currentDevice.IsApplicationInstalled(applicationProductId))
            {
                application = currentDevice.GetApplication(applicationProductId);

                if (update)
                {
                    application.UpdateApplication(applicationGenre, "", pathToXap);
                }
                else
                {
                    application.Uninstall();
                    application = currentDevice.InstallApplication(applicationProductId, applicationProductId,
                                                                   applicationGenre, "", pathToXap);
                }
            }
            else
            {
                application = currentDevice.InstallApplication(applicationProductId, applicationProductId,
                                                               applicationGenre, "", pathToXap);
            }

            application.Launch();
        }
コード例 #2
0
        private void TryUninstallApp(AppInfo app)
        {
            MakeSureDeviceConnectionIsEstablished();
            RemoteApplication appOnDevice = nativeDevice.GetApplication(app.AppGuid);

            appOnDevice.Uninstall();
        }
コード例 #3
0
        private void Uninstall()
        {
            if (_wp7Device.IsConnected())
            {
                if (_wp7Device.IsApplicationInstalled(_appGuid))
                {
                    _logger.Debug("Uninstalling StatLight XAP to Windows Phone 7 Emulator/Device...");

                    _remoteApplication = _wp7Device.GetApplication(_appGuid);

                    if (_remoteApplication != null)
                    {
                        _remoteApplication.Uninstall();
                    }

                    _logger.Debug("StatLight XAP Uninstalled from Windows Phone 7 Emulator/Device...");
                }
            }
        }
コード例 #4
0
ファイル: TargetDevice.cs プロジェクト: garyjohnson/wpnest
        /// <summary>
        /// Starts the web browser, pointing at a given address.
        /// </summary>
        /// /// <param name="applicationProductId"></param>
        /// <param name="applicationGenre">The genre of the application being installed</param>
        /// <param name="pathToXap">The path to the local XAP file.</param>
        /// <param name="update">If true, the application will be updated if already on the device; otherwise, the application will be uninstalled before being reinstalled</param>
        public void Start(Guid applicationProductId, string applicationGenre, string pathToXap, bool update)
        {
            this.Start();

            if (currentDevice.IsApplicationInstalled(applicationProductId))
            {
                application = currentDevice.GetApplication(applicationProductId);

                if (update)
                {
                    application.UpdateApplication(applicationGenre, "", pathToXap);
                }
                else
                {
                    application.Uninstall();
                    application = currentDevice.InstallApplication(applicationProductId, applicationProductId,
                        applicationGenre, "", pathToXap);
                }
            }
            else
            {
                application = currentDevice.InstallApplication(applicationProductId, applicationProductId,
                        applicationGenre, "", pathToXap);
            }

            application.Launch();
        }
コード例 #5
0
 internal static XapDeployer.DeployResult InstallApplication(XapDeployer.DeviceInfoClass DeviceInfoClass, Guid appGuid, Version appVersion, string applicationGenre, string iconFile, string xapFile, XapDeployer.DeployBehaviourType DeployBehaviourType, ref Exception Exception)
 {
     Exception = null;
     try
     {
         DatastoreManager datastoreManager1 = new DatastoreManager(CultureInfo.CurrentUICulture.LCID);
         if (datastoreManager1 != null)
         {
             Platform platform1 = datastoreManager1.GetPlatform(new ObjectId(DeviceInfoClass.PlatformId));
             if (platform1 != null)
             {
                 Device device1 = platform1.GetDevice(new ObjectId(DeviceInfoClass.DeviceId));
                 if (device1 != null)
                 {
                     device1.Connect();
                     SystemInfo systemInfo1 = device1.GetSystemInfo();
                     Version    version1    = new Version(systemInfo1.OSMajor, systemInfo1.OSMinor);
                     bool       flag1       = appVersion.CompareTo(version1) > 0;
                     if (flag1)
                     {
                         device1.Disconnect();
                         return(XapDeployer.DeployResult.NotSupported);
                     }
                     flag1 = device1.IsApplicationInstalled(appGuid);
                     if (flag1)
                     {
                         bool flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.SkipApplication;
                         if (flag2)
                         {
                             device1.Disconnect();
                             return(XapDeployer.DeployResult.Success);
                         }
                         else
                         {
                             RemoteApplication remoteApplication1 = device1.GetApplication(appGuid);
                             flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.ForceUninstall;
                             if (flag2)
                             {
                                 remoteApplication1.Uninstall();
                             }
                             else
                             {
                                 flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.UpdateApplication;
                                 if (flag2)
                                 {
                                     remoteApplication1.UpdateApplication(applicationGenre, iconFile, xapFile);
                                     device1.Disconnect();
                                     return(XapDeployer.DeployResult.Success);
                                 }
                             }
                         }
                     }
                     device1.InstallApplication(appGuid, appGuid, applicationGenre, iconFile, xapFile);
                     device1.Disconnect();
                     return(XapDeployer.DeployResult.Success);
                 }
             }
         }
     }
     catch (Exception e)
     {
         return(XapDeployer.DeployResult.DeployError);
     }
     return(XapDeployer.DeployResult.DeployError);
 }