private void OnExpressionBuilderComboBoxSelectedIndexChanged(object sender, EventArgs e)
 {
     if (!this._internalChange)
     {
         this._currentSheet = null;
         if (this._expressionBuilderComboBox.SelectedItem != this.NoneItem)
         {
             this._currentEditor = (ExpressionEditor)this._expressionEditors[this._expressionBuilderComboBox.SelectedItem.ToString()];
             if (this._currentNode != null)
             {
                 if (this._currentNode.IsBound)
                 {
                     ExpressionBinding binding = this._currentNode.Binding;
                     if (this._expressionEditors[binding.ExpressionPrefix] == this._currentEditor)
                     {
                         this._currentSheet = this._currentEditor.GetExpressionEditorSheet(binding.Expression, base.ServiceProvider);
                     }
                 }
                 if (this._currentSheet == null)
                 {
                     this._currentSheet = this._currentEditor.GetExpressionEditorSheet(string.Empty, base.ServiceProvider);
                 }
                 this._currentNode.IsValid = this._currentSheet.IsValid;
             }
         }
         this.SaveCurrentExpressionBinding();
         this._expressionBuilderPropertyGrid.SelectedObject = this._currentSheet;
         this.UpdateUIState();
     }
 }
        public SqlDataSourceDataConnectionChooserPanel(SqlDataSourceDesigner sqlDataSourceDesigner, IDataEnvironment dataEnvironment) : base(sqlDataSourceDesigner)
        {
            this._sqlDataSourceDesigner = sqlDataSourceDesigner;
            this._sqlDataSource         = (SqlDataSource)this._sqlDataSourceDesigner.Component;
            this._dataEnvironment       = dataEnvironment;
            this.InitializeComponent();
            this.InitializeUI();
            DesignerDataConnection conn    = new DesignerDataConnection(System.Design.SR.GetString("SqlDataSourceDataConnectionChooserPanel_CustomConnectionName"), this._sqlDataSource.ProviderName, this._sqlDataSource.ConnectionString);
            ExpressionBinding      binding = this._sqlDataSource.Expressions["ConnectionString"];

            if ((binding != null) && string.Equals(binding.ExpressionPrefix, "ConnectionStrings", StringComparison.OrdinalIgnoreCase))
            {
                string expression = binding.Expression;
                string str2       = "." + "ConnectionString".ToLowerInvariant();
                if (expression.ToLowerInvariant().EndsWith(str2, StringComparison.Ordinal))
                {
                    expression = expression.Substring(0, expression.Length - str2.Length);
                }
                ICollection connections = this._dataEnvironment.Connections;
                if (connections != null)
                {
                    foreach (DesignerDataConnection connection2 in connections)
                    {
                        if (connection2.IsConfigured && string.Equals(connection2.Name, expression, StringComparison.OrdinalIgnoreCase))
                        {
                            conn = connection2;
                            break;
                        }
                    }
                }
            }
            this.SetConnectionSettings(conn);
        }
        private void OnGetUIValueItem(ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList)
        {
            Control instance = context.Instance as Control;

            if (instance != null)
            {
                IDataBindingsAccessor accessor = instance;
                if (accessor.HasDataBindings && (accessor.DataBindings[propDesc.Name] != null))
                {
                    valueUIItemList.Add(new DataBindingUIItem());
                }
                IExpressionsAccessor accessor2 = instance;
                if (accessor2.HasExpressions)
                {
                    ExpressionBinding binding2 = accessor2.Expressions[propDesc.Name];
                    if (binding2 != null)
                    {
                        if (binding2.Generated)
                        {
                            valueUIItemList.Add(new ImplicitExpressionUIItem());
                        }
                        else
                        {
                            valueUIItemList.Add(new ExpressionBindingUIItem());
                        }
                    }
                }
            }
        }
 public BindablePropertyNode(System.ComponentModel.PropertyDescriptor propDesc, ExpressionBinding binding)
 {
     this._binding   = binding;
     this._propDesc  = propDesc;
     this._isValid   = true;
     base.Text       = propDesc.Name;
     base.ImageIndex = base.SelectedImageIndex = this.IsBound ? (this.IsGenerated ? 2 : 1) : 0;
 }
        // Merge duplicate values of a report control's data.
        public void MergeByValue()
        {
            ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Text", "[CategoryName]");

            this.xrTableCell2.ExpressionBindings.Add(expressionBinding);
            this.xrTableCell2.ProcessDuplicatesMode   = ProcessDuplicatesMode.Merge;
            this.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Value;
            this.ShowPreviewDialog();
        }
        // Merge duplicate values of the XRControl.Tag property.
        public void MergeByTag()
        {
            ExpressionBinding expressionBinding = new ExpressionBinding("BeforePrint", "Tag", "ToStr([SupplierID]) + '_' + ToStr([CategoryID])");

            this.xrTableCell2.ExpressionBindings.Add(expressionBinding);
            this.xrTableCell2.ProcessDuplicatesMode   = ProcessDuplicatesMode.Merge;
            this.xrTableCell2.ProcessDuplicatesTarget = DevExpress.XtraReports.UI.ProcessDuplicatesTarget.Tag;
            this.ShowPreviewDialog();
        }
        private void OnBindablePropsTreeAfterSelect(object sender, TreeViewEventArgs e)
        {
            BindablePropertyNode selectedNode = (BindablePropertyNode)this._bindablePropsTree.SelectedNode;

            if (this._currentNode != selectedNode)
            {
                this._currentNode = selectedNode;
                if ((this._currentNode != null) && this._currentNode.IsBound)
                {
                    ExpressionBinding binding = this._currentNode.Binding;
                    if (!this._currentNode.IsGenerated)
                    {
                        ExpressionEditor editor = (ExpressionEditor)this._expressionEditors[binding.ExpressionPrefix];
                        if (editor == null)
                        {
                            UIServiceHelper.ShowMessage(base.ServiceProvider, System.Design.SR.GetString("ExpressionBindingsDialog_UndefinedExpressionPrefix", new object[] { binding.ExpressionPrefix }), System.Design.SR.GetString("ExpressionBindingsDialog_Text", new object[] { this.Control.Site.Name }), MessageBoxButtons.OK);
                            editor = new GenericExpressionEditor();
                        }
                        this._currentEditor  = editor;
                        this._currentSheet   = this._currentEditor.GetExpressionEditorSheet(binding.Expression, base.ServiceProvider);
                        this._internalChange = true;
                        try
                        {
                            foreach (ExpressionItem item in this._expressionBuilderComboBox.Items)
                            {
                                if (string.Equals(item.ToString(), binding.ExpressionPrefix, StringComparison.OrdinalIgnoreCase))
                                {
                                    this._expressionBuilderComboBox.SelectedItem = item;
                                }
                            }
                            this._currentNode.IsValid = this._currentSheet.IsValid;
                        }
                        finally
                        {
                            this._internalChange = false;
                        }
                    }
                }
                else
                {
                    this._expressionBuilderComboBox.SelectedItem = this.NoneItem;
                    this._currentEditor = null;
                    this._currentSheet  = null;
                }
                this._expressionBuilderPropertyGrid.SelectedObject = this._currentSheet;
                this.UpdateUIState();
            }
        }
        private static DesignerDataConnection GetCurrentConnection(System.Web.UI.Control control, string propertyName, string connectionString, string expressionPrefix)
        {
            ExpressionBinding binding = ((IExpressionsAccessor)control).Expressions[propertyName];
            string            str     = "." + "ConnectionString".ToLowerInvariant();

            if ((binding != null) && string.Equals(binding.ExpressionPrefix, expressionPrefix, StringComparison.OrdinalIgnoreCase))
            {
                string expression = binding.Expression;
                if (expression.ToLowerInvariant().EndsWith(str, StringComparison.Ordinal))
                {
                    expression.Substring(0, expression.Length - str.Length);
                }
                return(new DesignerDataConnection(binding.Expression, string.Empty, connectionString, true));
            }
            return(new DesignerDataConnection(string.Empty, string.Empty, connectionString, false));
        }
