コード例 #1
0
        private void AddRamlContractCallback(object sender, EventArgs e)
        {
            var ramlScaffoldUpdater  = RamlScaffoldServiceBase.GetRamlScaffoldService(ServiceProvider.GlobalProvider);
            var ramlChooserViewModel = new RamlChooserViewModel();

            ramlChooserViewModel.Load(ServiceProvider.GlobalProvider, ramlScaffoldUpdater.AddContract, "Add RAML Contract", true, Settings.Default.RAMLExchangeUrl);
            dynamic settings = new ExpandoObject();

            settings.Height = 570;
            windowManager.ShowDialog(ramlChooserViewModel, null, settings);
            //var frm = new RamlChooserView(ServiceProvider.GlobalProvider, ramlScaffoldUpdater.AddContract, "Add RAML Contract", true, Settings.Default.RAMLExchangeUrl);
            //frm.ShowDialog();
        }
コード例 #2
0
        private void EditRamlPropertiesCallback(object sender, EventArgs e)
        {
            ChangeCommandStatus(editRamlPropertiesCmdId, false);

            // Get the file path
            uint         itemid;
            IVsHierarchy hierarchy;

            if (!IsSingleProjectItemSelection(out hierarchy, out itemid))
            {
                return;
            }
            string ramlFilePath;

            ((IVsProject)hierarchy).GetMkDocument(itemid, out ramlFilePath);

            var refFilePath = InstallerServices.GetRefFilePath(ramlFilePath);


            var editorModel = new RamlPropertiesEditorViewModel();

            editorModel.Load(refFilePath, Settings.Default.ContractsFolderName, Settings.Default.ApiReferencesFolderName);
            windowManager.ShowDialog(editorModel);

            //var frm = new RamlPropertiesEditor();
            //frm.Load(refFilePath, Settings.Default.ContractsFolderName, Settings.Default.ApiReferencesFolderName);
            //var result = frm.ShowDialog();
            if (editorModel.WasSaved)
            {
                if (IsServerSide(ramlFilePath))
                {
                    var ramlScaffoldUpdater = RamlScaffoldServiceBase.GetRamlScaffoldService(ServiceProvider.GlobalProvider);
                    ramlScaffoldUpdater.UpdateRaml(ramlFilePath);
                }
                else
                {
                    var templatesManager    = new TemplatesManager();
                    var ramlFolder          = Path.GetDirectoryName(ramlFilePath).TrimEnd(Path.DirectorySeparatorChar);
                    var generatedFolderPath = ramlFolder.Substring(0, ramlFolder.LastIndexOf(Path.DirectorySeparatorChar) + 1);
                    if (!templatesManager.ConfirmWhenIncompatibleClientTemplate(generatedFolderPath))
                    {
                        return;
                    }

                    RegenerateClientCode(ramlFilePath);
                }
            }

            ChangeCommandStatus(editRamlPropertiesCmdId, true);
        }
コード例 #3
0
        private void UpdateRamlContractCallback(object sender, EventArgs e)
        {
            ChangeCommandStatus(updateRamlContractCommandId, false);

            // Get the file path
            uint         itemid;
            IVsHierarchy hierarchy;

            if (!IsSingleProjectItemSelection(out hierarchy, out itemid))
            {
                return;
            }
            string ramlFilePath;

            ((IVsProject)hierarchy).GetMkDocument(itemid, out ramlFilePath);

            var ramlScaffoldUpdater = RamlScaffoldServiceBase.GetRamlScaffoldService(ServiceProvider.GlobalProvider);

            ramlScaffoldUpdater.UpdateRaml(ramlFilePath);

            ChangeCommandStatus(updateRamlContractCommandId, true);
        }
コード例 #4
0
        private void DocumentEventsOnDocumentSaved(Document document)
        {
            RamlScaffoldServiceBase.TriggerScaffoldOnRamlChanged(document);

            RamlClientTool.TriggerClientRegeneration(document, GetExtensionPath());
        }