public WindowMessageResult SendMessage(DialogData dialogData) { if (dialogData != null) { return(OnSendMessage(new MessageEventArgs() { MessageData = dialogData, })); } return(WindowMessageResult.Undefined); }
public void Transmit(DialogData data) { if (OnDataTransmittedEvent == null) { return; } Dispatcher dispatcher = null; try { if (DispatcherWindow != null) { dispatcher = DispatcherWindow.Dispatcher; } else { dispatcher = Application.Current.Dispatcher; } if (dispatcher == null) { OnDataTransmittedEvent(data); return; } if (dispatcher.CheckAccess()) { DispatcherWindow.Dispatcher.Invoke((Action) delegate { OnDataTransmittedEvent(data); }); } else { OnDataTransmittedEvent(data); } } finally { } }
// ViewModel Only Vars // --------------------------------------------------------------------------------------------------------------------------------------------- // TODO (DB) : Reserved for future possible changes. // --------------------------------------------------------------------------------------------------------------------------------------------- // Constructor // --------------------------------------------------------------------------------------------------------------------------------------------- public WindowsMessageViewModel(DialogData dialogData) : base(dialogData) { MessageIcon = getIcon(dialogData.MessageIcon); ContentHeader = dialogData.ContentHeader; if (dialogData.ContentBody.Length > 0) { ContentBodyVisibility = Visibility.Visible; ContentBody = dialogData.ContentBody; } if (dialogData.HyperLinkUri.Length > 0) { HyperLinkIsEnabled = true; HyperLinkVisibility = Visibility.Visible; HyperLinkUri = dialogData.HyperLinkUri; if (dialogData.HyperLinkText.Length > 0) { HyperLinkText = dialogData.HyperLinkText; } else { HyperLinkText = dialogData.HyperLinkUri; } } // Currently nothing is loading/rendering so will save this for potential future additions. // Subscribes to the Loaded/Rendered Event of the DialogBaseWindow. // OnContentLoaded += windowContentLoaded; // OnContentRendered += windowContentRendered; switch (dialogData.MessageButtons) { case WindowMessageButtons.Default: break; case WindowMessageButtons.Ok: CenterContent = "Ok"; CenterIsEnabled = true; CenterVisibility = Visibility.Visible; CenterButton = new RelayCommand(okCommand); break; case WindowMessageButtons.OkCancel: LeftContent = "Ok"; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(okCommand); RightContent = "Cancel"; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(cancelCommand); break; case WindowMessageButtons.YesNo: LeftContent = "Yes"; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(yesCommand); RightContent = "No"; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(noCommand); break; case WindowMessageButtons.YesNoCancel: LeftContent = "Yes"; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(yesCommand); CenterContent = "No"; CenterIsEnabled = true; CenterVisibility = Visibility.Visible; CenterButton = new RelayCommand(noCommand); RightContent = "Cancel"; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(cancelCommand); break; case WindowMessageButtons.Exit: CenterContent = "Exit"; CenterIsEnabled = true; CenterVisibility = Visibility.Visible; CenterButton = new RelayCommand(exitCommand); break; case WindowMessageButtons.ContinueCancel: LeftContent = "Continue"; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(continueCommand); RightContent = "Cancel"; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(cancelCommand); break; case WindowMessageButtons.AcceptDecline: LeftContent = "Accept"; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(acceptCommand); RightContent = "Decline"; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(declineCommand); break; case WindowMessageButtons.Misc: if (string.IsNullOrEmpty(dialogData.MiscButtoms.Misc1) == false) { LeftContent = dialogData.MiscButtoms.Misc1; LeftIsEnabled = true; LeftVisibility = Visibility.Visible; LeftButton = new RelayCommand(misc1Command); } else { if (dialogData.MessageButtonFocus == WindowButtonFocus.Left) { dialogData.MessageButtonFocus = WindowButtonFocus.Center; } } if (string.IsNullOrEmpty(dialogData.MiscButtoms.Misc2) == false) { CenterContent = dialogData.MiscButtoms.Misc2; CenterIsEnabled = true; CenterVisibility = Visibility.Visible; CenterButton = new RelayCommand(custom2Command); } else { if (dialogData.MessageButtonFocus == WindowButtonFocus.Center) { dialogData.MessageButtonFocus = WindowButtonFocus.Right; } } if (string.IsNullOrEmpty(dialogData.MiscButtoms.Misc3) == false) { RightContent = dialogData.MiscButtoms.Misc3; RightIsEnabled = true; RightVisibility = Visibility.Visible; RightButton = new RelayCommand(custom3Command); } else { if (dialogData.MessageButtonFocus == WindowButtonFocus.Right) { dialogData.MessageButtonFocus = WindowButtonFocus.Left; } } break; } }
public DialogViewModel(DialogData dialogData) : base() { Data = dialogData; }
} = new WindowMessageColorSet(); // Plans for the future. // Takes the arguments from the overload methods to create a DialogData object. This is what is passed to the DialogService and used to open the MessageBox Enhanced window. private static DialogData dialogDataBuilder( string windowTitle = "", string contentHeader = "", string contentBody = "", string hyperLinkText = "", string hyperLinkUri = "", WindowMessageButtons windowMessageButtons = WindowMessageButtons.Ok, WindowMessageIcon windowMessageIcon = WindowMessageIcon.Information, WindowMessageColorSet windowMessageColorSet = null) { DialogData data = new DialogData() { WindowTitle = windowTitle, ContentBody = contentBody, ContentHeader = contentHeader, HyperLinkText = hyperLinkText, HyperLinkUri = hyperLinkUri, MessageButtons = windowMessageButtons, MessageIcon = windowMessageIcon, }; if (windowMessageColorSet == null) { data.Background = ColorSets.Background; data.ContentHeaderColor = ColorSets.ContentHeaderColor; data.ContentBodyColor = ColorSets.ContentBodyColor; data.HyperLinkColor = ColorSets.HyperLinkColor; data.HyperLinkMouseOverColor = ColorSets.HyperLinkMouseOverColor; data.HyperLinkMouseDisabledColor = ColorSets.HyperLinkMouseDisabledColor; } else { if (windowMessageColorSet.Background == null) { data.Background = ColorSets.Background; } if (windowMessageColorSet.ContentHeaderColor == null) { data.ContentHeaderColor = ColorSets.ContentHeaderColor; } if (windowMessageColorSet.ContentBodyColor == null) { data.ContentBodyColor = ColorSets.ContentBodyColor; } if (windowMessageColorSet.HyperLinkColor == null) { data.HyperLinkColor = ColorSets.HyperLinkColor; } if (windowMessageColorSet.HyperLinkMouseOverColor == null) { data.HyperLinkMouseOverColor = ColorSets.HyperLinkMouseOverColor; } if (windowMessageColorSet.HyperLinkMouseDisabledColor == null) { data.HyperLinkMouseDisabledColor = ColorSets.HyperLinkMouseDisabledColor; } } return(data); }
// Opens Window Message based on DialogData and sets the owner of that window to the passed in paramater. public static WindowMessageResult OpenWindowMessage(DialogData data, ViewModelBase viewModelBase, ShutdownMode shutdownMode) { return(DialogService.OpenDialog(generateDialogViews(data), FactoryService.GetWindowReference(viewModelBase), shutdownMode)); }
// Opens Window Message based on DialogData and no other parameters. public static WindowMessageResult OpenWindowMessage(DialogData data) { return(DialogService.OpenDialog(generateDialogViews(data))); }
// Opens Window Message based on DialogData and sets the shutdownmode. public static WindowMessageResult OpenWindowMessage(DialogData data, ShutdownMode shutdownMode) { return(DialogService.OpenDialog(generateDialogViews(data), shutdownMode)); }