예제 #1
0
        private void LoadingWork(RawTile tileKey, AsyncOperation asyncOp)
        {
            MemoryStream ms       = null;
            Exception    ex       = null;
            object       taskID   = tileKey as object;
            bool         canceled = true;

            if (!TaskCanceled(taskID))
            {
                try
                {
                    ms = loadProxy.GetTile(tileKey);
                }
                catch (Exception exception)
                {
                    ex = exception;
                }
                canceled = TaskCanceled(taskID);
                lock (userStateToLifetime.SyncRoot)
                    userStateToLifetime.Remove(asyncOp.UserSuppliedState);
            }
            TileLoadCompletedEventArgs e = new TileLoadCompletedEventArgs(tileKey, ms, ex, canceled, taskID);

            if (--loadingTaskNum == 0)
            {
                //OnMapLoadCompleted(new MapLoadCompletedEventArgs());
                IsLoading = false;
            }
            asyncOp.PostOperationCompleted(new SendOrPostCallback(OnTileLoadCompleted), e);
        }
예제 #2
0
        private void OnTileLoadCompleted(object state)
        {
            TileLoadCompletedEventArgs e = state as TileLoadCompletedEventArgs;

            if (tileLoadCompleted != null)
            {
                tileLoadCompleted(this, e);
            }
        }