Esempio n. 9
0
        public LinkInpu()
        {
            var m = Manager.GetAPI("VirtKlapany", new Guid("{0BDF2636-CF7F-42D3-AF39-7801EDAFEFD5}"));

            _chan             = m.JoinChannel("IO_KLAPANS", null);
            _chan.SyncReceive = true;
            //_rcvchannel = new SyncChannel(m.JoinChannel("MODEL_TO_KLAPANY", null));

            _dt = new DispatcherTimer(TimeSpan.FromMilliseconds(50), DispatcherPriority.Normal, OnTimer, Dispatcher.CurrentDispatcher);
            _dt.Start();

            var repos = ModelVariableRepository.Instance;

            ExpressionBinding.SetBinding(repos.BoolFMSValues[1], BoolVarFMS.VaRStateBoolPropertyFMS, "__FMS_WD_INPU1_LOADED");
            ExpressionBinding.SetBinding(repos.BoolFMSValues[0], BoolVarFMS.VaRStateBoolPropertyFMS, "__FMS_WD_INPU2_LOADED");
        }
 private void SaveCurrentExpressionBinding()
 {
     if (this._expressionBuilderComboBox.SelectedItem == this.NoneItem)
     {
         this._currentNode.Binding = null;
         this._currentNode.IsValid = true;
     }
     else
     {
         string             expression         = this._currentSheet.GetExpression();
         PropertyDescriptor propertyDescriptor = this._currentNode.PropertyDescriptor;
         ExpressionBinding  binding            = new ExpressionBinding(propertyDescriptor.Name, propertyDescriptor.PropertyType, this._expressionBuilderComboBox.SelectedItem.ToString(), expression);
         this._currentNode.Binding = binding;
         this._currentNode.IsValid = this._currentSheet.IsValid;
     }
     this._bindingsDirty = true;
 }
