/// <summary> /// Uninstalls application. /// </summary> public void Uninstall() { if (_context != null) { InstallThreadParam param = new InstallThreadParam(); param.fileName = _fileName; param.productId = _productId; param.operation = XapInstallOperationType.Uninstall; var thread = new Thread(InstallThread); thread.Start(param); } }
private bool Install(InstallThreadParam param) { if (_context.IsValidContext() == true) { bool result = false; bool debugMode = true; if (license) { debugMode = false; } if (param.operation == XapInstallOperationType.Install) { result = _context.Install(debugMode); } else if (param.operation == XapInstallOperationType.Update) { result = _context.Update(debugMode); } else { result = _context.Uninstall(); } if (result && param.report) { while (true) { ApplicationEvent evt = _context.WaitForEvent(); if (StateChanged != null) { XapInstallEventArgs e = new XapInstallEventArgs(); e.application = _context; e.fileName = param.fileName; e.progress = evt.progress; e.state = evt.state; e.error = evt.error; Deployment.Current.Dispatcher.BeginInvoke(delegate() { StateChanged(this, e); }); } if ((evt.state == InstallationState.AppInstallCompleted && param.operation == XapInstallOperationType.Install) || (evt.state == InstallationState.AppUpdateCompleted && param.operation == XapInstallOperationType.Update) || (evt.state == InstallationState.AppRemoveCompleted && param.operation == XapInstallOperationType.Uninstall)) { break; } } } return(result); } return(false); }
/// <summary> /// Add to ringtone list /// </summary> /// <returns>true on success, false on failure</returns> public bool AddToRingtoneList(int start, int end) { try { var itp = new InstallThreadParam(); itp.onlyAdd = true; itp.start = start; itp.end = end; var thread = new Thread(InstallThread); thread.Start(itp); return(true); } catch (Exception ex) { } return(false); }
/// <summary> /// Updates current XAP with application data saving. /// </summary> public void Update(bool report = true, bool async = true) { if (_context != null) { InstallThreadParam param = new InstallThreadParam(); param.fileName = _fileName; param.productId = _productId; param.operation = XapInstallOperationType.Update; param.report = report; if (async) { var thread = new Thread(InstallThread); thread.Start(param); } else { InstallThread(param); } } }
/// <summary> /// Installs current XAP. /// </summary> public bool Install(bool report = true, bool async = true) { if (_context != null) { InstallThreadParam param = new InstallThreadParam(); param.fileName = _fileName; param.productId = _productId; param.operation = XapInstallOperationType.Install; param.report = report; if (async) { var thread = new Thread(InstallThread); thread.Start(param); return(true); } else { return(Install(param)); } } return(false); }
private bool Install(InstallThreadParam param) { if (_context.IsValidContext() == true) { bool result = false; bool debugMode = true; if (license) debugMode = false; if (param.operation == XapInstallOperationType.Install) result = _context.Install(debugMode); else if (param.operation == XapInstallOperationType.Update) result = _context.Update(debugMode); else result = _context.Uninstall(); if (result && param.report) { while (true) { ApplicationEvent evt = _context.WaitForEvent(); if (StateChanged != null) { XapInstallEventArgs e = new XapInstallEventArgs(); e.application = _context; e.fileName = param.fileName; e.progress = evt.progress; e.state = evt.state; e.error = evt.error; Deployment.Current.Dispatcher.BeginInvoke(delegate() { StateChanged(this, e); }); } if ((evt.state == InstallationState.AppInstallCompleted && param.operation == XapInstallOperationType.Install) || (evt.state == InstallationState.AppUpdateCompleted && param.operation == XapInstallOperationType.Update) || (evt.state == InstallationState.AppRemoveCompleted && param.operation == XapInstallOperationType.Uninstall)) { break; } } } return result; } return false; }
/// <summary> /// Uninstalls application. /// </summary> public void Uninstall(bool report = true) { if (_context != null) { InstallThreadParam param = new InstallThreadParam(); param.fileName = _fileName; param.productId = _productId; param.operation = XapInstallOperationType.Uninstall; param.report = report; var thread = new Thread(InstallThread); thread.Start(param); } }
/// <summary> /// Installs current XAP. /// </summary> public bool Install(bool report = true, bool async = true) { if (_context != null) { InstallThreadParam param = new InstallThreadParam(); param.fileName = _fileName; param.productId = _productId; param.operation = XapInstallOperationType.Install; param.report = report; if (async) { var thread = new Thread(InstallThread); thread.Start(param); return true; } else { return Install(param); } } return false; }