/// <summary>Initializes a new instance of the <see cref="WebApiSwaggerGeneratorViewModel"/> class.</summary> public WebApiSwaggerGeneratorViewModel() { BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly); LoadAssemblyCommand = new AsyncRelayCommand(async () => await LoadAssemblyAsync(true), () => !string.IsNullOrEmpty(AssemblyPath)); LoadAssemblyCommand.TryExecute(); }
public MainWindowModel() { UpdateCommand = new AsyncRelayCommand<WikiConfiguration>(GenerateHtmlFilesAsync); AddCommand = new RelayCommand(Add); RemoveCommand = new RelayCommand<WikiConfiguration>(Remove); ApplyCommand = new RelayCommand<WikiConfiguration>(Apply); }
/// <summary>Initializes a new instance of the <see cref="AssemblySwaggerGeneratorViewModel"/> class.</summary> public AssemblySwaggerGeneratorViewModel() { BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly); LoadAssemblyCommand = new AsyncRelayCommand(LoadAssemblyAsync, () => !string.IsNullOrEmpty(AssemblyPath)); LoadAssemblyCommand.TryExecute(); }
/// <summary>Initializes a new instance of the <see cref="MtFrame"/> class. </summary> public MtFrame() { #if WINDOWS_UAP AutomaticBackButtonHandling = true; #endif HorizontalContentAlignment = HorizontalAlignment.Stretch; VerticalContentAlignment = VerticalAlignment.Stretch; HorizontalAlignment = HorizontalAlignment.Stretch; VerticalAlignment = VerticalAlignment.Stretch; Loaded += delegate { Window.Current.VisibilityChanged += OnVisibilityChanged; }; Unloaded += delegate { Window.Current.VisibilityChanged -= OnVisibilityChanged; }; GoBackCommand = new AsyncRelayCommand(GoBackAsync, () => CanGoBack); DefaultStyleKey = typeof(MtFrame); if (Device.HasHardwareBackKey) { DisableForwardStack = true; PageAnimation = new TurnstilePageAnimation(); } else DisableForwardStack = false; }
public AssemblySwaggerGeneratorViewModel() { BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly); LoadAssemblyCommand = new AsyncRelayCommand(LoadAssembly, () => !string.IsNullOrEmpty(AssemblyPath)); AssemblyPath = ApplicationSettings.GetSetting("AssemblyPath", string.Empty); LoadAssemblyCommand.TryExecute(); }
public WebApiSwaggerGeneratorViewModel() { BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly); LoadAssemblyCommand = new AsyncRelayCommand(LoadAssembly, () => !string.IsNullOrEmpty(AssemblyPath)); AssemblyPath = ApplicationSettings.GetSetting("AssemblyPath", string.Empty); UrlTemplate = ApplicationSettings.GetSetting("UrlTemplate", "api/{controller}/{action}/{id}"); LoadAssemblyCommand.TryExecute(); }
/// <summary>Initializes a new instance of the <see cref="MainWindowModel"/> class.</summary> public MainWindowModel() { CreateDocumentCommand = new RelayCommand(CreateDocument); OpenDocumentCommand = new AsyncRelayCommand(OpenDocumentAsync); CloseDocumentCommand = new AsyncRelayCommand<DocumentModel>(async document => await CloseDocumentAsync(document), document => document != null); SaveDocumentCommand = new AsyncRelayCommand<DocumentModel>(async document => await SaveDocumentAsync(document), document => document != null); SaveAsDocumentCommand = new AsyncRelayCommand<DocumentModel>(async document => await SaveAsDocumentAsync(document), document => document != null); Documents = new ObservableCollection<DocumentModel>(); }
public async Task When_passing_function_with_task_then_command_cannot_be_executed_during_task_execution() { var command = new AsyncRelayCommand(async () => { await Task.Delay(1000); }); Assert.IsTrue(command.CanExecute); command.TryExecute(); Assert.IsFalse(command.CanExecute); await Task.Delay(1500); Assert.IsTrue(command.CanExecute); }
public PainViewModel() { AllElements = new MtObservableCollection<Pain>(); LoadList(); FilteredElements = new ObservableCollectionView<Pain>(AllElements); #region Commands DeletePainCommand = new AsyncRelayCommand<Pain>(DeletePain, pain => pain != null); #endregion }
public MainWindowModel() { Documents = new ObservableCollection<JsonDocumentModel>(); CreateDocumentCommand = new AsyncRelayCommand(CreateDocumentAsync); OpenDocumentCommand = new AsyncRelayCommand(OpenDocumentAsync); OpenDocumentFromPathCommand = new AsyncRelayCommand<string>(OpenDocumentAsync); SaveDocumentCommand = new AsyncRelayCommand<JsonDocumentModel>(SaveDocumentAsync, d => d != null && d.UndoRedoManager.CanUndo); SaveDocumentAsCommand = new AsyncRelayCommand<JsonDocumentModel>(SaveDocumentAsAsync, d => d != null); SaveDocumentSchemaAsCommand = new AsyncRelayCommand<JsonDocumentModel>(SaveDocumentSchemaAsAsync, d => d != null); CloseDocumentCommand = new AsyncRelayCommand<JsonDocumentModel>(CloseDocumentAsync, d => d != null); ValidateDocumentCommand = new AsyncRelayCommand<JsonDocumentModel>(ValidateDocumentAsync, d => d != null); UndoCommand = new RelayCommand<JsonDocumentModel>(d => d.UndoRedoManager.Undo(), d => d != null && d.UndoRedoManager.CanUndo); RedoCommand = new RelayCommand<JsonDocumentModel>(d => d.UndoRedoManager.Redo(), d => d != null && d.UndoRedoManager.CanRedo); }
public MainWindowModel() { GenerateCommand = new AsyncRelayCommand(GenerateAsync); SelectedSwaggerGenerator = SwaggerGenerators.First(); }
/// <summary>Initializes a new instance of the <see cref="MainWindowModel"/> class.</summary> public DocumentViewModel() { GenerateCommand = new AsyncRelayCommand(GenerateAsync); }