Esempio n. 1
0
        /// <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);
                });
            }

        }
Esempio n. 2
0
 /// <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));
     }
 }
Esempio n. 3
0
        /// <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();
            });
        }
Esempio n. 4
0
 /// <inheritdoc/>
 public void Show(string view = null)
 {
     WindowsHelper.CheckBeginInvokeOnUI(() => ShowUnchecked(view));
 }
Esempio n. 5
0
 /// <inheritdoc/>
 public void WriteLine(string message, string view = null)
 {
     WindowsHelper.CheckBeginInvokeOnUI(() => WriteLineUnchecked(message, view), DispatcherPriority.Send);
 }
Esempio n. 6
0
 /// <inheritdoc/>
 public void Clear(string view = null)
 {
     WindowsHelper.CheckBeginInvokeOnUI(() => ClearUnchecked(view), DispatcherPriority.Send);
 }