private void InitializeFolderPluginUI(object sender) { FolderType selectedFolderType; if (sender == this.comboFolderType) { selectedFolderType = SelectedFolderType; } else { selectedFolderType = ((IFolderPropertiesUIPlugin)sender).FolderType; } IFolderPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetFolderPropetiesPlugin(selectedFolderType); var allWorkersInfo = new FolderProperties(); var allWorkers = ClientRequests.GetAllWorkers(); foreach (string info in allWorkers) { allWorkersInfo.Properties.Add(info, info); } clientUIPlugin.FolderProperties = allWorkersInfo; clientUIPlugin.OnLoad(ServiceProvider); clientUIPlugin.ChangedFolderTypePlugin += new EventHandler(FolderTypeIsChange); clientUIPlugin.FolderType.Id = selectedFolderType.Id; clientUIPlugin.FolderType.Name = selectedFolderType.Name; clientUIPlugin.FolderType.TypeClientUI = selectedFolderType.TypeClientUI; clientUIPlugin.FolderType.TypeFolderService = selectedFolderType.TypeFolderService; Control newControl = (Control)clientUIPlugin; newControl.Location = new Point(0, 0); _newButtonsControl.Location = new Point(0, newControl.Size.Height); int width = Math.Max(Math.Max(BaseSize.X, newControl.Width), _newButtonsControl.Size.Width); this.Size = new Size(width, Math.Max(BaseSize.Y, newControl.Size.Height + _newButtonsControl.Location.Y + _newButtonsControl.Size.Height)); this.Controls.Clear(); this.Controls.Add(newControl); this.Controls.Add(_newButtonsControl); SelectedFolderType.Id = selectedFolderType.Id; SelectedFolderType.Name = selectedFolderType.Name; SelectedFolderType.TypeFolderService = selectedFolderType.TypeFolderService; SelectedFolderType.TypeClientUI = selectedFolderType.TypeClientUI; ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).CurrentFolderPropertiesPlugin = clientUIPlugin; ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedFolder.Name = clientUIPlugin.FolderProperties.Name; }
void FolderTypeIsChange(object sender, EventArgs e) { FolderType selectedFolderType = SelectedFolderType; IFolderPropertiesUIPlugin clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetFolderPropetiesPlugin(SelectedFolderType); var allWorkersInfo = new FolderProperties(); var allWorkers = ClientRequests.GetAllWorkers(); foreach (string info in allWorkers) { allWorkersInfo.Properties.Add(info, info); } clientUIPlugin.Info = allWorkersInfo; Control newControl = (Control)clientUIPlugin; int locationNewControlY = 0; foreach (Control control in BaseControls) { locationNewControlY = Math.Max(control.Location.Y + control.Size.Height, locationNewControlY); } newControl.Location = new Point(0, locationNewControlY); _newButtonsControl.Location = new Point(0, locationNewControlY + newControl.Size.Height); int width = Math.Max(Math.Max(BaseSizeHeight.X, newControl.Width), _newButtonsControl.Size.Width); this.Size = new Size(width, BaseSizeHeight.Y + newControl.Size.Height + _newButtonsControl.Size.Height); this.Controls.Clear(); this.Controls.Add(newControl); this.Controls.Add(_newButtonsControl); foreach (Control control in BaseControls) { this.Controls.Add(control); } SelectedFolderType = selectedFolderType; }
private IEnumerable <string> GetAllWorkers() { return(ClientRequests.GetAllWorkers()); }