Beispiel #1
0
        /// <summary>
        /// Starts the application.
        /// </summary>
        /// <param name="applicationRootFilter">An extension filter that selects the application root extension to execute.</param>
        /// <param name="args">The set of arguments passed from the command line.</param>
        /// <remarks>
        /// A ClearCanvas based application is started by calling this convenience method from
        /// a bootstrap executable of some kind.  Calling this method results in the loading
        /// of all plugins and creation of an <see cref="IApplicationRoot"/> extension.
        /// This method is not thread-safe as it should only ever be invoked once per execution, by a single thread.
        /// </remarks>
        public static void StartApp(ExtensionFilter applicationRootFilter, string[] args)
        {
            FatalExceptionHandler.Initialize();

            ApplicationRootExtensionPoint xp = new ApplicationRootExtensionPoint();

            _applicationRoot = (applicationRootFilter == null) ?
                               (IApplicationRoot)xp.CreateExtension() :
                               (IApplicationRoot)xp.CreateExtension(applicationRootFilter);
            _applicationRoot.RunApplication(args);
        }
Beispiel #2
0
        /// <summary>
        /// Starts the application.
        /// </summary>
        /// <param name="applicationRootFilter">An extension filter that selects the application root extension to execute.</param>
        /// <param name="args">The set of arguments passed from the command line.</param>
        /// <remarks>
        /// A ClearCanvas based application is started by calling this convenience method from
        /// a bootstrap executable of some kind.  Calling this method results in the loading
        /// of all plugins and creation of an <see cref="IApplicationRoot"/> extension.
        /// This method is not thread-safe as it should only ever be invoked once per execution, by a single thread.
        /// </remarks>
        public static void StartApp(ExtensionFilter applicationRootFilter, string[] args)
        {
#if !DEBUG
            try
            {
#endif
            ApplicationRootExtensionPoint xp = new ApplicationRootExtensionPoint();
            _applicationRoot = (applicationRootFilter == null) ?
                               (IApplicationRoot)xp.CreateExtension() :
                               (IApplicationRoot)xp.CreateExtension(applicationRootFilter);
            _applicationRoot.RunApplication(args);

#if !DEBUG
        }
        catch (Exception e)
        {
            Platform.Log(LogLevel.Fatal, e);

            // for convenience, if this is console app, also print the message to the console
            Console.WriteLine(e.Message);
        }
#endif
        }