private void SetPreview(RamlDocument document) { Execute.OnUIThreadAsync(() => { try { ResourcesPreview = GetResourcesPreview(document); StopProgress(); SetNamespace(RamlTempFilePath); if (document.Version != null) { ApiVersion = NetNamingMapper.GetVersionName(document.Version); } CanImport = true; if (NetNamingMapper.HasIndalidChars(Filename)) { ShowErrorAndStopProgress("The specied file name has invalid chars"); // txtFileName.Focus(); } } catch (Exception ex) { ShowErrorAndStopProgress("Error while parsing raml file. " + ex.Message); ActivityLog.LogError(VisualStudioAutomationHelper.RamlVsToolsActivityLogSource, VisualStudioAutomationHelper.GetExceptionInfo(ex)); } }); }
public void SaveButton() { if (Namespace == null || NetNamingMapper.HasIndalidChars(Namespace)) { MessageBox.Show("Error: invalid namespace."); return; } if (clientName != null && NetNamingMapper.HasIndalidChars(ClientName)) { MessageBox.Show("Error: invalid client name."); return; } if (source != null && NetNamingMapper.HasIndalidChars(source)) { MessageBox.Show("Error: invalid source."); return; } if (HasInvalidPath(ModelsFolder)) { MessageBox.Show("Error: invalid path specified for models. Path must be relative."); return; } if (HasInvalidPath(ImplementationControllersFolder)) { MessageBox.Show("Error: invalid path specified for controllers. Path must be relative."); return; } var ramlProperties = new RamlProperties { Namespace = Namespace, Source = Source, ClientName = ClientName, UseAsyncMethods = UseAsyncMethods, IncludeApiVersionInRoutePrefix = IncludeApiVersionInRoutePrefix, ModelsFolder = ModelsFolder, AddGeneratedSuffix = AddGeneratedSuffixToFiles, ImplementationControllersFolder = ImplementationControllersFolder }; RamlPropertiesManager.Save(ramlProperties, ramlPath); WasSaved = true; TryClose(); }