public void Run(BlockingOperationDelegate operation) { Cursor previousCursor = Cursor.Current; try { Cursor.Current = (Cursor)GuiElement; operation(); } catch { throw; } finally { Cursor.Current = previousCursor; } }
/// <summary> /// Executes the provided operation in the view, showing a wait cursor for the duration of the call. /// </summary> /// <param name="operation">The operation to execute in the view layer.</param> public static void Run(BlockingOperationDelegate operation) { Platform.CheckForNullReference(operation, "operation"); IBlockingOperationView operationView = null; try { operationView = (IBlockingOperationView)ViewFactory.CreateView(new BlockingOperationViewExtensionPoint()); } catch (Exception e) { Platform.Log(LogLevel.Error, e); } if (operationView == null) { operation(); } else { operationView.Run(operation); } }