Esempio n. 1
0
        /// <summary>
        /// Loads the AvalonDockLayout with a background task and makes the result
        /// available in a private <see cref="_LayoutLoaded"/> field.
        ///
        /// The result can later be queried with the <see cref="GetLayoutString"/> method
        /// which will eiter return the available result of connect to an eventhandler
        /// The will return the result via <see cref="LayoutLoadedEvent"/> as soon as it
        /// is available.
        /// </summary>
        public async Task LoadLayoutAsync()
        {
            try
            {
                var result = await LoadAvalonDockLayoutToStringAsync();

                await _LayoutSemaphore.WaitAsync();

                try
                {
                    _LayoutLoaded = result;

                    // Send an event if event subscriber is available
                    // if MainWindow is already successfull constructed and waiting for Xml Layout
                    LayoutLoadedEvent?.Invoke(this, new LayoutLoadedEventArgs(result));
                }
                finally
                {
                    _LayoutSemaphore.Release();
                }
            }
            catch (Exception exc)
            {
                _LayoutLoaded = new LayoutLoaderResult(null, false, exc);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public LayoutLoadedEventArgs(LayoutLoaderResult paramResult)
 {
     Result = paramResult;
 }