Esempio n. 11
0
        public static void CreateReport(XtraReport report, string[] fields)
        {
            PageHeaderBand pageHeader = new PageHeaderBand()
            {
                HeightF = 23, Name = "pageHeaderBand"
            };
            int     tableWidth  = report.PageWidth - report.Margins.Left - report.Margins.Right;
            XRTable headerTable = XRTable.CreateTable(
                new Rectangle(0,                    // rect X
                              0,                    // rect Y
                              tableWidth,           // width
                              40),                  // height
                1,                                  // table row count
                0);                                 // table column count

            headerTable.Borders             = DevExpress.XtraPrinting.BorderSide.All;
            headerTable.BackColor           = Color.Gainsboro;
            headerTable.Font                = new Font("Verdana", 10, FontStyle.Bold);
            headerTable.Rows.FirstRow.Width = tableWidth;
            headerTable.BeginInit();
            foreach (string field in fields)
            {
                XRTableCell cell = new XRTableCell();
                cell.Width         = 100;
                cell.Text          = field;
                cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleCenter;
                headerTable.Rows.FirstRow.Cells.Add(cell);
            }
            headerTable.EndInit();
            headerTable.AdjustSize();
            pageHeader.Controls.Add(headerTable);



            DetailBand detail = new DetailBand()
            {
                HeightF = 23, Name = "detailBand"
            };
            XRTable detailTable = XRTable.CreateTable(
                new Rectangle(0,                // rect X
                              0,                // rect Y
                              tableWidth,       // width
                              40),              // height
                1,                              // table row count
                0);                             // table column count



            detailTable.Width = tableWidth;
            detailTable.Rows.FirstRow.Width = tableWidth;
            detailTable.Borders             = DevExpress.XtraPrinting.BorderSide.Left | DevExpress.XtraPrinting.BorderSide.Right | DevExpress.XtraPrinting.BorderSide.Bottom;
            detailTable.BeginInit();
            foreach (string field in fields)
            {
                XRTableCell       cell    = new XRTableCell();
                ExpressionBinding binding = new ExpressionBinding("BeforePrint", "Text", String.Format("[{0}]", field));
                cell.ExpressionBindings.Add(binding);
                cell.Width         = 100;
                cell.TextAlignment = DevExpress.XtraPrinting.TextAlignment.MiddleLeft;
                if (field.Contains("Date"))
                {
                    cell.TextFormatString = "{0:MM/dd/yyyy}";
                }
                detailTable.Rows.FirstRow.Cells.Add(cell);
            }
            detailTable.Font = new Font("Verdana", 8F);
            detailTable.EndInit();
            detailTable.AdjustSize();
            detail.Controls.Add(detailTable);
            report.Bands.AddRange(new Band[] { detail, pageHeader });
        }
    public TestReport(string tableName)
    {
        InitializeComponent();
        //
        // TODO: Add constructor logic here
        //

        this.Bands.Add(new PageHeaderBand());

        DevExpress.DataAccess.Sql.SqlDataSource dataSource = new DevExpress.DataAccess.Sql.SqlDataSource("nwind");
        string queryString = string.Format("SELECT * FROM {0}", tableName);

        DevExpress.DataAccess.Sql.SelectQuery parameterQuery = DevExpress.DataAccess.Sql.SelectQueryFluentBuilder
                                                               .AddTable(tableName)
                                                               .SelectAllColumns()
                                                               .Build(tableName);
        dataSource.Queries.Add(parameterQuery);
        dataSource.RebuildResultSchema();
        dataSource.Fill();
        int rowCount = ((IList)dataSource.Result[tableName]).Count;

        XRLabel label = new XRLabel();

        label.Width = 500;
        label.Font  = new System.Drawing.Font("Verdana", 10F, FontStyle.Bold);
        this.Bands[BandKind.PageHeader].Controls.Add(label);

        if (rowCount > 0)
        {
            int padding    = 10;
            int tableWidth = this.PageWidth - this.Margins.Left - this.Margins.Right - padding * 2;

            XRTable dynamicTable = XRTable.CreateTable(
                new Rectangle(padding,                    // rect X
                              2,                          // rect Y
                              tableWidth,                 // width
                              40),                        // height
                1,                                        // table row count
                0);                                       // table column count

            dynamicTable.Width = tableWidth;
            dynamicTable.Rows.FirstRow.Width = tableWidth;
            dynamicTable.Borders             = DevExpress.XtraPrinting.BorderSide.All;
            dynamicTable.BorderWidth         = 1;

            dynamicTable.BeginInit();
            foreach (DevExpress.DataAccess.Sql.DataApi.IColumn dc in dataSource.Result[tableName].Columns)
            {
                XRTableCell cell = new XRTableCell();

                ExpressionBinding binding = new ExpressionBinding("BeforePrint", "Text", dc.Name);
                cell.ExpressionBindings.Add(binding);
                cell.CanGrow = false;
                cell.Width   = 100;
                cell.Text    = dc.Name;
                dynamicTable.Rows.FirstRow.Cells.Add(cell);
            }
            dynamicTable.Font = new System.Drawing.Font("Verdana", 8F);
            dynamicTable.EndInit();
            Detail.Controls.Add(dynamicTable);

            label.Text = string.Format("Data table: {0}", tableName);

            this.DataSource = dataSource;
            this.DataMember = tableName;
        }
        else
        {
            label.Text = string.Format("There's no data to display or the table doesn't exist.");
        }
    }
