示例#1
0
        public void OpenDialog(DialogViewModelBase viewModel, string dialogIdentifier)
        {
            UIElement view = _viewManager.CreateViewForModel(viewModel);

            DialogHost.Show(view, dialogIdentifier, viewModel.OnDialogClosed);
            viewModel.DialogViewModelHost = this;

            ActiveDialogViewModel = viewModel;
            IsOpen = true;
        }
示例#2
0
        private async Task <object> ShowDialog(string identifier, DialogViewModelBase viewModel)
        {
            Task <object> result = null;
            await Execute.OnUIThreadAsync(() =>
            {
                UIElement view = _viewManager.CreateViewForModel(viewModel);
                _viewManager.BindViewToModel(view, viewModel);

                if (identifier == null)
                {
                    result = DialogHost.Show(view, viewModel.OnDialogOpened, viewModel.OnDialogClosed);
                }
                else
                {
                    result = DialogHost.Show(view, identifier, viewModel.OnDialogOpened, viewModel.OnDialogClosed);
                }
            });

            return(await result);
        }
示例#3
0
        private async Task <object?> ShowDialog(string?identifier, DialogViewModelBase viewModel)
        {
            Task <object?>?result = null;
            await Execute.OnUIThreadAsync(() =>
            {
                UIElement view = _viewManager.CreateViewForModel(viewModel);
                _viewManager.BindViewToModel(view, viewModel);

                if (identifier == null)
                {
                    result = DialogHost.Show(view, viewModel.OnDialogOpened, viewModel.OnDialogClosed);
                }
                else
                {
                    result = DialogHost.Show(view, identifier, viewModel.OnDialogOpened, viewModel.OnDialogClosed);
                }
            });

            if (result == null)
            {
                throw new ArtemisSharedUIException("Failed to show dialog host");
            }
            return(await result);
        }