/// <summary> /// Raises <see cref="ICommand.CanExecuteChanged"/> so every command invoker can requery /// <see cref="ICommand.CanExecute"/> to check if the <see cref="DelegateCommand{T}"/> can /// execute. /// </summary> protected virtual void OnCanExecuteChanged() { CanExecuteChanged?.Invoke(this, EventArgs.Empty); #else if (_canExecuteChangedEvent != null && _canExecuteChangedEvent.Count > 0) { WindowsHelper.CheckBeginInvokeOnUI(() => { _canExecuteChangedEvent.Invoke(this, EventArgs.Empty); }); } }
/// <summary> /// Called when an exception that is raised by Silverlight is not handled. /// </summary> /// <param name="sender">The sender.</param> /// <param name="eventArgs"> /// The <see cref="ApplicationUnhandledExceptionEventArgs"/> instance containing the event /// data. /// </param> protected virtual void OnUnhandledException(object sender, ApplicationUnhandledExceptionEventArgs eventArgs) { // If the app is running outside of the debugger then report the exception using // the browser's exception mechanism. On IE this will display it a yellow alert // icon in the status bar and Firefox will display a script error. if (!Debugger.IsAttached) { // This will allow the application to continue running after an exception has // been thrown but not handled. // For production applications this error handling should be replaced with something // that will report the error to the website and stop the application. eventArgs.Handled = true; WindowsHelper.CheckBeginInvokeOnUI(() => ReportErrorToDOM(eventArgs)); } }
/// <summary> /// Writes the specified text and the message in the <see cref="BuildEventArgs"/> to the /// output window. /// </summary> private void WriteLine(string text, BuildEventArgs eventArgs) { // Copy field into local variable because the closure below should use the // current indentation value. int indent = _indent; WindowsHelper.CheckBeginInvokeOnUI(() => { Debug.Assert(_stringBuilder.Length == 0, "StringBuilder should have been cleared."); for (int i = 0; i < indent; i++) { _stringBuilder.Append(Indentation); } _stringBuilder.Append(text); _stringBuilder.Append(eventArgs.Message); _outputService.WriteLine(_stringBuilder.ToString()); _stringBuilder.Clear(); }); }
/// <inheritdoc/> public void Show(string view = null) { WindowsHelper.CheckBeginInvokeOnUI(() => ShowUnchecked(view)); }
/// <inheritdoc/> public void WriteLine(string message, string view = null) { WindowsHelper.CheckBeginInvokeOnUI(() => WriteLineUnchecked(message, view), DispatcherPriority.Send); }
/// <inheritdoc/> public void Clear(string view = null) { WindowsHelper.CheckBeginInvokeOnUI(() => ClearUnchecked(view), DispatcherPriority.Send); }