private void ResetDataInTreeView() { c1TreeView1.Columns.Clear(); c1TreeView1.BindingInfo.DataSource = null; c1TreeView1.BindingInfo.DataMember = "\\ProductsGroups\\Products"; var column = new C1TreeColumn(); column.HeaderText = "Name"; c1TreeView1.Columns.Add(column); column = new C1TreeColumn(); column.DisplayFieldName = "CountOfProducts"; column.HeaderText = "Products in store"; column.AutoWidth = false; column.Width = 100; c1TreeView1.Columns.Add(column); column = new C1TreeColumn(); column.DisplayFieldName = "\\\\Price"; column.HeaderText = "Price"; column.Width = 200; c1TreeView1.Columns.Add(column); c1TreeView1.BindingInfo.DataSource = StoreCollection.GetData(); c1TreeView1.Nodes[0].Images.Add(0); c1TreeView1.Nodes[1].Images.Add(1); c1TreeView1.Nodes[2].Images.Add(2); }
private void Initialize() { c1Ribbon1.SelectedTabIndex = 1; foreach (var theme in C1ThemeController.GetThemes()) { ribbonCmbThemes.Items.Add(theme); } // init TreeView c1TreeView1.Columns.Clear(); c1TreeView1.DataSource = null; c1TreeView1.DataMember = "\\ProductsGroups\\Products"; var column = new C1TreeColumn { HeaderText = "Name" }; c1TreeView1.Columns.Add(column); column = new C1TreeColumn { DisplayFieldName = "\\\\Count", HeaderText = "Count", Width = 100 }; c1TreeView1.Columns.Add(column); column = new C1TreeColumn { DisplayFieldName = "\\\\Price", HeaderText = "Price", Width = 200 }; c1TreeView1.Columns.Add(column); c1TreeView1.DataSource = StoreCollection.GetData(); c1TreeView1.ExpandAll(); // init ExpressionEditor c1ExpressionEditor1.IntelliAutoCompletionEnabled = false; var ce = new ExpressionEditorCustomEngine.CustomEngine(); var cl = new CustomLexer(); c1ExpressionEditor1.SetCustomEngine(ce, cl); c1ExpressionEditor1.DataSource = c1TreeView1.DataSource; c1ExpressionEditor1.Expression = "[ProductsGroups].Where(x => x.Name == \"Notebooks\").Sum(x => x.Products.Sum(p => p.Count))"; var p = new CustomPresenter(); CustomPresenter.Editor = c1ExpressionEditor1; c1TreeView1.Columns[1].CustomContentPresenter = p; }
private void btnAddNewColumn_Click(object sender, EventArgs e) { var addForm = new AddNewColumnForm(); if (addForm.ShowDialog() == DialogResult.OK) { var column = new C1TreeColumn(); column.Name = addForm.ColumnName; column.HeaderText = addForm.ColumnHeaderText; column.DisplayFieldName = addForm.ColumnDisplayFieldName; c1TreeView1.Columns.Add(column); ResetColumnsInCombobox(); } }
private void GenerateTreeView() { c1TreeView1.Columns.Clear(); c1TreeView1.Nodes.Clear(); for (var i = 0; i < nudColumnsCount.Value; i++) { var column = new C1TreeColumn(); column.HeaderText = string.Format("Column {0}", i); column.AutoWidth = false; column.Width = 200; c1TreeView1.Columns.Add(column); } for (var i = 0; i < nudRootNodesCount.Value; i++) { var node = new C1TreeNode(string.Format("Node 0.{0}", i)); c1TreeView1.Nodes.Add(node); GenerateChildNodes(node); node.Collapse(true); } }
private void SetupTreeView() { c1TreeView1.DataMember = "\\Companies\\Products"; C1TreeColumn column = c1TreeView1.Columns[0]; column.HeaderText = "Name"; column = new C1TreeColumn(); column.DisplayFieldName = string.Format("\\\\Quantity"); column.HeaderText = "Quantity"; column.AutoWidth = false; column.Width = 50; c1TreeView1.Columns.Add(column); column = new C1TreeColumn(); column.DisplayFieldName = string.Format("\\\\Price"); column.HeaderText = "Price"; column.Width = 200; c1TreeView1.Columns.Add(column); c1TreeView1.DataSource = GetProducts(); c1TreeView1.ApplyNodeStyles += C1TreeView1_ApplyNodeStyles; }
private async void BtnConnect_Click(object sender, EventArgs e) { var oldCur = this.Cursor; try { this.Cursor = Cursors.WaitCursor; if (_connectionBase != null && _connectionBase.State != ConnectionState.Closed) { _connectionBase.Close(); } var selectedIndex = cboSource.SelectedIndex; switch (selectedIndex) { case 0: _connectionBase = new C1ODataConnection(_connStringBuilder as C1ODataConnectionStringBuilder); txtSQL.Text = DEFAULT_ODATA_SQL_STRING; break; case 1: _connectionBase = new C1D365SConnection(_connStringBuilder as C1D365SConnectionStringBuilder); break; case 2: _connectionBase = new C1SalesforceConnection(_connStringBuilder as C1SalesforceConnectionStringBuilder); break; case 3: _connectionBase = new C1KintoneConnection(_connStringBuilder as C1KintoneConnectionStringBuilder); break; case 4: _connectionBase = new C1QuickBooksOnlineConnection(_connStringBuilder as C1QuickBooksOnlineConnectionStringBuilder); break; case 5: _connectionBase = new C1GoogleAnalyticsConnection(_connStringBuilder as C1GoogleAnalyticsConnectionStringBuilder); break; } if (string.IsNullOrEmpty(_connectionBase.ConnectionString)) { throw new Exception("Connection string can’t be empty, please enter valid connection string"); } await _connectionBase.OpenAsync(); if (selectedIndex != -1) { //Populating TreeView var tables = _connectionBase.GetSchema("Tables").DefaultView; BindingList <SchemaTable> schemaSet = new BindingList <SchemaTable>(); for (int i = 0; i < tables.Count; i++) { var sTable = new SchemaTable(tables[i][0].ToString()); var columns = _connectionBase.GetSchema("columns", new string[] { sTable.Name }).DefaultView; for (int j = 0; j < columns.Count; j++) { sTable.Columns.Add(new SchemaColumn(columns[j][0].ToString())); } schemaSet.Add(sTable); } tvSchema.Columns.Clear(); tvSchema.BindingInfo.DataSource = null; tvSchema.BindingInfo.DataMember = "\\Columns"; var column = new C1TreeColumn(); column.HeaderText = "Name"; column.AutoWidth = true; tvSchema.Columns.Add(column); tvSchema.BindingInfo.DataSource = schemaSet; } } catch (Exception ex) { MessageBox.Show($"Error: {ex.Message}"); } finally { this.Cursor = oldCur; } }