/// <summary>Initializes a new instance of the <see cref="WebApiToSwaggerGeneratorViewModel"/> class.</summary>
        public WebApiToSwaggerGeneratorViewModel()
        {
            BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly);

            LoadAssembliesCommand = new AsyncRelayCommand(async() => await LoadAssembliesAsync(), () => AssemblyPaths?.Length > 0);
            LoadAssembliesCommand.TryExecute();
        }
        /// <summary>Initializes a new instance of the <see cref="AssemblyTypeToSwaggerGeneratorViewModel"/> class.</summary>
        public AssemblyTypeToSwaggerGeneratorViewModel()
        {
            BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly);

            LoadAssemblyCommand = new AsyncRelayCommand(LoadAssemblyAsync, () => !string.IsNullOrEmpty(AssemblyPath));
            LoadAssemblyCommand.TryExecute();
        }
        /// <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();
        }
Example #4
0
        /// <summary>Initializes a new instance of the <see cref="AssemblySwaggerGeneratorViewModel"/> class.</summary>
        public AssemblySwaggerGeneratorViewModel()
        {
            BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly);
            LoadAssemblyCommand   = new AsyncRelayCommand(LoadAssembly, () => !string.IsNullOrEmpty(AssemblyPath));

            AssemblyPath = ApplicationSettings.GetSetting("AssemblyPath", string.Empty);
            LoadAssemblyCommand.TryExecute();
        }
        /// <summary>Initializes a new instance of the <see cref="WebApiSwaggerGeneratorViewModel"/> class.</summary>
        public WebApiSwaggerGeneratorViewModel()
        {
            BrowseAssemblyCommand = new AsyncRelayCommand(BrowseAssembly);
            LoadAssemblyCommand   = new AsyncRelayCommand(LoadAssembly, () => !string.IsNullOrEmpty(AssemblyPath));

            SpecifyControllerName = true;

            AssemblyPath = ApplicationSettings.GetSetting("AssemblyPath", string.Empty);
            UrlTemplate  = ApplicationSettings.GetSetting("UrlTemplate", "api/{controller}/{action}/{id}");

            LoadAssemblyCommand.TryExecute();
        }
        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);
        }