Esempio n. 13
0
 // Methods
 public void Add(ExpressionBinding binding)
 {
 }
Esempio n. 14
0
 public void Remove(ExpressionBinding binding)
 {
 }
	public void CopyTo(ExpressionBinding[] array, int index) {}
        private void LoadBindableProperties()
        {
            PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this.Control, BindablePropertiesFilter);
            string             name            = null;
            PropertyDescriptor defaultProperty = TypeDescriptor.GetDefaultProperty(this.Control);

            if (defaultProperty != null)
            {
                name = defaultProperty.Name;
            }
            TreeNodeCollection          nodes       = this._bindablePropsTree.Nodes;
            ExpressionBindingCollection expressions = ((IExpressionsAccessor)this.Control).Expressions;
            Hashtable hashtable = new Hashtable(StringComparer.OrdinalIgnoreCase);

            foreach (ExpressionBinding binding in expressions)
            {
                hashtable[binding.PropertyName] = binding;
            }
            TreeNode node = null;

            foreach (PropertyDescriptor descriptor2 in properties)
            {
                if (string.Compare(descriptor2.Name, "ID", StringComparison.OrdinalIgnoreCase) != 0)
                {
                    ExpressionBinding binding2 = null;
                    if (hashtable.Contains(descriptor2.Name))
                    {
                        binding2 = (ExpressionBinding)hashtable[descriptor2.Name];
                        hashtable.Remove(descriptor2.Name);
                    }
                    TreeNode node2 = new BindablePropertyNode(descriptor2, binding2);
                    if (descriptor2.Name.Equals(name, StringComparison.OrdinalIgnoreCase))
                    {
                        node = node2;
                    }
                    nodes.Add(node2);
                }
            }
            this._complexBindings = hashtable;
            if ((node == null) && (nodes.Count != 0))
            {
                int count = nodes.Count;
                for (int i = 0; i < count; i++)
                {
                    BindablePropertyNode node3 = (BindablePropertyNode)nodes[i];
                    if (node3.IsBound)
                    {
                        node = node3;
                        break;
                    }
                }
                if (node == null)
                {
                    node = nodes[0];
                }
            }
            if (node != null)
            {
                this._bindablePropsTree.SelectedNode = node;
            }
        }
	// Methods
	public void Add(ExpressionBinding binding) {}
	public void Remove(ExpressionBinding binding) {}