Exemplo n.º 1
0
        /// <summary>
        /// Unloads every loaded resources in the given resource group. The unloading will be performed as a background task.
        /// </summary>
        /// <param name="group">The name of the resource group to unload.</param>
        /// <returns>
        /// Calling this method will return immediately with an interface to the background task. This interface can be used
        /// to subscribe the events of the task. The resource group unloader task doesn't send messages during it's execution.
        /// </returns>
        /// <remarks>
        /// This method throws an InvalidOperationException if there is another resource group loader or unloader task in progress.
        /// </remarks>
        public static IUIBackgroundTask UnloadResourceGroupAsync(string group)
        {
            if (string.IsNullOrEmpty(group))
            {
                throw new ArgumentNullException("group");
            }
            if (!resourceGroups.ContainsKey(group))
            {
                throw new UIException(string.Format("Resource group '{0}' doesn't exist!", group));
            }

            string[]          resourcesToUnload = new string[resourceGroups[group].Count];
            IUIBackgroundTask unloaderTask      = UITaskManager.StartParallelTask(UnloadResourceGroupAsync_i, "ResourceUnloadingTask", resourcesToUnload);

            return(unloaderTask);
        }
Exemplo n.º 2
0
        /// <summary>
        /// After the render loop has been started, this function is automatically called at the beginning of every
        /// frame for updating the UIObjects.
        /// </summary>
        protected void Update()
        {
            if (this.intermediateTime0 <= this.intermediateTime1)
            {
                this.intermediateTime0 = (int)this.renderLoopTimer.ElapsedMilliseconds;
            }
            else
            {
                this.intermediateTime1 = (int)this.renderLoopTimer.ElapsedMilliseconds;
            }

            if (this.FrameUpdate != null)
            {
                this.FrameUpdate();
            }
            UITaskManager.OnUpdate();
        }