예제 #1
0
 public abstract Task LoadModule(Module module, ModuleParam[] moduleParams, bool autoUpdate);
예제 #2
0
 public abstract Task LoadModule(Module module, ModuleParam[] moduleParams);
예제 #3
0
		/// <summary>
		/// Loads the module.
		/// </summary>
		/// <param name="module">Module to be loaded.</param>
		/// <param name="moduleParams">Module parameters.</param>
		public override void LoadModule (Module module, ModuleParam[] moduleParams)
		{
			UIApplication.SharedApplication.InvokeOnMainThread (delegate { 

				try {
					if(module != null) {

						string location = this.GetModuleLocation(module, true);
						string directoryName = Path.Combine (this.GetFileSystemService().GetDirectoryRoot().FullName, location);

						/* TO BE REMOVED - 5.0.6 [AMOB-30]
						string path = Path.Combine (String.Format(DOCUMENTS_URI,IPhoneServiceLocator.CurrentDelegate.GetListeningPort()), location, DEFAULT_HOME_PAGE);
						*/
						string path = Path.Combine (DOCUMENTS_URI, location, DEFAULT_HOME_PAGE);

						if(Directory.Exists(directoryName)) {
							// pass parameters to the request URL
							if(moduleParams != null) {
								StringBuilder builder = new StringBuilder();
								int numParams = 0;
								foreach(ModuleParam p in moduleParams) {
									if(p.Name!=null && p.Name.Length>0 && p.Value!=null && p.Value.Length>0) {
										if(numParams==0) {
											builder.Append("?");
										} else {
											builder.Append("&");
										}
										builder.Append(p.Name+"="+p.Value);
										numParams++;
									}
								}
								path = path + builder.ToString();
							}

							SystemLogger.Log(SystemLogger.Module.PLATFORM, "Loading module at path: " + path);
							NSUrl nsUrl = new NSUrl(Uri.EscapeUriString(path));
							NSUrlRequest request = new NSUrlRequest (nsUrl, NSUrlRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData, 3600.0);

							IPhoneServiceLocator.CurrentDelegate.LoadRequest(request);
						} else {
							this.GetNotificationService().StartNotifyAlert(this.GetLocalizedMessage(DEFAULT_ALERT_MESSAGE_TITLE),  
							                                               this.GetLocalizedMessage(DEFAULT_ALERT_MESSAGE_LOAD_MODULE_ERROR), "OK");
						}
					} else {
								this.GetNotificationService().StartNotifyAlert(this.GetLocalizedMessage(DEFAULT_ALERT_MESSAGE_TITLE),  
						                                               this.GetLocalizedMessage(DEFAULT_ALERT_MESSAGE_LOAD_MODULE_ERROR), "OK");
					}
				} catch (Exception ex) {
					SystemLogger.Log(SystemLogger.Module.PLATFORM, "Exception when loading module: " + ex.Message);
				}
			});
		}
예제 #4
0
 public abstract void LoadModule(Module module, ModuleParam[] moduleParams);
예제 #5
0
		/// <summary>
		/// Loads the module (try to update it first if 'autUpdate' argument is set to true). Update is "silent", no event listener is called.
		/// </summary>
		/// <param name="module">Module to be loaded.</param>
		/// <param name="moduleParams">Module parameters.</param>
		/// <param name="autoUpdate">True to first update the module, prior to be loaded. False is the default value.</param>
		public override void LoadModule (Module module, ModuleParam[] moduleParams, bool autoUpdate)
		{
			if(autoUpdate) {
				// show activity indicator
				this.GetNotificationService().StartNotifyActivity();
				this.GetNotificationService().StartNotifyLoading(this.GetLocalizedMessage(DEFAULT_LOADING_MESSAGE_UPDATE_MODULE));
				
				if(module != null) {
					bool success = this.UpdateOrInstallModule(module);
					if(success) {
						SystemLogger.Log(SystemLogger.Module.PLATFORM, "[LoadModule#autoUpdate] The module [ " +  module.Id + "] was successfully updated");
					} else {
						SystemLogger.Log(SystemLogger.Module.PLATFORM, "[LoadModule#autoUpdate] The module [ " +  module.Id + "] was NOT successfully updated");
					}
				}
				
				// hide activity indicator
				this.GetNotificationService().StopNotifyActivity();
				this.GetNotificationService().StopNotifyLoading();
			}

			// Load the just updated (or not) module.
			this.LoadModule(module, moduleParams);
		}