Exemplo n.º 1
0
        private void summaryPanel_RemoveItem(int rowIndex, GeneralPageSummaryInfo objectInfo)
        {
            Control controlFromPosition  = this.tableLayoutPanel.GetControlFromPosition(0, rowIndex);
            Control controlFromPosition2 = this.tableLayoutPanel.GetControlFromPosition(1, rowIndex);

            this.tableLayoutPanel.Controls.Remove(controlFromPosition);
            this.tableLayoutPanel.Controls.Remove(controlFromPosition2);
            for (int i = rowIndex + 1; i < this.tableLayoutPanel.RowCount; i++)
            {
                Control controlFromPosition3 = this.tableLayoutPanel.GetControlFromPosition(0, i);
                if (controlFromPosition3 != null)
                {
                    this.tableLayoutPanel.SetRow(controlFromPosition3, i - 1);
                }
                controlFromPosition3 = this.tableLayoutPanel.GetControlFromPosition(1, i);
                if (controlFromPosition3 != null)
                {
                    this.tableLayoutPanel.SetRow(controlFromPosition3, i - 1);
                }
            }
            this.tableLayoutPanel.RowStyles.RemoveAt(this.tableLayoutPanel.RowCount - 1);
            this.tableLayoutPanel.RowCount--;
            if (rowIndex == 0 && this.GetControlFromPosition(0, 0) != null)
            {
                this.GetControlFromPosition(0, 0).Margin = this.firstRowMargin;
                this.GetControlFromPosition(1, 0).Margin = this.firstRowMargin;
            }
            objectInfo.BindingSourceChanged      -= this.objectInfo_BindingSourceChanged;
            objectInfo.DataSourceChanged         -= this.objectInfo_DataSourceChanged;
            objectInfo.PropertyNameChanged       -= this.objectInfo_PropertyNameChanged;
            objectInfo.PropertyEmptyValueChanged -= this.objectInfo_PropertyEmptyValueChanged;
        }
Exemplo n.º 2
0
        private Control GetDescriptionControl(GeneralPageSummaryInfo objectInfo)
        {
            Control result = null;

            switch (this.descriptionControl)
            {
            case DescriptionControl.Label:
                result = new Label
                {
                    Name     = objectInfo.PropertyName.Replace('.', '_') + "TextBox",
                    Dock     = DockStyle.Top,
                    AutoSize = true
                };
                break;

            case DescriptionControl.TextBox:
                result = new ExchangeTextBox
                {
                    Name        = objectInfo.PropertyName.Replace('.', '_') + "TextBox",
                    ReadOnly    = true,
                    BorderStyle = BorderStyle.None,
                    Dock        = DockStyle.Top,
                    FormatMode  = objectInfo.FormatMode
                };
                break;
            }
            return(result);
        }
Exemplo n.º 3
0
        private void objectInfo_UpdateBinding(GeneralPageSummaryInfo objectInfo)
        {
            Control controlFromPosition = this.tableLayoutPanel.GetControlFromPosition(1, this.SummaryInfoCollection.IndexOf(objectInfo));

            if (controlFromPosition != null)
            {
                Binding binding = controlFromPosition.DataBindings["Text"];
                if (binding != null)
                {
                    controlFromPosition.DataBindings.Remove(binding);
                }
                if (objectInfo.BindingSource != null && objectInfo.BindingSource.DataSource != null)
                {
                    binding = new Binding("Text", objectInfo.BindingSource, objectInfo.PropertyName, true, DataSourceUpdateMode.Never, string.Empty);
                    controlFromPosition.DataBindings.Add(binding);
                    binding.Format += delegate(object sender, ConvertEventArgs e)
                    {
                        if (binding.DataSourceUpdateMode == DataSourceUpdateMode.Never && (e.Value == null || string.IsNullOrEmpty(e.Value.ToString())))
                        {
                            e.Value = objectInfo.PropertyEmptyValue;
                        }
                    };
                    if (objectInfo.BindingSource.DataSource is Type)
                    {
                        controlFromPosition.Text = objectInfo.PropertyEmptyValue;
                        return;
                    }
                    binding.ReadValue();
                }
            }
        }
