void ReleaseDesignerOutlets() { if (AppointmentDateLabel != null) { AppointmentDateLabel.Dispose(); AppointmentDateLabel = null; } if (CancelButton != null) { CancelButton.Dispose(); CancelButton = null; } if (DataTableView != null) { DataTableView.Dispose(); DataTableView = null; } if (DoctorNameLabel != null) { DoctorNameLabel.Dispose(); DoctorNameLabel = null; } }
public ListPage(Notebook notebook, ModulesTreeInfo module) { this.notebook = notebook; this.module = module; headerbox = new HBox(); headerlabel = new Label(module.Text); headerbox.PackStart(headerlabel); //Image img = new Image("gtk-close", IconSize.Menu); close_img = ImageManager.GetImage("Images.close-button.png"); //close_img = new Image("gtk-close", IconSize.Menu); btnCloseTab = new Button(close_img); btnCloseTab.BorderWidth = 0; btnCloseTab.Relief = ReliefStyle.None; //btnCloseTab.WidthRequest = 19; //btnCloseTab.HeightRequest = 19; btnCloseTab.Clicked += delegate { this.Dispose(); }; headerbox.PackStart(btnCloseTab); headerbox.ShowAll(); tableview = new DataTableView(module); this.Add(tableview); this.ShowAll(); notebook.AppendPage(this, headerbox); notebook.SetTabReorderable(this, true); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); _dataTable = view.FindViewById <DataTableView>(Resource.Id.table); var tableMapping = DBAccess.GetMapping(typeof(Country)); _dataTable.TableName = tableMapping.TableName; _dataTable.SetColumnNames(tableMapping.Columns.Select(c => c.Name)); _dataTable.SetQueryPreparedListener(this); _dataTable.SetMultiChoiceModeListener(this); _dataTable.ItemClick += (s, e) => { Activity.FragmentManager.BeginTransaction() .AddToBackStack(null) .Replace(Resource.Id.frame_layout, CountryRowFragment.Instantiate(e.Row.ID)) .Commit(); }; _dataTable.LoadData(); var addButton = view.FindViewById <FloatingActionButton>(Resource.Id.fab_add); addButton.Click += (s, e) => { Activity.FragmentManager.BeginTransaction() .AddToBackStack(null) .Replace(Resource.Id.frame_layout, CountryRowFragment.Instantiate()) .Commit(); }; }
private void Vlist_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { string sql = Vlist.Text, name = "expression" + ++counter; DataTableView dtv = FindView(sql); if (dtv != null) { dtv.Exit(); } if (sql.StartsWith("#")) { dtv = new DataTableView(sql, DBControl.Schema(sql.Substring(1))); } else { dtv = new DataTableView(sql, DBControl.Adapter(sql), access); } if (dtv.IsDisposed) { return; } dtv.Disposed += dtv_Disposed; tabFormControl1.AddTab(sql, -1, dtv); } }
/// <summary> /// 设备数据点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DeviceData(object sender, RoutedEventArgs e) { //添加设备数据图表 UserChartsList = new DataCharts(); //添加设备信息页的告警信息 UserWarningList = new DataTableView(); }
public DataTableView AddView(string name, string sql) { if (sql == null) { return(null); } var adapter = DBControl.Adapter(sql); var dtv = new DataTableView(name, adapter, access); tabFormControl1.AddTab(name, img, dtv); return(dtv); }
private void AddDataTableToTableLayout(DataTableView dataTable, int row, int col) { if (dataTable == null) { // dummy panel for empty field Panel p = new Panel { Dock = DockStyle.Fill }; tableLayoutPanel.Controls.Add(p, col, row); } else { dataTable.Dock = DockStyle.Fill; tableLayoutPanel.Controls.Add(dataTable, col, row); } }
protected override IEnumerable <DataTableView> GetVisibleDataTables() { if (Content.AllInOneMode) { if (allInOneDataTableView == null) { allInOneDataTableView = new DataTableView() { Content = allInOneDataTable, ShowChartOnly = true } } ; return(new[] { allInOneDataTableView }); } return(base.GetVisibleDataTables()); }
void ReleaseDesignerOutlets() { if (DataTableView != null) { DataTableView.Dispose(); DataTableView = null; } if (HelpButton != null) { HelpButton.Dispose(); HelpButton = null; } if (NoDataView != null) { NoDataView.Dispose(); NoDataView = null; } }
//open histogram in new tab with new content when double clicked private void HistogramDoubleClick(object sender, EventArgs e) { DataTableView pcv = (DataTableView)sender; HistogramContent histoContent = new HistogramContent(Content.PreprocessingData); // create new content //ToDo: histoContent.VariableItemList = Content.CreateVariableItemList(); var dataTable = pcv.Content; //Set variable item list from with variable from data table if (dataTable.Rows.Count == 1) // only one data row should be in data table { string variableName = dataTable.Rows.ElementAt(0).Name; // set only variable name checked foreach (var checkedItem in histoContent.VariableItemList) { histoContent.VariableItemList.SetItemCheckedState(checkedItem, checkedItem.Value == variableName); } } MainFormManager.MainForm.ShowContent(histoContent, typeof(HistogramView)); // open in new tab }
public async Task <DataTableView> Get(string uid, int status, string keyword, int page, int size) { using (var sql = new SqlConnection(connectionString.Value)) { sp = "SP_DataTableServerSide"; var offset = (page - 1) * size; parameters.Add("Offset", offset); parameters.Add("PageSize", size); parameters.Add("UserId", uid); parameters.Add("Status", status); parameters.Add("Keyword", keyword); parameters.Add("@length", DbType.Int32, direction: ParameterDirection.Output); parameters.Add("@filterLength", DbType.Int32, direction: ParameterDirection.Output); var result = new DataTableView(); result.data = await sql.QueryAsync <ActivityVM>(sp, parameters, commandType : spType); result.length = parameters.Get <int>("@length"); result.filterLength = parameters.Get <int>("@filterLength"); return(result); } }
void ReleaseDesignerOutlets() { if (ChatDialogTableView != null) { ChatDialogTableView.Dispose(); ChatDialogTableView = null; } if (ChatPageTitleLabel != null) { ChatPageTitleLabel.Dispose(); ChatPageTitleLabel = null; } if (ComposeMessageViewBottomConstraint != null) { ComposeMessageViewBottomConstraint.Dispose(); ComposeMessageViewBottomConstraint = null; } if (DataTableView != null) { DataTableView.Dispose(); DataTableView = null; } if (MessageComposeField != null) { MessageComposeField.Dispose(); MessageComposeField = null; } if (SendButton != null) { SendButton.Dispose(); SendButton = null; } }
/// <summary> /// 将指定表格导出为Excel文件 /// </summary> /// <param name="gridView">DataGridView</param> /// <param name="onlySelected">是否仅选中内容</param> /// <param name="fileName">Excel文件名</param> /// <returns>是否成功</returns> public static bool ExportExcelFile(DataTableView gridView, bool onlySelected, string fileName) { if (gridView == null || string.IsNullOrEmpty(fileName) || gridView.Rows.Count <= 0 || gridView.Columns.Count <= 0) { return(false); } int rowCount = gridView.RowCount, startRow = 0, endRow = rowCount - 1; int columnCount = gridView.ColumnCount, startColumn = 0, endColumn = columnCount - 1; if (onlySelected) { if (gridView.SelectionMode == DataGridViewSelectionMode.FullRowSelect) { if (gridView.SelectedRows.Count <= 0) { return(false); } startRow = gridView.SelectedRows[gridView.SelectedRows.Count - 1].Index; endRow = gridView.SelectedRows[0].Index; if (startRow > endRow) { startRow = gridView.SelectedRows[0].Index; endRow = gridView.SelectedRows[gridView.SelectedRows.Count - 1].Index; } rowCount = endRow - startRow + 1; } else if (gridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect) { if (gridView.SelectedColumns.Count <= 0) { return(false); } startColumn = gridView.SelectedColumns[gridView.SelectedColumns.Count - 1].Index; endColumn = gridView.SelectedColumns[0].Index; if (startColumn > endColumn) { startColumn = gridView.SelectedColumns[0].Index; endColumn = gridView.SelectedColumns[gridView.SelectedColumns.Count - 1].Index; } columnCount = endColumn - startColumn + 1; } } ExcelCotnent content = GetTempletContent(); if (content == null || content.WorkbookContent == null || content.WorksheetsContent == null || content.SharedStringsContent == null) { return(false); } WriteWorksheetName(content, GlobalMethods.IO.GetFileName(fileName, false)); XmlNode columnsNode = GetColumnsNode(content); XmlNode rowsNode = GetRowsNode(content); XmlNode rowNode = null; int excelRowIndex = -1; //添加mergeCell if (gridView.Groups.Count > 0) { XmlElement groupsNode = content.WorksheetsContent.CreateElement("mergeCells", NamespaceUri); groupsNode.SetAttribute("count", gridView.Groups.Count.ToString()); for (int index = 0; index < gridView.Groups.Count; index++) { XmlElement groupNode = content.WorksheetsContent.CreateElement("mergeCell", NamespaceUri); string beginCellName = GetExcelCellName(0, gridView.Groups[index].BeginColumn); string endCellName = GetExcelCellName(0, gridView.Groups[index].EndColumn); groupNode.SetAttribute("ref", string.Format("{0}:{1}", beginCellName, endCellName)); groupsNode.AppendChild(groupNode); } content.WorksheetsContent.DocumentElement.InsertAfter(groupsNode, rowsNode); //添加首行表头 ++excelRowIndex; rowNode = WriteRowContent(content, rowsNode, excelRowIndex); for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { if (string.IsNullOrEmpty(gridView.Columns[columnIndex].Name)) { continue; } bool isGroupColumn = false; for (int groupIndex = 0; groupIndex < gridView.Groups.Count; groupIndex++) { int nBeginColumn = gridView.Groups[groupIndex].BeginColumn; int nEndColumn = gridView.Groups[groupIndex].EndColumn; string value = gridView.Groups[groupIndex].Text; if (columnIndex == nBeginColumn) { WriteCellContent(content, rowNode, excelRowIndex, columnIndex, columnCount, value, "3"); isGroupColumn = true; } else if (columnIndex > nBeginColumn && columnIndex <= nEndColumn) { WriteCellContent(content, rowNode, excelRowIndex, columnIndex, columnCount, string.Empty, "3"); isGroupColumn = true; } } if (!isGroupColumn) { WriteCellContent(content, rowNode, excelRowIndex, columnIndex, columnCount, string.Empty, "1"); } } } //添加第二表头 ++excelRowIndex; rowNode = WriteRowContent(content, rowsNode, excelRowIndex); for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { DataGridViewColumn column = gridView.Columns[startColumn + columnIndex]; string columnName = column.HeaderText; if (string.IsNullOrEmpty(columnName)) { columnName = string.Concat("Column", columnIndex + 1); } WriteColumnContent(content, columnsNode, columnIndex, columnName, column.Width + 24, "1"); WriteCellContent(content, rowNode, excelRowIndex, columnIndex, columnCount, columnName, "1"); } //添加数据行 ++excelRowIndex; for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) { DataGridViewRow row = gridView.Rows[startRow + rowIndex]; if (row.IsNewRow) { continue; } rowNode = WriteRowContent(content, rowsNode, excelRowIndex + rowIndex); for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) { DataGridViewColumn column = gridView.Columns[startColumn + columnIndex]; string value = row.Cells[column.Index].Value == null ? string.Empty : row.Cells[column.Index].Value.ToString(); WriteCellContent(content, rowNode, excelRowIndex + rowIndex, columnIndex, columnCount, value, "2"); } } return(SaveExcelFile(content, fileName)); }
private Control GetBody(string colVariable, string rowVariable) { var key = Tuple.Create(colVariable, rowVariable); if (!bodyCache.ContainsKey(key)) { if (rowVariable == colVariable) // use historgram if x and y variable are equal { var dataTable = HistogramContent.CreateHistogram( Content.PreprocessingData, rowVariable, (string)groupingComboBox.SelectedItem, (AggregationType)aggregationComboBox.SelectedItem, (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem); dataTable.VisualProperties.Title = string.Empty; foreach (var dataRow in dataTable.Rows) { dataRow.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0; } var pcv = new DataTableView { Name = key.ToString(), Content = dataTable, Dock = DockStyle.Fill, ShowChartOnly = true }; //pcv.ChartDoubleClick += HistogramDoubleClick; // ToDo: not working; double click is already handled by the chart bodyCache.Add(key, pcv); } else //scatter plot { var scatterPlot = ScatterPlotContent.CreateScatterPlot(Content.PreprocessingData, colVariable, rowVariable, (string)groupingComboBox.SelectedItem, (PreprocessingChartContent.LegendOrder)legendOrderComboBox.SelectedItem); var regressionType = (RegressionType)regressionTypeComboBox.SelectedValue; int order = (int)polynomialRegressionOrderNumericUpDown.Value; int i = 0; var colors = PreprocessingChartView.Colors; foreach (var row in scatterPlot.Rows) { row.VisualProperties.PointSize = (int)pointSizeNumericUpDown.Value; row.VisualProperties.Color = Color.FromArgb((int)(pointOpacityNumericUpDown.Value * 255), row.VisualProperties.Color.IsEmpty ? colors[i++ % colors.Length] : row.VisualProperties.Color); row.VisualProperties.IsVisibleInLegend = legendCheckbox.Checked && groupingComboBox.SelectedIndex > 0; row.VisualProperties.IsRegressionVisibleInLegend = false; row.VisualProperties.RegressionType = regressionType; row.VisualProperties.PolynomialRegressionOrder = order; } scatterPlot.VisualProperties.Title = string.Empty; var scatterPlotView = new ScatterPlotView { Name = key.ToString(), Content = scatterPlot, Dock = DockStyle.Fill, ShowName = false //ShowLegend = false, //XAxisFormat = "G3" }; //scatterPlotView.DoubleClick += ScatterPlotDoubleClick; // ToDo: not working; double click is already handled by the chart bodyCache.Add(key, scatterPlotView); } } return(bodyCache[key]); }