예제 #1
0
        public async void AddExistingRamlFromDisk()
        {
            SelectExistingRamlOption();
            FileDialog fd = new OpenFileDialog();

            fd.DefaultExt = ".raml;*.rml";
            fd.Filter     = "RAML files |*.raml;*.rml";

            var opened = fd.ShowDialog();

            if (opened != true)
            {
                return;
            }

            RamlTempFilePath   = fd.FileName;
            RamlOriginalSource = fd.FileName;

            var previewViewModel = new RamlPreviewViewModel(ServiceProvider, action, RamlTempFilePath, RamlOriginalSource,
                                                            Path.GetFileName(fd.FileName), isContractUseCase);

            StartProgress();
            await previewViewModel.FromFile();

            StopProgress();

            ShowPreviewViewAndClose(previewViewModel);
        }
예제 #2
0
        public void AddNewContract()
        {
            var previewViewModel = new RamlPreviewViewModel(ServiceProvider, action, Title);

            previewViewModel.NewContract();
            dynamic settings = new ExpandoObject();

            settings.Height = 420;
            WindowManager.ShowDialog(previewViewModel, null, settings);
            TryClose();
        }
예제 #3
0
        public async void AddExistingRamlFromUrl()
        {
            SelectExistingRamlOption();
            var previewViewModel = new RamlPreviewViewModel(ServiceProvider, action, RamlTempFilePath, Url, "title", isContractUseCase);

            StartProgress();
            await previewViewModel.FromUrl();

            StopProgress();

            ShowPreviewViewAndClose(previewViewModel);
        }
예제 #4
0
        private void ShowPreviewViewAndClose(RamlPreviewViewModel previewViewModel)
        {
            dynamic settings = new ExpandoObject();

            settings.Height = isContractUseCase ? 660 : 480;
            WindowManager.ShowDialog(previewViewModel, null, settings);

            if (previewViewModel.WasImported)
            {
                TryClose();
            }
        }
예제 #5
0
        public async void AddExistingRamlFromExchange()
        {
            SelectExistingRamlOption();
            var rmlLibrary       = new RAMLLibraryBrowser(exchangeUrl);
            var selectedRamlFile = rmlLibrary.ShowDialog();

            if (selectedRamlFile.HasValue && selectedRamlFile.Value)
            {
                var url = rmlLibrary.RAMLFileUrl;

                Url = url;

                var previewViewModel = new RamlPreviewViewModel(ServiceProvider, action, RamlTempFilePath, url, "title", isContractUseCase);

                StartProgress();
                await previewViewModel.FromUrl();

                StopProgress();

                ShowPreviewViewAndClose(previewViewModel);
            }
        }