コード例 #1
0
ファイル: LayoutLoader.cs プロジェクト: TarekJor/Wolven-kit
        /// <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 this._LayoutSemaphore.WaitAsync();

                try
                {
                    this._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
                {
                    this._LayoutSemaphore.Release();
                }
            }
            catch (Exception exc)
            {
                this._LayoutLoaded = new LayoutLoaderResult(null, false, exc);
            }
        }
コード例 #2
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public LayoutLoadedEventArgs(LayoutLoaderResult paramResult)
 {
     Result = paramResult;
 }