示例#1
0
        public void TerminateApplication(SDBDeviceInfo device, string appId)
        {
            OutputResponseMsg("Try to terminate running application: " + appId);

            var appCommand = new SDBAppCmd(device, SDBProtocol.killapp, appId);

            if (!appCommand.IsTargetFound)
            {
                OutputDeviceErrorMsg("Failed to get connection.");
                return;
            }

            string msg = "Failed to terminate application";

            switch (appCommand?.ExitCode)
            {
            case 0:
                msg = "Old application has been terminated to launch updated app";
                break;

            case 1:
                msg = "Application is not running";
                break;

            case 255:
                msg = "No application to be terminated";
                break;
            }

            OutputResponseMsg(string.Format("{0}: {1}", msg, appCommand?.ExitCode));
        }
示例#2
0
        /*
         * private string TransportCheckVersion(string AppId)
         * {
         *  int length;
         *  string requestcmd = "host:version";
         *  SDBRequest request = SDBConnection.MakeRequest(requestcmd);
         *  SDBResponse response = this.sdbconnection.Send(request);
         *  if (!response.IOSuccess || !response.Okay)
         *  {
         *      OutputDeviceErrorMsg("Cannot check transport version(1): " + AppId);
         *      return String.Empty;
         *  }
         *
         *  length = this.sdbconnection.ReadLength();
         *  if (length <= 0)
         *  {
         *      OutputDeviceErrorMsg("Cannot check transport version(2): " + AppId);
         *      return String.Empty;
         *  }
         *
         *  byte[] buffer = new byte[length];
         *  return this.sdbconnection.ReadData(buffer);
         * }
         *
         * private bool TransportStart(string AppId)
         * {
         *  string requestcmd = "host:transport-any";
         *  SDBRequest request = SDBConnection.MakeRequest(requestcmd);
         *  SDBResponse response = this.sdbconnection.Send(request);
         *  if (!response.IOSuccess || !response.Okay)
         *  {
         *      OutputDeviceErrorMsg("Cannot initiate transport: " + AppId);
         *      return false;
         *  }
         *
         *  return true;
         * }
         */

        public bool LaunchApplication(SDBDeviceInfo device, string appId)
        {
            OutputResponseMsg("Try to launch application: " + appId);

            var appCommand = new SDBAppCmd(device, SDBProtocol.runapp, appId);

            if (!appCommand.IsTargetFound)
            {
                OutputDeviceErrorMsg("Failed to get connection.");
                return(false);
            }

            bool   isLaunched = (appCommand.ExitCode == SDBReqExitCode.EXIT_SUCCESS);
            string msg        = isLaunched ? "Application launched." : "Application launch failed: " + appCommand.ExitCode;

            OutputResponseMsg(msg);

            return(isLaunched);
        }
示例#3
0
        public bool IsPackageDetected(SDBDeviceInfo device, string packageName)
        {
            OutputResponseMsg("Try to find installed package: " + packageName);

            var appCommand = new SDBAppCmd(device, SDBProtocol.appinfo, packageName);

            if (!appCommand.IsTargetFound)
            {
                OutputDeviceErrorMsg("Failed to get connection.");
                return(false);
            }

            bool   isDetected = (appCommand.ExitCode == SDBReqExitCode.EXIT_SUCCESS);
            string msg        = isDetected ? "Package is already installed." : "Package is not installed.";

            OutputResponseMsg(msg);

            return(isDetected);
        }
示例#4
0
        public InstallResult InstallTizenPackage(SDBDeviceInfo device, string tpkPath,
                                                 IVsOutputWindowPane outputPane,
                                                 IVsThreadedWaitDialogFactory dlgFactory,
                                                 bool forceInstall,
                                                 out string lastErrorMessage)
        {
            this.outputPane = outputPane;
            this.outputPane?.Activate();

            if (!TargetHasTizenDotNET(device, out lastErrorMessage))
            {
                return(InstallResult.INSTALL_NOT_TRIED);
            }

            if (!NeedToInstall(device, tpkPath, forceInstall))
            {
                lastErrorMessage = string.Format("  Skip install ({0})", tpkPath);
                return(InstallResult.OK);
            }

            dlgFactory?.CreateInstance(out this.waitDialog);//waitDialog can be null and dialog can not be displayed by VS without some reasons.
            this.waitDialog?.StartWaitDialog(
                "Install Tizen Application",
                "Please wait while the new application is being installed...",
                "Preparing...",
                null,
                "Tizen application install in progress...",
                0, false, true);

            int userCancel;

            var           appUninstallCmd = new SDBAppCmd(device, SDBProtocol.uninstall, VsProjectHelper.GetInstance.GetPackageId(tpkPath));
            InstallResult result          = DoInstallTizenPackage(device, tpkPath, out lastErrorMessage);

            this.waitDialog?.EndWaitDialog(out userCancel);

            return(result);
        }