SIL.FieldWorks.FieldWorks.KickOffAppFromOtherProcess C# (CSharp) Méthode

KickOffAppFromOtherProcess() static private méthode

Starts or activates an application requested from another process. This method is thread safe. See the class comment on FwLinkArgs for details on how all the parts of hyperlinking work.
static private KickOffAppFromOtherProcess ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : void
args SIL.FieldWorks.Common.FwUtils.FwAppArgs The application arguments
Résultat void
		internal static void KickOffAppFromOtherProcess(FwAppArgs args)
		{
			s_threadHelper.Invoke(() =>
			{
				// Get the new application first so it can give us the application name, etc.
				FwApp app = GetOrCreateApplication(args);
				if (app == null)
					return;

				if (app.HasBeenFullyInitialized)
				{
					// The application is already running so make sure we don't try re-initialize it
					if (app.MainWindows.Count == 0)
						ApplicationBusyDialog.ShowOnSeparateThread(args,
							ApplicationBusyDialog.WaitFor.WindowToActivate, app, null);
					else
					{
						app.ActivateWindow(0);
						if (args.HasLinkInformation)
							app.HandleIncomingLink(args);
					}
					return;
				}

				if (s_appServerMode)
				{
					// Make sure the cache is initialized for the application.
					using (ProgressDialogWithTask dlg = new ProgressDialogWithTask(s_threadHelper))
						InitializeApp(app, dlg);
					return;
				}

				FwApp otherApp = (app == s_teApp) ? s_flexApp : s_teApp;
				if (otherApp == null)
				{
					// The other app was null which means the requested application was the only
					// one already started. However, that application has not been fully
					// initialized yet. Just ignore this request from the other process since a
					// window will eventually be shown by this process later.
					return;
				}

				if (s_cache.ActionHandlerAccessor.CurrentDepth > 0)
				{
					ApplicationBusyDialog.ShowOnSeparateThread(args,
						ApplicationBusyDialog.WaitFor.OtherBusyApp, app, otherApp);
				}
				else if (otherApp.IsModalDialogOpen)
				{
					ApplicationBusyDialog.ShowOnSeparateThread(args,
						ApplicationBusyDialog.WaitFor.ModalDialogsToClose, app, otherApp);
				}
				else
				{
					// Make sure the cache is initialized for the application
					using (var dlg = new ProgressDialogWithTask(otherApp.ActiveMainWindow))
						InitializeApp(app, dlg);
				}
			});
		}
FieldWorks