private void FillGridOld() { _listDbmMethodsGridOld = DbmMethodsForGridHelper(isHidden: false, isOld: true); //Add the hidden methods if needed if (checkShowHidden.Checked) { _listDbmMethodsGridOld.AddRange(DbmMethodsForGridHelper(isHidden: true, isOld: true)); //Adding hidden methods will cause the list to no longer be ordered by name _listDbmMethodsGridOld.Sort(new MethodInfoComparer()); } gridOld.BeginUpdate(); gridOld.ListGridColumns.Clear(); gridOld.ListGridColumns.Add(new GridColumn(Lan.g(this, "Name"), 300)); gridOld.ListGridColumns.Add(new GridColumn(Lan.g(this, "Hidden"), 45, HorizontalAlignment.Center)); gridOld.ListGridColumns.Add(new GridColumn(Lan.g(this, BREAKDOWN_COLUMN_NAME), 40, HorizontalAlignment.Center)); gridOld.ListGridColumns.Add(new GridColumn(Lan.g(this, RESULTS_COLUMN_NAME), 0)); gridOld.ListGridRows.Clear(); GridRow row; for (int i = 0; i < _listDbmMethodsGridOld.Count; i++) { bool isMethodHidden = _listDatabaseMaintenances.Any(x => x.MethodName == _listDbmMethodsGridOld[i].Name && x.IsHidden); row = new GridRow(); row.Cells.Add(_listDbmMethodsGridOld[i].Name); row.Cells.Add(isMethodHidden ? "X" : ""); row.Cells.Add(DatabaseMaintenances.MethodHasBreakDown(_listDbmMethodsGridOld[i]) ? "X" : ""); row.Cells.Add(""); row.Tag = _listDbmMethodsGridOld[i]; gridOld.ListGridRows.Add(row); } gridOld.EndUpdate(); }
///<summary>Updates the result column for the specified row in gridMain with the text passed in.</summary> private void UpdateResultTextForRow(int index, string text) { gridMain.BeginUpdate(); //Checks to see if it has a breakdown, and if it needs any maintenenece to decide whether or not to apply the "X" if (!DatabaseMaintenances.MethodHasBreakDown(_listDbmMethodsGrid[index]) || text == "Done. No maintenance needed.") { gridMain.Rows[index].Cells[1].Text = ""; } else { gridMain.Rows[index].Cells[1].Text = "X"; } gridMain.Rows[index].Cells[2].Text = text; gridMain.EndUpdate(); Application.DoEvents(); }
///<summary>Updates the result column for the specified row in the grid with the text passed in.</summary> private void UpdateResultTextForRow(int index, string text, ODGrid gridCur) { int breakdownIndex = gridCur.ListGridColumns.GetIndex(BREAKDOWN_COLUMN_NAME); int resultsIndex = gridCur.ListGridColumns.GetIndex(RESULTS_COLUMN_NAME); gridCur.BeginUpdate(); //Checks to see if it has a breakdown, and if it needs any maintenance to decide whether or not to apply the "X" if (!DatabaseMaintenances.MethodHasBreakDown((MethodInfo)gridCur.ListGridRows[index].Tag) || text == "Done. No maintenance needed.") { gridCur.ListGridRows[index].Cells[breakdownIndex].Text = ""; } else { gridCur.ListGridRows[index].Cells[breakdownIndex].Text = "X"; } gridCur.ListGridRows[index].Cells[resultsIndex].Text = text; gridCur.EndUpdate(); Application.DoEvents(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { MethodInfo method = _listDbmMethodsGrid[e.Row]; if (!DatabaseMaintenances.MethodHasBreakDown(method)) { return; } //We know that this method supports giving the user a break down and shall call the method's fix section where the break down results should be. //TODO: Make sure that DBM methods with break downs ALWAYS have the break down in the fix section. if (_patNum < 1) { MsgBox.Show(this, "Select a patient first."); return; } DbmMethodAttr methodAttributes = (DbmMethodAttr)Attribute.GetCustomAttribute(method, typeof(DbmMethodAttr)); //We always send verbose and modeCur into all DBM methods. List <object> parameters = new List <object>() { checkShow.Checked, DbmMode.Breakdown }; //There are optional paramaters available to some methods and adding them in the following order is very important. if (methodAttributes.HasPatNum) { parameters.Add(_patNum); } Cursor = Cursors.WaitCursor; string result = (string)method.Invoke(null, parameters.ToArray()); if (result == "") //Only possible if running a check / fix in non-verbose mode and nothing happened or needs to happen. { result = Lan.g("FormDatabaseMaintenance", "Done. No maintenance needed."); } SaveLogToFile(method.Name + ":\r\n" + result); //Show the result of the dbm method in a simple copy paste msg box. MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(result); Cursor = Cursors.Default; msgBoxCP.Show(); //Let this window be non-modal so that they can keep it open while they fix their problems. }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.Columns.Clear(); gridMain.Columns.Add(new ODGridColumn(Lan.g(this, "Name"), 300)); gridMain.Columns.Add(new ODGridColumn(Lan.g(this, "Break\r\nDown"), 40, HorizontalAlignment.Center)); gridMain.Columns.Add(new ODGridColumn(Lan.g(this, "Results"), 0)); gridMain.Rows.Clear(); ODGridRow row; //_listDbmMethodsGrid has already been filled on load with the correct methods to display in the grid. foreach (MethodInfo meth in _listDbmMethodsGrid) { row = new ODGridRow(); row.Cells.Add(meth.Name); row.Cells.Add(DatabaseMaintenances.MethodHasBreakDown(meth) ? "X" : ""); row.Cells.Add(""); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FillGrid() { _listDbmMethodsGrid = DbmMethodsForGridHelper(isHidden: false, isOld: false); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Name"), 300)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, BREAKDOWN_COLUMN_NAME), 40, HorizontalAlignment.Center)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, RESULTS_COLUMN_NAME), 0)); gridMain.ListGridRows.Clear(); GridRow row; //_listDbmMethodsGrid has already been filled on load with the correct methods to display in the grid. foreach (MethodInfo meth in _listDbmMethodsGrid) { row = new GridRow(); row.Cells.Add(meth.Name); row.Cells.Add(DatabaseMaintenances.MethodHasBreakDown(meth) ? "X" : ""); row.Cells.Add(""); row.Tag = meth; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }