Пример #1
0
        /// <summary>
        /// Initializes the (Mechanical4) app.
        /// </summary>
        /// <param name="eventQueue">The <see cref="EventQueueBase"/> to wrap.</param>
        protected static new void Initialize(EventQueueBase eventQueue)
        {
            AppBase.Initialize(eventQueue);

            InitializeUnhandledExceptionCatching();
            InitializeSystemEvents();
        }
Пример #2
0
        /// <summary>
        /// Initializes the (Mechanical4) app.
        /// </summary>
        /// <param name="eventQueue">The <see cref="EventQueueBase"/> to wrap.</param>
        protected static void Initialize(EventQueueBase eventQueue)
        {
            var wrapper = new MainEventQueue(eventQueue); // tests the argument implicitly

            isInitialized.SetIfEquals(newValue: true, comparand: false, out bool oldValue);
            if (oldValue)
            {
                throw new InvalidOperationException("The (Mechanical4) app may only be initialized once!");
            }

            mainEventQueue = wrapper;
            InitializeUnhandledExceptionCatching();
        }
Пример #3
0
        internal MainEventQueue(EventQueueBase eventQueue)
        {
            if (eventQueue.NullReference())
            {
                throw Exc.Null(nameof(eventQueue));
            }

            if (eventQueue.IsShutDown)
            {
                throw new ArgumentException("Event queue specified may not be shut down!");
            }

            this.regularEventQueue = eventQueue;
            this.regularEventQueue.Subscribers.Add <ShuttingDownEvent>(this, weakRef: false);
            this.currentAppState = new ThreadSafeEnum <AppState>(AppState.Shutdown);
        }
Пример #4
0
 /// <summary>
 /// Initializes the (Mechanical4) app.
 /// </summary>
 /// <param name="eventQueue">The <see cref="EventQueueBase"/> to wrap, or <c>null</c> for a new <see cref="TaskEventQueue"/>.</param>
 public static new void Initialize(EventQueueBase eventQueue = null)
 {
     WindowsAppBase.Initialize(eventQueue ?? new TaskEventQueue());
 }
Пример #5
0
 internal static new void Initialize(EventQueueBase eventQueue)
 {
     AppBase.Initialize(eventQueue);
 }