public DialogManager( ContentControl parent, Dispatcher dispatcher) { _dispatcher = dispatcher; _dialogHost = new DialogLayeringHelper(parent); }
public static DialogManager Init(IDialogHost dialogHost, IDialogCoordinator dialogCoordinator, bool initDefaultInteractionsHandlers) { MainDialogManager = new DialogManager(dialogHost, dialogCoordinator); if (initDefaultInteractionsHandlers) { Interactions.SimpleMessage.RegisterHandler(async interaction => { var result = await MainDialogManager.ShowMessageAsync(interaction.Input.Title, interaction.Input.Message); if (result == MessageDialogResult.Affirmative) { interaction.SetOutput(InteractionResult.OK); } else { interaction.SetOutput(InteractionResult.Cancel); } }); Interactions.CriticalError.RegisterHandler(async interaction => { await MainDialogManager.RaiseCriticalErrorAsync(interaction.Input.Message); interaction.SetOutput(InteractionResult.OK); }); //Interactions.SimpleMessage.Subscribe(async input => await MainDialogManager.ShowMessageAsync(input.Title, input.Message)); //Interactions.LongTimeOperationStarter.Subscribe(async input => await MainDialogManager.ShowDefaultProgressAsync(input.Title, input.Message)); //Interactions.LongTimeOperationFinisher.Subscribe(async _ => await MainDialogManager.HideDefaultProgressAsync()); //Interactions.CriticalError.Subscribe(async input => await MainDialogManager.RaiseCriticalErrorAsync(input.Message)); Interactions.Confirmation.RegisterHandler(async interaction => { var result = await MainDialogManager.ShowConfirmationAsync( interaction.Input.Title, interaction.Input.Message, interaction.Input.YesString, interaction.Input.NoString); if (result) { interaction.SetOutput(InteractionResult.Yes); } else { interaction.SetOutput(InteractionResult.No); } }); Interactions.LongTimeOperationStarter.RegisterHandler(async interaction => { await MainDialogManager.ShowDefaultProgressAsync(interaction.Input.Title, interaction.Input.Message); interaction.SetOutput(InteractionResult.OK); }); Interactions.LongTimeOperationFinisher.RegisterHandler(async interaction => { await MainDialogManager.HideDefaultProgressAsync(); interaction.SetOutput(InteractionResult.OK); }); } return(MainDialogManager); }
protected DialogDataEditViewModel(IDialogHost dialogHost, ILoadingPresenter loadingPresenter, IDataRepository dataRepository) : base(dialogHost) { Apply = new RelayCommand(ExecuteApply, CanApply); Cancel = new RelayCommand(ExecuteCancel); DataRepository = dataRepository; LoadingPresenter = loadingPresenter; }
public static IProgressDialog CreateProgressDialog(IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher) { IProgressDialog dialog = null; dispatcher.Invoke(new Action(() => dialog = new WaitProgressDialog(dialogHost, dialogMode, false, dispatcher)), DispatcherPriority.DataBind); return(dialog); }
public ClientsPageViewModel(IClientsService clientsService, IResidencesService residencesService, ISnackbarMessageQueue snackbarMessageQueue, IDialogHost dialogHost, Hotel hotel) { _clientsService = clientsService; _residencesService = residencesService; _snackbarMessageQueue = snackbarMessageQueue; _hotel = hotel; _dialogHost = dialogHost; Clients = new ObservableCollection <Client>(_clientsService.Get()); ClientsViews = (CollectionView)CollectionViewSource.GetDefaultView(Clients); ClientsViews.Filter = ClientsFilter; FilteredFields = new Dictionary <string, string>(Client.Fields) { { AnyFieldFilterValue, "Любое поле" } }; SelectedFilterField = AnyFieldFilterValue; IsContainsFilter = true; SortedFields = new Dictionary <string, string>(Client.Fields) { { NoSortingSortValue, "Не сортировать" } }; SelectedSortField = NoSortingSortValue; IsAscendingSort = true; }
public DialogOrderEditViewModel(IDialogHost dialogHost, ILoadingPresenter loadingPresenter, IDataRepository dataRepository) : base(dialogHost, loadingPresenter, dataRepository) { AddProduct = new RelayCommand <IProduct>(ExecuteAddProduct, CanAddProduct); IncrementQuantity = new RelayCommand <ProductQuantityViewModel>(ExecuteIncrementQuantity); DecrementQuantity = new RelayCommand <ProductQuantityViewModel>(ExecuteDecrementQuantity); }
public PersonsPageViewModel(IPersonsService personsService, IDialogHost dialogHost) { _personsService = personsService; _dialogHost = dialogHost; Persons = new ObservableCollection <Person>(_personsService.Get()); PersonsViews = (CollectionView)CollectionViewSource.GetDefaultView(Persons); PersonsViews.Filter = PersonsFilter; FilteredFields = new Dictionary <string, string>(Person.Fields) { { AnyFieldFilterValue, "Любое поле" } }; SelectedFilterField = AnyFieldFilterValue; IsContainsFilter = true; SortedFields = new Dictionary <string, string>(Person.Fields) { { NoSortingSortValue, "Не сортировать" } }; SelectedSortField = NoSortingSortValue; IsAscendingSort = true; }
public AddGame(IDialogHost host) { InitializeComponent(); _host = host; App.DataMan.UnSelectPlatforms(); PlatformSelector.ItemsSource = App.DataMan.Emulators; }
public WorkersPageViewModel(IWorkersService workersService, IDialogHost dialogHost) { _workersService = workersService; _dialogHost = dialogHost; Workers = new ObservableCollection <Worker>(_workersService.Get()); WorkersViews = (CollectionView)CollectionViewSource.GetDefaultView(Workers); WorkersViews.Filter = WorkersFilter; FilteredFields = new Dictionary <string, string>(Worker.Fields) { { AnyFieldFilterValue, "Любое поле" } }; SelectedFilterField = AnyFieldFilterValue; IsContainsFilter = true; SortedFields = new Dictionary <string, string>(Worker.Fields) { { NoSortingSortValue, "Не сортировать" } }; SelectedSortField = NoSortingSortValue; IsAscendingSort = true; IsExcludeLaidOffWorkers = false; }
public WeeklySchedulesPageViewModel(ISchedulesService schedulesService, IDialogHost dialogHost) { _schedulesService = schedulesService; _dialogHost = dialogHost; WeeklySchedules = new ObservableCollection <WeeklySchedule>(_schedulesService.Get()); }
public ResidencesPageViewModel(IResidencesService residencesService, IDialogHost dialogHost, Hotel hotel) { _residencesService = residencesService; _dialogHost = dialogHost; _hotel = hotel; Residences = new ObservableCollection <Residence>(_residencesService.Get()); }
public StartWithDialog(IDialogHost host) { InitializeComponent(); _host = host; EmuStarter.DataContext = this; StartCommand = new RelayCommand(o => { Start(o); }, o => true); EmuStarter.ItemsSource = App.DataMan.Emulators; }
protected static void DisplayErrorMessage(IDialogHost dialogHost, string errorMessage) { if (dialogHost == null) { throw new ArgumentNullException("dialogHost"); } dialogHost.ShowErrorMessage(errorMessage, null); }
public CustomContentDialog( IDialogHost dialogHost, DialogMode dialogMode, object content, Dispatcher dispatcher) : base(dialogHost, dialogMode, dispatcher) { SetContent(content); }
public HotelRoomsPageViewModel(IHotelRoomsService hotelRoomsService, IDialogHost dialogHost) { _hotelRoomsService = hotelRoomsService; _dialogHost = dialogHost; HotelRooms = new ObservableCollection <HotelRoom>(_hotelRoomsService.Get()); HotelRoomsViews = (CollectionView)CollectionViewSource.GetDefaultView(HotelRooms); }
public static async Task ShowMessageDialog(this IDialogHost host, string message, string title = null) { var vm = new MessageDialogViewModel() { Title = title, Message = message }; await host.ShowDialog(vm); }
private WaitProgressDialog( IDialogHost dialogHost, DialogMode dialogMode, bool showWaitAnimation, Dispatcher dispatcher) : base(dialogHost, dialogMode, dispatcher) { _waitProgressDialogControl = new WaitProgressDialogControl(showWaitAnimation); SetContent(_waitProgressDialogControl); }
public static async Task <bool> ShowConfirmationDialog(this IDialogHost host, string message, string title = null) { var vm = new ConfirmDialogViewModel() { Title = title, Message = message }; return(await host.ShowDialog(vm)); }
bool IInvokeCommand.Invoke(IDialogHost dialogHost) { if (!Enabled) { return(false); } var args = new DialogUICommandInvokedArgs(dialogHost, this); return(OnInvoked(args)); }
public void RegisterHost(IDialogHost host) { VerifyAccess(); if (_host != null) { throw new InvalidOperationException("Dialog host is already registered"); } _host = host ?? throw new ArgumentNullException(nameof(host)); }
public UnityLiveTemplatesOptionsPage(Lifetime lifetime, UnityScopeCategoryUIProvider uiProvider, OptionsPageContext optionsPageContext, OptionsSettingsSmartContext optionsSettingsSmartContext, StoredTemplatesProvider storedTemplatesProvider, ScopeCategoryManager scopeCategoryManager, IDialogHost dialogHost, TemplatesUIFactory uiFactory, IconHostBase iconHostBase) : base(lifetime, uiProvider, optionsPageContext, optionsSettingsSmartContext, storedTemplatesProvider, scopeCategoryManager, uiFactory, iconHostBase, dialogHost, "CSHARP") { }
/// <summary>Initializes a new instance of DialogButton.</summary> /// <param name="command">The associated UI command.</param> /// <param name="dialogHost">The assoicated dialog host.</param> internal DialogButton(IUICommand command, IDialogHost dialogHost) { if (command == null) throw new ArgumentNullException("command"); if (dialogHost == null) throw new ArgumentNullException("dialogHost"); Debug.Assert(command is IHasDialogResult); Debug.Assert(command is INotifyPropertyChanged); Debug.Assert(command is IInvokeCommand); _command = command; _dialogHost = dialogHost; ((INotifyPropertyChanged) _command).PropertyChanged += CommandPropertyChanged; }
public static IProgressDialog CreateProgressDialog( IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher) { IProgressDialog dialog = null; dispatcher.Invoke( new Action(() => dialog = new WaitProgressDialog( dialogHost, dialogMode, false, dispatcher)), DispatcherPriority.DataBind); return dialog; }
public MainViewModel(ISnackbarMessageQueue snackbarMessageQueue, IDataService dataService, IDialogHost dialogHost) { SnackbarMessageQueue = snackbarMessageQueue; _dataService = dataService; _dialogHost = dialogHost; _dataService.Initialize(); Hotel = _dataService.Hotel.Get(); HamburgerMenuSelectedOptionsIndex = -1; SelectedClient = ClientsPageViewModel.Clients.First(); }
public static IWaitDialog CreateWaitDialog( IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher, bool isIndeterminate) { IWaitDialog dialog = null; dispatcher.Invoke( new Action(() => dialog = new WaitProgressDialog( dialogHost, dialogMode, isIndeterminate, dispatcher)), DispatcherPriority.DataBind); return(dialog); }
protected DialogBase( IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher, System.Windows.MessageBoxImage image = MessageBoxImage.None) { this.dialogHost = dialogHost; this.dispatcher = dispatcher; this.Mode = dialogMode; this.Image = image; this.CloseBehavior = DialogCloseBehavior.AutoCloseOnButtonClick; this.OkText = Strings.OK_Button_Label; this.CancelText = Strings.Cancel_Button_Label; this.YesText = Strings.Yes_Button_Label; this.NoText = Strings.No_Button_Label; switch (dialogMode) { case DialogMode.None: break; case DialogMode.Ok: this.CanOk = true; break; case DialogMode.Cancel: this.CanCancel = true; break; case DialogMode.OkCancel: this.CanOk = true; this.CanCancel = true; break; case DialogMode.YesNo: this.CanYes = true; this.CanNo = true; break; case DialogMode.YesNoCancel: this.CanYes = true; this.CanNo = true; this.CanCancel = true; break; default: throw new ArgumentOutOfRangeException(nameof(dialogMode)); } }
private WaitProgressDialog( IDialogHost dialogHost, DialogMode dialogMode, bool isIndeterminate, Dispatcher dispatcher, System.Windows.MessageBoxImage image = MessageBoxImage.None) : base(dialogHost, dialogMode, dispatcher, image) { this.HorizontalDialogAlignment = HorizontalAlignment.Center; this.VerticalDialogAlignment = VerticalAlignment.Center; this.waitProgressDialogControl = new WaitProgressDialogControl(isIndeterminate); this.SetContent(this.waitProgressDialogControl); }
public CustomContentDialog( IDialogHost dialogHost, DialogMode dialogMode, object content, Dispatcher dispatcher) : base(dialogHost, dialogMode, dispatcher) { if (content is System.Windows.Controls.Control control) { this.HorizontalDialogAlignment = control.HorizontalAlignment; this.VerticalDialogAlignment = control.VerticalAlignment; } this.SetContent(content); }
public MessageDialog(IDialogHost dialogHost, DialogMode dialogMode, string message, Dispatcher dispatcher) : base(dialogHost, dialogMode, dispatcher) { InvokeUICall(() => { _messageTextBlock = new TextBlock { Text = message, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, //Foreground = Ertis.Themes.ThemeManager.GetElementFromResource("ContrastBrush5") as SolidColorBrush }; SetContent(_messageTextBlock); }); }
protected DialogBase( IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher) { _dialogHost = dialogHost; _dispatcher = dispatcher; Mode = dialogMode; CloseBehavior = DialogCloseBehavior.AutoCloseOnButtonClick; OkText = "Ok"; CancelText = "Cancel"; YesText = "Yes"; NoText = "No"; switch (dialogMode) { case DialogMode.None: break; case DialogMode.Ok: CanOk = true; break; case DialogMode.Cancel: CanCancel = true; break; case DialogMode.OkCancel: CanOk = true; CanCancel = true; break; case DialogMode.YesNo: CanYes = true; CanNo = true; break; case DialogMode.YesNoCancel: CanYes = true; CanNo = true; CanCancel = true; break; default: throw new ArgumentOutOfRangeException("dialogMode"); } }
protected DialogBase(IDialogHost dialogHost, DialogMode dialogMode, Dispatcher dispatcher, bool isCloseButtonVisible = true) { _dialogHost = dialogHost; _dispatcher = dispatcher; Mode = dialogMode; CloseBehavior = DialogCloseBehavior.AutoCloseOnButtonClick; this.isCloseButtonVisible = isCloseButtonVisible; OkText = Localization.LocalizationUtility.Convert("Ok"); CancelText = Localization.LocalizationUtility.Convert("Cancel"); YesText = Localization.LocalizationUtility.Convert("Yes"); NoText = Localization.LocalizationUtility.Convert("No"); switch (dialogMode) { case DialogMode.None: break; case DialogMode.Ok: CanOk = true; break; case DialogMode.Cancel: CanCancel = true; break; case DialogMode.OkCancel: CanOk = true; CanCancel = true; break; case DialogMode.YesNo: CanYes = true; CanNo = true; break; case DialogMode.YesNoCancel: CanYes = true; CanNo = true; CanCancel = true; break; default: throw new ArgumentOutOfRangeException("dialogMode"); } }
ShowPasswordInputDialog( this IDialogHost host, string message = null, string title = null, string initialPassword = null ) { var vm = new PasswordInputDialogViewModel() { Title = title ?? "Password input", Message = message ?? "Type your password.", Password = initialPassword, }; var result = await host.ShowDialog(vm); return(result, vm.Password); }
/// <summary>Initializes a new instance of DialogButton.</summary> /// <param name="command">The associated UI command.</param> /// <param name="dialogHost">The assoicated dialog host.</param> internal DialogButton(IUICommand command, IDialogHost dialogHost) { if (command == null) { throw new ArgumentNullException("command"); } if (dialogHost == null) { throw new ArgumentNullException("dialogHost"); } Debug.Assert(command is IHasDialogResult); Debug.Assert(command is INotifyPropertyChanged); Debug.Assert(command is IInvokeCommand); _command = command; _dialogHost = dialogHost; ((INotifyPropertyChanged)_command).PropertyChanged += CommandPropertyChanged; }
public MessageDialog( IDialogHost dialogHost, DialogMode dialogMode, string message, Dispatcher dispatcher) : base(dialogHost, dialogMode, dispatcher) { InvokeUICall(() => { _messageTextBlock = new TextBlock { Text = message, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, }; SetContent(_messageTextBlock); }); }
protected static void DisplayErrorMessage(IDialogHost dialogHost, string errorMessage) { if (dialogHost == null) { throw new ArgumentNullException("dialogHost"); } dialogHost.ShowErrorMessage( errorMessage, caption: null); }