public ManageOpenInEditorReferencesViewModel(ConfigurationViewModel configuration) { Title = "Manage OpenInEditor references."; Configuration = configuration; Filter = new ReactiveProperty <string>(); Filter .Throttle(TimeSpan.FromMilliseconds(500)) .Subscribe(FilterChanged); }
private Task EditConfigurationExecute(ConfigurationViewModel arg) { if (!ServiceLocator.TryGetService(out IViewModelPresenter viewModelPresenter)) { throw new Exception($"{nameof(IViewModelPresenter)} missing."); } viewModelPresenter.Present(arg); return(Task.CompletedTask); }
private async Task DeleteConfigurationExecute(ConfigurationViewModel arg) { if (!ServiceLocator.TryGetService(out IUIService uiService)) { throw new Exception($"{nameof(IUIService)} not available."); } if (uiService.GetYesNo("Delete for sure?", "Question") && await _configurationManager.DeleteConfigurationAsync(arg.Id)) { await ReloadConfigurationsAsync(null); } }
private async Task BuildTemplateExecute(ConfigurationViewModel arg) { EventHandler ProgressOnCanceled(CancellationTokenSource cts) { return((sender, args) => cts.Cancel()); } using (var cts = new CancellationTokenSource()) { if (!ServiceLocator.TryGetService(out IUIService uiService)) { throw new Exception($"{nameof(IUIService)} not available."); } var progress = await uiService.ShowProgressAsync($"Building templates", "loading...", true); try { var rewriter = new RewriteTool(arg.Model); progress.Canceled += ProgressOnCanceled(cts); await Task.Delay(1000, cts.Token); progress.SetIndeterminate(); await rewriter.ExecuteAsync(cts.Token, new Progress <string>(p => progress.SetMessage(p))); } catch (TaskCanceledException) { } catch (OperationCanceledException) { } finally { progress.Canceled -= ProgressOnCanceled(cts); await progress.CloseAsync(); } } }
private async void ConfigurationSaved(ConfigurationViewModel obj) { await ReloadConfigurationsAsync(null); }