Esempio n. 1
0
        public void SetFullLetter(LetterView letterView)
        {
            if (letterView != null)
            {
                LetterType letterType = ClientRequests.GetLetterType(letterView.Type);
                ILetterPropertiesUIPlugin clientUIPlugin;

                disableControls(splitContainer1.Panel2.Controls);

                if (!_letterPropertiesUIPlugins.TryGetValue(letterType.TypeClientUI, out clientUIPlugin))
                {
                    clientUIPlugin = ((PluginService)(ServiceProvider.GetService(typeof(PluginService)))).GetLetterPropetiesPlugin(letterType);
                    _letterPropertiesUIPlugins.Add(letterType.TypeClientUI, clientUIPlugin);

                    splitContainer1.Panel2.Controls.Add((Control)clientUIPlugin);
                }

                clientUIPlugin.LetterView = letterView;
                clientUIPlugin.ReadOnly   = true;

                this.Size = new Size(splitContainer2.Size.Width + ((Control)clientUIPlugin).Size.Width, Math.Max(splitContainer2.Size.Height, ((Control)clientUIPlugin).Size.Height));

                enableControl((Control)clientUIPlugin);
            }
        }
Esempio n. 2
0
        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);
            }
        }
        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);

            LetterProperties prop = new LetterProperties()
            {
            };

            int minXLocation        = int.MaxValue;
            int minYLocation        = int.MaxValue;
            int sizeForMinYLocation = 0;

            foreach (Control control in BaseControls)
            {
                minXLocation = Math.Min(control.Location.X, minXLocation);

                if (control.Location.Y < minYLocation)
                {
                    minYLocation        = control.Location.Y;
                    sizeForMinYLocation = control.Size.Height;
                }
            }
            ((Control)newControl).Location = new Point(minXLocation, minYLocation + sizeForMinYLocation);

            int width = Math.Max(BaseSizeHeight.X, ((Control)newControl).Width);

            this.Controls.Clear();

            this.Size = new Size(width, BaseSizeHeight.Y + ((Control)newControl).Size.Height);

            this.Controls.Add(((Control)newControl));

            foreach (Control control in BaseControls)
            {
                control.Location = new System.Drawing.Point(control.Location.X, control.Location.Y + ((Control)newControl).Size.Height);
                this.Controls.Add(control);
            }
        }