/// <summary> /// Initializes a new instance of the <see cref="ExtensionDataModel"/> class. /// </summary> /// <param name="restService"> /// The rest Service. /// </param> /// <param name="vsenvironmenthelper"> /// The vsenvironmenthelper. /// </param> /// <param name="associatedProj"> /// The associated Proj. /// </param> public ExtensionDataModel( ISonarRestService restService, IVsEnvironmentHelper vsenvironmenthelper, Resource associatedProj) { this.RestService = restService; this.Vsenvironmenthelper = vsenvironmenthelper; // commands this.InitCommanding(); // cache data this.cachedIssuesList = new Dictionary<string, List<Issue>>(); this.cachedIssuesListObs = new List<string>(); this.allSourceData = new Dictionary<string, Source>(); this.allSourceCoverageData = new Dictionary<string, SourceCoverage>(); this.allResourceData = new Dictionary<string, Resource>(); // start some data var usortedList = restService.GetUserList(this.UserConfiguration); if (usortedList != null && usortedList.Count > 0) { this.UsersList = new List<User>(usortedList.OrderBy(i => i.Login)); } var projects = restService.GetProjectsList(this.UserConfiguration); if (projects != null && projects.Count > 0) { this.ProjectResources = new List<Resource>(projects.OrderBy(i => i.Name)); } this.AssociatedProject = associatedProj; this.UserTextControlsHeight = new GridLength(0); this.UserControlsHeight = new GridLength(0); this.IssuesFilterWidth = new GridLength(0); this.ServerAnalysis = AnalysesType.Off; this.RestoreUserSettingsInIssuesDataGrid(); this.RestoreUserFilteringOptions(); }
/// <summary> /// Initializes a new instance of the <see cref="ExtensionDataModel"/> class. /// </summary> /// <param name="restService"> /// The rest Service. /// </param> /// <param name="vsenvironmenthelper"> /// The vsenvironmenthelper. /// </param> /// <param name="associatedProj"> /// The associated Proj. /// </param> public ExtensionDataModel(ISonarRestService restService, IVsEnvironmentHelper vsenvironmenthelper, Resource associatedProj) { this.RestService = restService; this.Vsenvironmenthelper = vsenvironmenthelper; // commands this.InitCommanding(); this.UserTextControlsHeight = new GridLength(0); this.UserControlsHeight = new GridLength(0); this.RestoreUserSettingsInIssuesDataGrid(); this.RestoreUserFilteringOptions(); this.AnalysisTrigger = false; ConnectionConfiguration conf = this.UserConfiguration; if (conf == null) { return; } // start some data List<User> usortedList = restService.GetUserList(conf); if (usortedList != null && usortedList.Count > 0) { this.UsersList = new List<User>(usortedList.OrderBy(i => i.Login)); } List<Resource> projects = restService.GetProjectsList(conf); if (projects != null && projects.Count > 0) { this.ProjectResources = new List<Resource>(projects.OrderBy(i => i.Name)); } this.AssociatedProject = associatedProj; var plugins = this.PluginControl.GetPlugins(); if (plugins != null) { this.ExtensionOptionsData = new ExtensionOptionsModel(this.PluginControl, this); this.LocalAnalyserModule = new SonarLocalAnalyser.SonarLocalAnalyser(new List<IPlugin>(plugins), this.RestService, this.vsenvironmenthelper); this.LocalAnalyserModule.StdOutEvent += this.UpdateOutputMessagesFromPlugin; this.LocalAnalyserModule.LocalAnalysisCompleted += this.UpdateLocalIssues; this.ExtensionOptionsData.Vsenvironmenthelper = this.Vsenvironmenthelper; this.ExtensionOptionsData.ResetUserData(); foreach (var plugin in plugins) { var configuration = ConnectionConfigurationHelpers.GetConnectionConfiguration(this.Vsenvironmenthelper); var controloption = plugin.GetPluginControlOptions(configuration); if (controloption == null) { continue; } var pluginKey = plugin.GetKey(ConnectionConfigurationHelpers.GetConnectionConfiguration(this.Vsenvironmenthelper)); var options = this.Vsenvironmenthelper.ReadAllAvailableOptionsInSettings(pluginKey); controloption.SetOptions(options); } } }
/// <summary> /// The extension data model update. /// </summary> /// <param name="restServiceIn"> /// The rest service in. /// </param> /// <param name="vsenvironmenthelperIn"> /// The vsenvironmenthelper in. /// </param> /// <param name="associatedProj"> /// The associated proj. /// </param> public void ExtensionDataModelUpdate(ISonarRestService restServiceIn, IVsEnvironmentHelper vsenvironmenthelperIn, Resource associatedProj) { this.RestService = restServiceIn; this.Vsenvironmenthelper = vsenvironmenthelperIn; this.InitCommanding(); // start some data var usortedList = restServiceIn.GetUserList(this.UserConfiguration); if (usortedList != null) { this.UsersList = new List<User>(usortedList.OrderBy(i => i.Login)); this.UsersList.Add(new User()); } var projects = restServiceIn.GetProjectsList(this.UserConfiguration); if (projects != null) { this.ProjectResources = new List<Resource>(projects.OrderBy(i => i.Name)); } this.AssociatedProject = associatedProj; this.UserTextControlsHeight = new GridLength(0); this.UserControlsHeight = new GridLength(0); this.CommentsWidth = new GridLength(0); this.RestoreUserSettingsInIssuesDataGrid(); this.RestoreUserFilteringOptions(); }