private bool CanExecuteDialogCommand(ShellDialogButton arg) { bool baseResult = Content != null; if (!baseResult) { return(false); } var dialogInteractivity = Content as IShellDialogInteractivity; if (dialogInteractivity == null) { return(true); } switch (arg) { case ShellDialogButton.Cancel: return(dialogInteractivity.CanExecuteCancelButton); case ShellDialogButton.Ok: return(dialogInteractivity.CanExecuteOkButton); case ShellDialogButton.Save: return(dialogInteractivity.CanExecuteSaveButton); } return(true); }
private void OnDialogCommandExecute(ShellDialogButton commandType) { // Delay execution so that keyed events happen Dispatcher.BeginInvoke( DispatcherPriority.ApplicationIdle, () => { // No correlation id given so no response is expected. if (CorrelationId != Guid.Empty) { switch (commandType) { case ShellDialogButton.Ok: case ShellDialogButton.Save: if (!OkButtonVisible && commandType == ShellDialogButton.Ok) { commandType = ShellDialogButton.Save; } // Ok will be the default response if Enter is pressed, even when the Ok button is invisble. MessengerInstance.Send(new ShellDialogResponseMessage(Content, commandType) { CorrelationId = CorrelationId }); break; case ShellDialogButton.Cancel: MessengerInstance.Send(new ShellDialogResponseMessage(Content, ShellDialogButton.Cancel) { CorrelationId = CorrelationId }); break; case ShellDialogButton.Help: MessengerInstance.Send(new ShellDialogResponseMessage(Content, ShellDialogButton.Help) { CorrelationId = CorrelationId }); // Don't close the dialog after this button click is processed. return; default: throw new NotSupportedException("Unsupported command type received from Shell Dialog on Shell view. " + commandType); } } // Setting the content to null will hide the dialog, its visibility is bound to the Content != null Content = null; }); }
private void OnDialogCommandExecute(ShellDialogButton commandType) { // Delay execution so that keyed events happen Dispatcher.BeginInvoke( DispatcherPriority.ApplicationIdle, () => { // No correlation id given so no response is expected. if (CorrelationId != Guid.Empty) { switch (commandType) { case ShellDialogButton.Ok: case ShellDialogButton.Save: if (!OkButtonVisible && commandType == ShellDialogButton.Ok) commandType = ShellDialogButton.Save; // Ok will be the default response if Enter is pressed, even when the Ok button is invisble. MessengerInstance.Send(new ShellDialogResponseMessage(Content, commandType) { CorrelationId = CorrelationId }); break; case ShellDialogButton.Cancel: MessengerInstance.Send(new ShellDialogResponseMessage(Content, ShellDialogButton.Cancel) { CorrelationId = CorrelationId }); break; case ShellDialogButton.Help: MessengerInstance.Send(new ShellDialogResponseMessage(Content, ShellDialogButton.Help) { CorrelationId = CorrelationId }); // Don't close the dialog after this button click is processed. return; default: throw new NotSupportedException("Unsupported command type received from Shell Dialog on Shell view. " + commandType); } } // Setting the content to null will hide the dialog, its visibility is bound to the Content != null Content = null; }); }
private bool CanExecuteDialogCommand(ShellDialogButton arg) { bool baseResult = Content != null; if (!baseResult) { return false; } var dialogInteractivity = Content as IShellDialogInteractivity; if (dialogInteractivity == null) { return true; } switch (arg) { case ShellDialogButton.Cancel: return dialogInteractivity.CanExecuteCancelButton; case ShellDialogButton.Ok: return dialogInteractivity.CanExecuteOkButton; case ShellDialogButton.Save: return dialogInteractivity.CanExecuteSaveButton; } return true; }
public ShellDialogResponseMessage(object content, ShellDialogButton response) { Content = content; Response = response; }
public ShellDialogResponseMessage(object content, ShellDialogButton response) { Content = content; Response = response; }
private void OnDialogCommandExecute(ShellDialogButton commandType) { // Delay execution so that keyed events happen Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, () => { // No correlation id given so no response is expected. if (CorrelationId != Guid.Empty) { switch (commandType) { case ShellDialogButton.Ok: case ShellDialogButton.Save: MessengerInstance.Send(new ShellDialogResponseMessage(Content, commandType) { CorrelationId = CorrelationId }); break; case ShellDialogButton.Cancel: MessengerInstance.Send(new ShellDialogResponseMessage(Content, ShellDialogButton.Cancel) { CorrelationId = CorrelationId }); break; default: throw new NotSupportedException("Unsupported command type received from Shell Dialog on Shell view. " + commandType); } } // Setting the content to null will hide the dialog, its visibility is bound to the Content != null Content = null; }); }