Exemplo n.º 1
0
        private void SaveTemplate(CancelEventArgs e)
        {
            TabControl templateTab = this.templatePage.TemplateSurface.TemplateTab;
            MultiValuedProperty <Page> multiValuedProperty = new MultiValuedProperty <Page>();

            foreach (object obj in templateTab.TabPages)
            {
                CustomTabPage customTabPage      = (CustomTabPage)obj;
                Page          detailsTemplateTab = customTabPage.DetailsTemplateTab;
                detailsTemplateTab.Controls.Clear();
                DetailsTemplatesSurface.SortControls(customTabPage, true);
                foreach (object obj2 in customTabPage.Controls)
                {
                    Control control = (Control)obj2;
                    DetailsTemplateControl detailsTemplateControl = (control as IDetailsTemplateControlBound).DetailsTemplateControl;
                    detailsTemplateTab.Controls.Add(detailsTemplateControl);
                }
                DetailsTemplatesSurface.SortControls(customTabPage, false);
                multiValuedProperty.Add(detailsTemplateTab);
            }
            DetailsTemplate detailsTemplate = this.templatePage.BindingSource.DataSource as DetailsTemplate;

            detailsTemplate.Pages = multiValuedProperty;
            if (this.templatePage.DataHandler != null)
            {
                this.templatePage.DataHandler.SpecifyParameterNames("Pages");
            }
            this.templatePage.Apply(e);
            this.RefreshOnFinish.Refresh(base.CreateProgress(Strings.Refreshing));
        }
Exemplo n.º 2
0
        private void changeService_ComponentAdded(object sender, ComponentEventArgs e)
        {
            Control control = e.Component as Control;

            if (control is IDetailsTemplateControlBound)
            {
                DetailsTemplateControl detailsTemplateControl = (control as IDetailsTemplateControlBound).DetailsTemplateControl;
                PropertyDescriptor     propertyDescriptor     = TypeDescriptor.GetProperties(control)["AttributeName"];
                if (propertyDescriptor != null)
                {
                    TypeDescriptorContext context = new TypeDescriptorContext(this, control, propertyDescriptor);
                    TypeConverter.StandardValuesCollection standardValues = propertyDescriptor.Converter.GetStandardValues(context);
                    if (standardValues != null && standardValues.Count > 0)
                    {
                        propertyDescriptor.SetValue(control, standardValues[0]);
                    }
                }
            }
            this.DataContext.IsDirty = true;
        }
Exemplo n.º 3
0
        private void changeService_ComponentChanged(object sender, ComponentChangedEventArgs e)
        {
            this.needUpdatingPropertyGrid = true;
            Control control = e.Component as Control;

            if (control is IDetailsTemplateControlBound)
            {
                DetailsTemplateControl detailsTemplateControl = (control as IDetailsTemplateControlBound).DetailsTemplateControl;
                control.Location = new Point(Math.Max(control.Location.X, 0), Math.Max(control.Location.Y, 0));
                Point  point  = DetailsTemplatesSurface.PixelToDialogUnits(control.Size.Width, control.Size.Height, this.ExchangeForm);
                Point  point2 = DetailsTemplatesSurface.PixelToDialogUnits(control.Location.X, control.Location.Y, this.ExchangeForm);
                string name;
                if ((name = e.Member.Name) != null)
                {
                    if (!(name == "Size") && !(name == "Width") && !(name == "Height"))
                    {
                        if (name == "Location")
                        {
                            detailsTemplateControl.X = point2.X;
                            detailsTemplateControl.Y = point2.Y;
                        }
                    }
                    else
                    {
                        detailsTemplateControl.Width  = point.X;
                        detailsTemplateControl.Height = point.Y;
                        detailsTemplateControl.X      = point2.X;
                        detailsTemplateControl.Y      = point2.Y;
                    }
                }
            }
            if (!(e.Component is TabControl))
            {
                this.DataContext.IsDirty = true;
            }
        }