/// <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();
        }
Ejemplo n.º 2
0
 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();
        }
Ejemplo n.º 4
0
        /// <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();
        }
Ejemplo n.º 7
0
        /// <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>();
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        public PainViewModel()
        {
            AllElements = new MtObservableCollection<Pain>();
            LoadList();
            FilteredElements = new ObservableCollectionView<Pain>(AllElements);

            #region Commands

            DeletePainCommand = new AsyncRelayCommand<Pain>(DeletePain, pain => pain != null);

            #endregion
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
 public MainWindowModel()
 {
     GenerateCommand = new AsyncRelayCommand(GenerateAsync);
     SelectedSwaggerGenerator = SwaggerGenerators.First();
 }
Ejemplo n.º 12
0
 /// <summary>Initializes a new instance of the <see cref="MainWindowModel"/> class.</summary>
 public DocumentViewModel()
 {
     GenerateCommand = new AsyncRelayCommand(GenerateAsync);
 }