A struct which represents a single execution of an IWork instance.
Exemplo n.º 1
0
        /// <summary>
        ///   Loads content
        /// </summary>
        public virtual void Load()
        {
            if (LoadingInProgress)
                throw new InvalidOperationException(string.Format("{0} game state is loading!", Name));

            LoadingInProgress = true;

            _loadingTask = Application.Threads.StartBackground(LoadAsynchronously, () =>
                                                                                       {
                                                                                           if (_loadingTask.Exceptions != null && _loadingTask.Exceptions.Length != 0)
                                                                                           {
                                                                                               Exception exception = _loadingTask.Exceptions[0];
                                                                                               throw new ContentLoadingException(exception.Message, exception);
                                                                                           }

                                                                                           // We clear the content list that has been loaded
                                                                                           ContentToLoad.Clear();

                                                                                           if (LoadingCompleted != null)
                                                                                               LoadingCompleted(this, EventArgs.Empty);

                                                                                           OnLoadingCompleted();
                                                                                       });
        }