public void OnRefresh() { var view = _viewManager.CreateViewForModel(_waitingDialogViewModel); DialogHost.Show(view, "RefreshDeviceDialog", (object sender, DialogOpenedEventArgs args) => { _deviceTask = Task.Run(() => { var devices = GetDevices(); Thread.Sleep(500); Execute.PostToUIThreadAsync(() => { Items = new ObservableCollection <SelectableDeviceViewModel>(); foreach (var device in devices) { Items.Add(new SelectableDeviceViewModel { DeviceData = device }); Console.WriteLine($@"{device.Model}({device.Serial})"); } args.Session.Close(false); }); return(true); }); }); }
public void OpenTab(Func <Screen> content) { var s = content.Invoke(); var view = _viewManager.CreateViewForModel(s); _viewManager.BindViewToModel(view, s); TabContents.Add(new TabContent(s.DisplayName, view)); }
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; }
private async Task <object> ShowDialog(string identifier, DialogViewModelBase viewModel) { var view = _viewManager.CreateViewForModel(viewModel); _viewManager.BindViewToModel(view, viewModel); if (identifier == null) { return(await DialogHost.Show(view, viewModel.OnDialogOpened, viewModel.OnDialogClosed)); } return(await DialogHost.Show(view, identifier, viewModel.OnDialogOpened, viewModel.OnDialogClosed)); }
public void SelectDevice() { _deviceViewModel.ToggleSingleSelectionMode(); var view = _viewManager.CreateViewForModel(_deviceViewModel); _viewManager.BindViewToModel(view, _deviceViewModel); _windowManager.ShowDialog(_deviceViewModel); var device = _deviceViewModel.GetSelectedDevice(); CurrentDeviceData = device.Count == 0 ? null : _deviceViewModel.GetSelectedDevice()[0]; GetPortForwardingInfo(); }
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); }
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); }