Exemplo n.º 4
0
        private void summaryPanel_InsertItem(int rowIndex, GeneralPageSummaryInfo objectInfo)
        {
            Label label = new Label();

            label.Name     = objectInfo.PropertyName.Replace('.', '_') + "Label";
            label.Text     = objectInfo.Text;
            label.Anchor   = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            label.AutoSize = true;
            if (this.summaryControlStyle == SummaryControlStyle.VariableDescriptionSize)
            {
                int width = (int)Math.Floor(0.7 * (double)(this.DefaultSize.Width - base.Padding.Horizontal));
                label.MaximumSize = new Size(width, 0);
            }
            Control control = this.GetDescriptionControl(objectInfo);

            this.tableLayoutPanel.RowCount++;
            this.tableLayoutPanel.RowStyles.Insert(rowIndex, new RowStyle());
            for (int i = this.tableLayoutPanel.RowCount - 2; i >= rowIndex; i--)
            {
                Control controlFromPosition = this.tableLayoutPanel.GetControlFromPosition(0, i);
                if (controlFromPosition != null)
                {
                    this.tableLayoutPanel.SetRow(controlFromPosition, i + 1);
                }
                controlFromPosition = this.tableLayoutPanel.GetControlFromPosition(1, i);
                if (controlFromPosition != null)
                {
                    this.tableLayoutPanel.SetRow(controlFromPosition, i + 1);
                }
            }
            label.Margin   = ((rowIndex == 0) ? this.firstRowMargin : this.nonFirstRowMargin);
            control.Margin = ((rowIndex == 0) ? this.firstRowMargin : this.nonFirstRowMargin);
            if (rowIndex == 0 && this.GetControlFromPosition(0, 0) != null)
            {
                this.GetControlFromPosition(0, 0).Margin = this.nonFirstRowMargin;
                this.GetControlFromPosition(1, 0).Margin = this.nonFirstRowMargin;
            }
            this.tableLayoutPanel.Controls.Add(label, 0, rowIndex);
            this.tableLayoutPanel.Controls.Add(control, 1, rowIndex);
            label.DataBindings.Add(new Binding("Text", objectInfo, "Text"));
            if (objectInfo.BindingSource != null && objectInfo.BindingSource.DataSource != null)
            {
                this.objectInfo_UpdateBinding(objectInfo);
            }
            objectInfo.BindingSourceChanged      += this.objectInfo_BindingSourceChanged;
            objectInfo.DataSourceChanged         += this.objectInfo_DataSourceChanged;
            objectInfo.PropertyNameChanged       += this.objectInfo_PropertyNameChanged;
            objectInfo.PropertyEmptyValueChanged += this.objectInfo_PropertyEmptyValueChanged;
        }
Exemplo n.º 5
0
        public BulkEditSummaryPage()
        {
            this.InitializeComponent();
            this.Text = Strings.BulkEditingSummaryDialogTitle;
            this.summaryDescriptionLabel.Text = Strings.BulkEditingSummaryDescription;
            GeneralPageSummaryInfo generalPageSummaryInfo  = new GeneralPageSummaryInfo();
            GeneralPageSummaryInfo generalPageSummaryInfo2 = new GeneralPageSummaryInfo();

            generalPageSummaryInfo.Text           = Strings.BulkEditingSelectedItemTypeLabel;
            base.BindingSource.DataSource         = typeof(DataContext);
            generalPageSummaryInfo.BindingSource  = base.BindingSource;
            generalPageSummaryInfo.PropertyName   = "SelectedObjectDetailsType";
            generalPageSummaryInfo2.Text          = Strings.BulkEditingSelectedItemNumberLabel;
            generalPageSummaryInfo2.BindingSource = base.BindingSource;
            generalPageSummaryInfo2.PropertyName  = "SelectedObjectsCount";
            this.modifiedParametersLabel.Text     = Strings.BulkEditingModifiedParametersLabel;
            this.summaryHintLabel.Text            = Strings.BulkEditingSummaryHintLabel;
            this.modifiedParametersTextBox.DataBindings.Add("Text", base.BindingSource, "ModifiedParametersDescription", true, DataSourceUpdateMode.Never);
            this.exchangeSummaryControl1.SummaryInfoCollection.Add(generalPageSummaryInfo);
            this.exchangeSummaryControl1.SummaryInfoCollection.Add(generalPageSummaryInfo2);
        }