/// <summary>
 /// Initializes a new instance of the <see cref="PluginOptionsWindow"/> class.
 /// </summary>
 /// <param name="dataModel">
 /// The data model.
 /// </param>
 public ExtensionOptionsWindow(ExtensionOptionsModel dataModel)
 {
     this.InitializeComponent();
     if (dataModel != null)
     {
         dataModel.RequestClose += (s, e) => this.Close();
     }
     this.DataContext = dataModel;
 }
        public void RefreshDataContext(ExtensionOptionsModel extensionOptionsData)
        {
            if (extensionOptionsData != null)
            {
                extensionOptionsData.RequestClose += (s, e) => this.Close();
            }

            this.DataContext = null;
            this.DataContext = extensionOptionsData;
        }
 /// <summary>
 ///     The threadprc.
 /// </summary>
 private void WindowPlugins()
 {
     var plugins = new List<IPlugin> { new DummyLocalAnalyserExtension() };
     var modelPl = new ExtensionOptionsModel(new PluginController(), null);
     var windowPlugins = new ExtensionOptionsWindow(modelPl);
     windowPlugins.ShowDialog();
 }
        /// <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>
 /// Initializes a new instance of the <see cref="UserSelectControl"/> class.
 /// </summary>
 /// <param name="model">
 /// The model.
 /// </param>
 public UserSelectControl(ExtensionOptionsModel model, ReadOnlyCollection<IPlugin> plugins )
 {
     this.plugins = plugins;
     this.model = model;
 }