public void InitializeForm() { InitializeClientService(); InitializeMessageService(); InitializeBaseControls(); LetterView letterView = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterView; LetterType selectedLetterType = ClientRequests.GetLetterType(letterView.Type); ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType); newControl.LetterView = letterView; newControl.ReadOnly = true; int tabIndex = 0; newControl.OnLoad(ServiceProvider); ((Control)newControl).TabIndex = tabIndex; int heightSize = 0; int locationY = 0; foreach (Control control in BaseControls) { if (control.Location.Y + control.Size.Height > locationY) { locationY = control.Location.Y + control.Size.Height; } heightSize += control.Size.Height; } this.Controls.Clear(); ((Control)newControl).Location = new Point(0, locationY); this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Size.Height + heightSize); this.Controls.Add(((Control)newControl)); foreach (Control control in BaseControls) { ++tabIndex; control.TabIndex = tabIndex; this.Controls.Add(control); } }
private void InitializeForm() { InitializeClientService(); InitializeMessageService(); int tabIndex = 0; var selectedLetterType = ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).SelectedLetterType; ILetterPropertiesUIPlugin newControl = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(selectedLetterType); ((Control)newControl).TabIndex = tabIndex; newControl.OnLoad(ServiceProvider); newControl.ReadOnly = false; var clientService = (IClientRequests)ServiceProvider.GetService(typeof(IClientRequests)); var workers = clientService.GetAllWorkers(); this.Size = new Size(((Control)newControl).Size.Width, ((Control)newControl).Height); this.Controls.Add(((Control)newControl)); ((ApplicationState)ServiceProvider.GetService(typeof(ApplicationState))).CurrentLetterPropertiesPlugin = newControl; }