Ejemplo n.º 1
0
        /// <summary>
        /// Loader is finished
        /// </summary>
        protected virtual void LoaderFinished()
        {
            #region INLINES
            void Finished()
            {
                this.State = netLoaderState.Finished;

                try
                {
                    // never ever change order of event invokes!
                    OnLoadFinished?.Invoke(this);
                    CallbackObserver?.OnLoadFinished(this);
                }
                catch (Exception ex)
                {
                    // this is only the exception handling for the event invoke not for the loader itself!
                    Debug.WriteLine(ex);
                    // ToDo: logging interface
                }
            };
            #endregion

            if (this.State.HasFlag(netLoaderState.Canceled) || this.State.HasFlag(netLoaderState.CancelRequested))
            {
                LoaderCanceled(_cancelTokenSource.Token);
            }
            else
            {
                Finished();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loader has failed
        /// </summary>
        /// <param name="Exception"></param>
        protected virtual void LoaderFailed(Exception Exception)
        {
            this.State = netLoaderState.Failed;
            this.Data  = null;

            try
            {
                // never ever change order of event invokes!
                OnLoadFailed?.Invoke(this);
                CallbackObserver?.OnLoadFailed(this, Exception);
            }
            catch (Exception ex)
            {
                // this is only the exception handling for the event invoke not for the loader itself!
                Debug.WriteLine(ex);
                // ToDo: logging interface
            }
        }