Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <UserControl x:Class="VulcanGUI.UtilityDialogs.Views.ErrorDialog"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
- xmlns:prism="http://prismlibrary.com/"
- prism:ViewModelLocator.AutoWireViewModel="True"
- Height="200" Width="300">
- <Grid>
- <Grid.RowDefinitions>
- <RowDefinition Height="141*"/>
- <RowDefinition Height="59*"/>
- </Grid.RowDefinitions>
- <dx:SimpleButton Grid.Row="1" Content="OK" Command="{Binding OKCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=Window}}" HorizontalAlignment="Left" Height="39" Margin="83,10,0,0" VerticalAlignment="Top" Width="137" FontWeight="Bold" FontSize="20"/>
- <TextBlock Grid.Row="0" Text="{Binding Message}" TextAlignment="Center" HorizontalAlignment="Center" Margin="66,10,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="121" Width="224" FontWeight="Bold" FontSize="18"/>
- </Grid>
- </UserControl>
- using System.Windows;
- using System.Windows.Input;
- namespace VulcanGUI.UtilityDialogs.ViewModels
- {
- public class ErrorDialogViewModel : DialogViewModelBase
- {
- public ErrorDialogViewModel()
- {
- this.okCommand = new RelayCommand(OnOkClicked);
- }
- private string _message;
- public string Message
- {
- get { return _message; }
- set
- {
- SetProperty(ref _message, value);
- }
- }
- private ICommand okCommand = null;
- public ICommand OKCommand
- {
- get
- {
- return okCommand;
- }
- set { okCommand = value; }
- }
- private void OnOkClicked(object parameter)
- {
- CloseDialogWithResult(parameter as Window, DialogResult.Yes);
- }
- }
- }
- using Prism.Mvvm;
- using System.Windows;
- namespace VulcanGUI.UtilityDialogs
- {
- public abstract class DialogViewModelBase : BindableBase
- {
- public DialogResult UserDialogResult
- {
- get;
- set;
- }
- public void CloseDialogWithResult(Window dialog, DialogResult result)
- {
- this.UserDialogResult = result;
- if (dialog != null)
- dialog.DialogResult = true;
- }
- }
- }
- private void LoadJobErrorNotification(string errMsg)
- {
- var vm = new ErrorDialogViewModel() { Message = errMsg };
- var result = DialogService.OpenDialog(vm);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement