Пример #1
0
        private void DoTaskInternal()
        {
            Debug.Assert(_taskDoneEvent != null);
            Action finalAction;

            if (!IsDisposed)
            {
                object result = null;

                try {
                    result = _taskAction();
                } catch (Exception ex) {
                    Debug.Fail(String.Format(CultureInfo.CurrentCulture,
                                             "Background task exception: {0}.\nInner exception: {1}\nInner exception callstack: {2}",
                                             ex.Message,
                                             ex.InnerException != null ? ex.InnerException.Message : "(none)",
                                             ex.InnerException != null ? ex.InnerException.StackTrace : "(none)"));

                    result = ex;
                } finally {
                    finalAction = () => UIThreadCompletedCallback(result);
                }
            }
            else
            {
                finalAction = () => UIThreadCanceledCallback(null);
            }

            _taskDoneEvent.Set();

            _shell.DispatchOnUIThread(finalAction);
        }
Пример #2
0
 public DragDropPointerEffects HandleDataDropped(DragDropInfo dragDropInfo)
 {
     Task.Run(async() => {
         var folder = await _wsps.GetRUserFolder();
         _editorShell.DispatchOnUIThread(() => HandleDrop(dragDropInfo, folder));
     }).DoNotWait();
     return(DragDropPointerEffects.None);
 }