/// <summary> /// Orders the columns in a data table by their corresponding tab order /// </summary> /// <param name="table">The table whose columns should be re-ordered</param> /// <param name="view">The meta data from which to pull the tab order</param> public static void SortColumnsByTabOrder(DataTable table, View view) { Dictionary <string, int> columnNames = new Dictionary <string, int>(); int runningTabIndex = 0; columnNames.Add("UniqueKey", runningTabIndex); runningTabIndex++; columnNames.Add("GlobalRecordId", runningTabIndex); runningTabIndex++; columnNames.Add("RecStatus", runningTabIndex); runningTabIndex++; if (view.IsRelatedView) { columnNames.Add("FKEY", runningTabIndex); runningTabIndex++; } foreach (Page page in view.Pages) { SortedDictionary <double, string> fieldsOnPage = new SortedDictionary <double, string>(); foreach (Field field in page.Fields) { if (field is RenderableField && field is IDataField) { RenderableField renderableField = field as RenderableField; double tabIndex = renderableField.TabIndex; while (fieldsOnPage.ContainsKey(tabIndex)) { tabIndex = tabIndex + 0.1; } fieldsOnPage.Add(tabIndex, field.Name); } } foreach (KeyValuePair <double, string> kvp in fieldsOnPage) { columnNames.Add(kvp.Value, runningTabIndex); runningTabIndex++; } } int newRunningTabIndex = 0; // to prevent arg exceptions; TODO: Fix this better foreach (KeyValuePair <string, int> kvp in columnNames) { if (table.Columns.Contains(kvp.Key)) { table.Columns[kvp.Key].SetOrdinal(newRunningTabIndex); newRunningTabIndex++; } } }
private bool ShouldUseDefaultControlFont(RenderableField field) { if ((field.ControlFont == null) || ((field.ControlFont.Name == "Microsoft Sans Serif") && (field.ControlFont.Size == 8.5))) { return(true); } else { return(false); } }
/// <summary> /// Constructor of the Codes dialog /// </summary> /// <param name="frm">The main form</param> /// <param name="field">The field</param> /// <param name="currentPage">The current page</param> public ListDialog(MainForm frm, RenderableField field, Page currentPage) : base(frm, field, currentPage) { InitializeComponent(); page = currentPage; ddlField = (DDListField)field; codeTable = ddlField.GetSourceData(); this.Text = "List Field"; //cbxSort.Checked = ddlField.ShouldSort; fieldName = ddlField.Name; SetDataSource(ddlField); SetDgCodes(dgCodes, fieldName); }
private void SetControlProperties(Control control, RenderableField field, Size canvasSize) { control.Left = WinUtil.GetControlLeft(field, canvasSize.Width); control.Top = WinUtil.GetControlTop(field, canvasSize.Height); if (field.ControlHeightPercentage > 0) { control.Height = WinUtil.GetControlHeight(field, canvasSize.Height); } if (field.ControlWidthPercentage > 0) { control.Width = WinUtil.GetControlWidth(field, canvasSize.Width); } if (field is GUIDField) { ((GUIDField)field).HasTabStop = false; } if (field is IInputField && ((IInputField)field).IsReadOnly) { control.BackColor = Color.WhiteSmoke; } else if (control is DragableLabel == false) { control.BackColor = SystemColors.Window; } control.TabStop = field.HasTabStop; control.TabIndex = (int)field.TabIndex; if ((field is OptionField || field is GridField) == false) { control.Font = field.ControlFont; } control.ContextMenu = new ContextMenu(); if (field.ControlHeightPercentage == 0 || field.ControlWidthPercentage == 0) { field.ControlHeightPercentage = 1.0 * ((Control)control).Height / canvasSize.Height; field.ControlWidthPercentage = 1.0 * ((Control)control).Width / canvasSize.Width; field.SaveToDb(); } if (control is IFieldControl) { ((IFieldControl)control).Field = field; } }
protected virtual void WriteFieldValue(XmlWriter writer, IDataReader reader, RenderableField field) { switch (field.FieldType) { case MetaFieldType.Date: case MetaFieldType.DateTime: case MetaFieldType.Time: //writer.WriteString(Convert.ToDateTime(reader[field.Name]).Ticks.ToString()); writer.WriteString(Convert.ToDateTime(reader[field.Name]).ToString(CultureInfo.InvariantCulture.DateTimeFormat.ShortDatePattern)); break; case MetaFieldType.Checkbox: writer.WriteString(Convert.ToBoolean(reader[field.Name]).ToString()); break; case MetaFieldType.CommentLegal: case MetaFieldType.LegalValues: case MetaFieldType.Codes: case MetaFieldType.Text: case MetaFieldType.TextUppercase: case MetaFieldType.PhoneNumber: case MetaFieldType.UniqueRowId: case MetaFieldType.ForeignKey: case MetaFieldType.GlobalRecordId: case MetaFieldType.Multiline: writer.WriteString(reader[field.Name].ToString()); break; case MetaFieldType.Number: writer.WriteString(Convert.ToDouble(reader[field.Name]).ToString(System.Globalization.CultureInfo.InvariantCulture)); break; case MetaFieldType.YesNo: case MetaFieldType.RecStatus: writer.WriteString(reader[field.Name].ToString()); break; case MetaFieldType.GUID: writer.WriteString(reader[field.Name].ToString()); break; case MetaFieldType.Option: throw new ApplicationException(ImportExportSharedStrings.UNRECOGNIZED_FIELD_TYPE); case MetaFieldType.Image: throw new ApplicationException(ImportExportSharedStrings.UNRECOGNIZED_FIELD_TYPE); default: throw new ApplicationException(ImportExportSharedStrings.UNRECOGNIZED_FIELD_TYPE); } }
/// <summary> /// Creates an XmlElement representing an Epi Info 7 view's metadata. /// </summary> /// <param name="xmlDataPackage">The data package xml document that the XmlElement should be added to</param> /// <param name="form">The form whose metadata will be serialized</param> /// <returns>XmlElement; represents the view's metadata in Xml format, suitable for use in data packaging</returns> private XmlElement CreateXmlFormMetadataElement(XmlDocument xmlDataPackage, View form) { #region Input Validation if (xmlDataPackage == null) { throw new ArgumentNullException("xmlDataPackage"); } if (form == null) { throw new ArgumentNullException("form"); } #endregion // Input Validation if (StatusChanged != null) { StatusChanged(string.Format(PackagerStrings.ADDING_FIELD_METADATA, form.Name)); } XmlElement fields = xmlDataPackage.CreateElement("FieldMetadata"); foreach (Field field in form.Fields) { if (field is IDataField && field is RenderableField) { RenderableField renderableField = field as RenderableField; if (renderableField != null) { XmlElement fieldInfo = xmlDataPackage.CreateElement("FieldInfo"); XmlAttribute name = xmlDataPackage.CreateAttribute("Name"); XmlAttribute type = xmlDataPackage.CreateAttribute("FieldType"); XmlAttribute page = xmlDataPackage.CreateAttribute("Page"); // records page position, NOT page id and NOT page name name.Value = renderableField.Name; type.Value = renderableField.FieldType.ToString(); page.Value = renderableField.Page.Position.ToString(); fieldInfo.Attributes.Append(name); fieldInfo.Attributes.Append(type); fieldInfo.Attributes.Append(page); fields.AppendChild(fieldInfo); } } } return(fields); }
/// <summary> /// Adds a new field to the page /// </summary> /// <param name="field">Field to add</param> public void AddNewField(RenderableField field) { field.Page = this; if (!((field is MirrorField) || (field is LabelField))) { field.HasTabStop = true; field.TabIndex = MaxTabIndex + 1; } field.SaveToDb(); // Invalidate the current in-memory field collections and force the app to retreive // a fresh collection from the database whenever Page.Fields or Page.RenderableFields // is invoked. view.MustRefreshFieldCollection = true; }
/// <summary> /// Creates an XmlElement representing the key fields that should be used to match records on this Epi Info 7 view /// </summary> /// <param name="xmlDataPackage">The data package xml document that the XmlElement should be added to</param> /// <param name="form">The form that will be using these match keys during the import process</param> /// <returns>XmlElement; represents the keys Xml format</returns> protected XmlElement CreateXmlFormKeyElement(XmlDocument xmlDataPackage, View form) { #region Input Validation if (xmlDataPackage == null) { throw new ArgumentNullException("xmlDataPackage"); } if (form == null) { throw new ArgumentNullException("form"); } #endregion // Input Validation XmlElement fields = xmlDataPackage.CreateElement("KeyFields"); foreach (Field field in this.KeyFields) { if (field is IDataField) { RenderableField renderableField = field as RenderableField; if (renderableField != null) { XmlElement fieldInfo = xmlDataPackage.CreateElement("KeyField"); XmlAttribute name = xmlDataPackage.CreateAttribute("Name"); XmlAttribute type = xmlDataPackage.CreateAttribute("FieldType"); XmlAttribute page = xmlDataPackage.CreateAttribute("Page"); // records page position, NOT page id and NOT page name name.Value = renderableField.Name; type.Value = renderableField.FieldType.ToString(); page.Value = renderableField.Page.Position.ToString(); fieldInfo.Attributes.Append(name); fieldInfo.Attributes.Append(type); fieldInfo.Attributes.Append(page); fields.AppendChild(fieldInfo); } } } return(fields); }
public LegalValuesDialog(RenderableField field, Page currentPage) { InitializeComponent(); if (string.IsNullOrEmpty(field.ToString())) { throw new ArgumentNullException("field"); } if (string.IsNullOrEmpty(currentPage.ToString())) { throw new ArgumentNullException("currentPage"); } ddlField = (DDLFieldOfLegalValues)field; page = currentPage; codeTable = ddlField.GetSourceData(); cbxSort.Checked = ddlField.ShouldSort; fieldName = ddlField.Name; sourceTableName = ddlField.SourceTableName; textColumnName = ddlField.TextColumnName; }
/// <summary> /// Constructor for the Comment Legal dialog /// </summary> /// <param name="field">The comment legal field</param> /// <param name="currentPage">The current page</param> public CommentLegalDialog(RenderableField field, Page currentPage) : base(field, currentPage) { InitializeComponent(); page = currentPage; DDLFieldOfCommentLegal ddlField = (DDLFieldOfCommentLegal)field; codeTable = ddlField.GetSourceData(); //if (dgCodes.AllowSorting) //{ // ddlField.ShouldSort = true; //} //else //{ // ddlField.ShouldSort = false; //} dgCodes.DataSource = codeTable; sourceTableName = codeTable.TableName; textColumnName = fieldName; //dgCodes.AllowSorting = true; }
private void SetVisuals(Controls.Charting.AberrationChart aberrationChart) { AberrationDetectionChartParameters AbDetChartParameters = (AberrationDetectionChartParameters)Parameters; aberrationChart.Chart.InnerMargins = new Thickness(20, 30, 30, 50); aberrationChart.YAxisLabel = AbDetChartParameters.YAxisLabel; switch (AbDetChartParameters.XAxisLabelType) { case 3: aberrationChart.XAxisLabel = AbDetChartParameters.XAxisLabel; break; case 1: Field field = DashboardHelper.GetAssociatedField(AbDetChartParameters.ColumnNames[0]); if (field != null && field is IDataField) { RenderableField rField = field as RenderableField; aberrationChart.XAxisLabel = rField.PromptText; } else { aberrationChart.XAxisLabel = AbDetChartParameters.ColumnNames[0]; } break; case 2: aberrationChart.XAxisLabel = string.Empty; break; default: aberrationChart.XAxisLabel = AbDetChartParameters.ColumnNames[0]; break; } aberrationChart.ChartTitle = AbDetChartParameters.ChartTitle; }
/// <summary> /// Creates an XmlElement representing an Epi Info 7 view's data. /// </summary> /// <param name="xmlDataPackage">The data package xml document that the XmlElement should be added to</param> /// <param name="form">The form whose data will be serialized</param> /// <returns>XmlElement; represents the form's data in Xml format, suitable for use in data packaging</returns> protected XmlElement CreateXmlFormDataElement(XmlDocument xmlDataPackage, View form) { #region Input Validation if (xmlDataPackage == null) { throw new ArgumentNullException("xmlDataPackage"); } if (form == null) { throw new ArgumentNullException("form"); } #endregion // Input Validation XmlElement data = xmlDataPackage.CreateElement("Data"); if (StatusChanged != null) { StatusChanged(string.Format(PackagerStrings.GUID_LIST_SETUP, form.Name)); } if (ResetProgress != null) { ResetProgress(); } /* This seems like an usual set of steps to just iterate over the data. The problem is that we can't "just * iterate over the data" - the data is split up page tables, with one table representing one page on the * form. While a JOIN might be able to bring everything together into one table, it might not - for example, * if there are >255 fields after the JOIN, an OleDb exception will be thrown. * * To get around this issue: The code first iterates over the rows in the BASE TABLE, obtaining the GUID * values for each. The GUIDs and their corresponding XmlElement go into a dictionary. * * Later, each row in each page is iterated over; as the GUIDs for each page table are accessed, the corresponding * XmlElement is pulled from the dictionary. Field data is added to it for each field that has data. In this * manner, it doesn't matter that each row is technically accessed out-of-order because they'll still show up * in-order in the resulting Xml. * * Filtering adds another layer of complexity. To filter, a JOIN operation is needed so that the filters can * be applied across all those tables, since the fields in the filter may be across different tables. The * RowFilter class provides a way to handle this; we simply get the query from that object and apply it to the * reader. Only GUIDs that match the filter are added to the dictionary of guids. */ // We need to exclude records from child forms that may now be orphaned as a result of a filter applied to the parent if (form.IsRelatedView && PreviousDistanceFromRoot < CurrentDistanceFromRoot) { ParentIdList.Clear(); foreach (KeyValuePair <string, XmlElement> kvp in IdList) { ParentIdList.Add(kvp.Key); } } IdList.Clear(); // Very important, this needs to be re-set in case we've already processed a form (this is a class level variable) if (!ExportInfo.RecordsPackaged.ContainsKey(form)) { ExportInfo.RecordsPackaged.Add(form, 0); } bool filterThisForm = false; RowFilters filters = null; Query selectQuery = null; if (Filters != null && Filters.ContainsKey(form.Name) && Filters[form.Name].Count() > 0) { filterThisForm = true; filters = Filters[form.Name]; selectQuery = filters.GetGuidSelectQuery(form); } double totalRecords = 0; using (IDataReader guidReader = filterThisForm ? SourceProject.CollectedData.GetDatabase().ExecuteReader(selectQuery) : SourceProject.CollectedData.GetDatabase().GetTableDataReader(form.TableName)) { while (guidReader.Read()) { string guid = guidReader["GlobalRecordId"].ToString(); string fkey = guidReader["FKEY"].ToString(); string recstatus = guidReader["RECSTATUS"].ToString(); string firstSaveUserId = string.Empty; DateTime?firstSaveTime = null; string lastSaveUserId = string.Empty; DateTime?lastSaveTime = null; if (guidReader.FieldCount > 3) { try { firstSaveUserId = guidReader["FirstSaveLogonName"].ToString(); if (guidReader["FirstSaveTime"] != DBNull.Value) { firstSaveTime = (DateTime)guidReader["FirstSaveTime"]; } lastSaveUserId = guidReader["LastSaveLogonName"].ToString(); if (guidReader["LastSaveTime"] != DBNull.Value) { lastSaveTime = (DateTime)guidReader["LastSaveTime"]; } } catch (IndexOutOfRangeException) { // just ignore, probably an older upgraded project } } if (recstatus.Equals("1")) // only include undeleted records { if (!form.IsRelatedView || ParentIdList.Contains(fkey)) { XmlElement record = xmlDataPackage.CreateElement("Record"); XmlAttribute id = xmlDataPackage.CreateAttribute("Id"); id.Value = guid; record.Attributes.Append(id); if (!string.IsNullOrEmpty(fkey)) { XmlAttribute foreignKey = xmlDataPackage.CreateAttribute("Fkey"); foreignKey.Value = fkey; record.Attributes.Append(foreignKey); } if (!string.IsNullOrEmpty(firstSaveUserId)) { XmlAttribute firstSaveId = xmlDataPackage.CreateAttribute("FirstSaveUserId"); firstSaveId.Value = firstSaveUserId; record.Attributes.Append(firstSaveId); } if (!string.IsNullOrEmpty(lastSaveUserId)) { XmlAttribute lastSaveId = xmlDataPackage.CreateAttribute("LastSaveUserId"); lastSaveId.Value = lastSaveUserId; record.Attributes.Append(lastSaveId); } if (firstSaveTime.HasValue) { XmlAttribute firstSaveDateTime = xmlDataPackage.CreateAttribute("FirstSaveTime"); firstSaveDateTime.Value = firstSaveTime.Value.Ticks.ToString(); record.Attributes.Append(firstSaveDateTime); } if (lastSaveTime.HasValue) { XmlAttribute lastSaveDateTime = xmlDataPackage.CreateAttribute("LastSaveTime"); lastSaveDateTime.Value = lastSaveTime.Value.Ticks.ToString(); record.Attributes.Append(lastSaveDateTime); } IdList.Add(guid, record); totalRecords++; ExportInfo.TotalRecordsPackaged++; ExportInfo.RecordsPackaged[form]++; } } } } totalRecords = totalRecords * form.Pages.Count; int processedRecords = 0; if (StatusChanged != null) { StatusChanged(string.Format(PackagerStrings.ADDING_FIELD_DATA, form.Name)); } foreach (Page page in form.Pages) { using (IDataReader reader = SourceProject.CollectedData.GetDatabase().GetTableDataReader(page.TableName)) { while (reader.Read()) { string guid = reader["GlobalRecordId"].ToString(); if (IdList.ContainsKey(guid)) { XmlElement element = IdList[guid]; foreach (Field field in page.Fields) { if (field is IDataField && field is RenderableField && !(field is GridField) && !(FieldsToNull.ContainsKey(form.Name) && FieldsToNull[form.Name].Contains(field.Name))) { RenderableField renderableField = field as RenderableField; if (renderableField != null) { XmlElement fieldData = xmlDataPackage.CreateElement("Field"); XmlAttribute name = xmlDataPackage.CreateAttribute("Name"); name.Value = renderableField.Name; fieldData.Attributes.Append(name); string value = reader[field.Name].ToString(); if (!string.IsNullOrEmpty(value)) { if (field is DateTimeField) { DateTime dt = Convert.ToDateTime(value); fieldData.InnerText = dt.Ticks.ToString(); } else if (field is ImageField) { value = Convert.ToBase64String((Byte[])reader[field.Name]); fieldData.InnerText = value; } else { fieldData.InnerText = value; } } if (IncludeNullFieldData == false && String.IsNullOrEmpty(fieldData.InnerText)) { // do nothing, for now... } else { element.AppendChild(fieldData); } data.AppendChild(element); } } } } processedRecords++; double progress = (((double)processedRecords) / ((double)totalRecords)) * 100; if (UpdateProgress != null) { UpdateProgress(progress); } } } } foreach (GridField gridField in form.Fields.GridFields) { data.AppendChild(CreateXmlGridElement(xmlDataPackage, form, gridField)); ExportInfo.GridsProcessed++; } return(data); }
protected virtual void WriteFormData(XmlWriter writer, View form) { if (form.Fields.DataFields.Count > Core.Constants.EXPORT_FIELD_LIMIT && Project.CollectedData.GetDatabase() is Epi.Data.Office.OleDbDatabase) { // OleDB can't handle a SELECT * with a lot of fields, so do page-by-page processing instead WriteFormPagedData(writer, form); return; } MinorProgress = 0; OnMinorProgressChanged(); List <string> fieldsToNull = FieldsToNull[form.Name]; writer.WriteStartElement("Form"); writer.WriteAttributeString("Name", form.Name); writer.WriteAttributeString("Pages", form.Pages.Count.ToString()); writer.WriteAttributeString("IsRelatedForm", form.IsRelatedView.ToString()); WriteFormMetadata(writer, form); writer.WriteStartElement("Data"); IDbDriver db = Project.CollectedData.GetDatabase(); Query selectQuery = GetFormSelectQuery(form); List <string> labGuids = null; OnMinorStatusChanged("Applying filters for " + form.Name + "..."); if (Filters.ContainsKey(Core.Constants.CASE_FORM_NAME) && Filters[Core.Constants.CASE_FORM_NAME].Count() > 0 && _caseGuids != null) { if (form.Name.Equals(Core.Constants.CONTACT_FORM_NAME, StringComparison.OrdinalIgnoreCase)) { _contactGuids = new List <string>(); Query guidSelectQuery = db.CreateQuery("SELECT C.GlobalRecordId, M.FromRecordGuid FROM (ContactEntryForm C INNER JOIN metaLinks M ON C.GlobalRecordId = M.ToRecordGuid) WHERE M.ToViewId = @ToViewId AND M.FromViewId = 1"); guidSelectQuery.Parameters.Add(new QueryParameter("@ToViewId", DbType.Int32, ContactFormId)); using (IDataReader reader = db.ExecuteReader(guidSelectQuery)) { while (reader.Read()) { string caseGuid = reader["FromRecordGuid"].ToString(); if (_caseGuids.Contains(caseGuid)) { _contactGuids.Add(reader["GlobalRecordId"].ToString()); } } } } else if (form.Name.Equals(Core.Constants.LAB_FORM_NAME)) { labGuids = new List <string>(); Query guidSelectQuery = db.CreateQuery("SELECT L.GlobalRecordId, L.FKEY FROM (CaseInformationForm C INNER JOIN LaboratoryResultsForm L ON C.GlobalRecordId = L.FKEY)"); using (IDataReader reader = db.ExecuteReader(guidSelectQuery)) { while (reader.Read()) { string labGuid = reader["GlobalRecordId"].ToString(); string caseGuid = reader["FKEY"].ToString(); if (_caseGuids.Contains(caseGuid)) { labGuids.Add(reader["GlobalRecordId"].ToString()); } } } } } OnMinorStatusChanged("Getting total row counts for " + form.Name + "..."); string recStatusClause = "RECSTATUS = 1"; if (Scope == Epi.RecordProcessingScope.Both) { recStatusClause = "RECSTATUS >= 0"; } else if (Scope == Epi.RecordProcessingScope.Deleted) { recStatusClause = "RECSTATUS = 0"; } Query countQuery = db.CreateQuery("SELECT COUNT(*) FROM " + form.TableName + " WHERE " + recStatusClause + " AND ((LastSaveTime >= @StartDate AND LastSaveTime <= @EndDate) OR LastSaveTime IS NULL)"); countQuery.Parameters.Add(new QueryParameter("@StartDate", DbType.DateTime, StartDate)); countQuery.Parameters.Add(new QueryParameter("@EndDate", DbType.DateTime, EndDate)); double totalRecords = Convert.ToDouble(db.ExecuteScalar(countQuery)); double inc = 100 / totalRecords; bool isCaseForm = form.Name.Equals(Core.Constants.CASE_FORM_NAME, StringComparison.OrdinalIgnoreCase); if (isCaseForm) { _caseGuids = new HashSet <string>(); } using (IDataReader reader = db.ExecuteReader(selectQuery)) { //int i = 1; while (reader.Read()) { string recordGuid = reader["t.GlobalRecordId"].ToString(); string lastSaveTimeStr = String.Empty; long? lastSaveTimeLong = null; DateTime?lastSaveTime = null; if (reader["LastSaveTime"] != DBNull.Value) { lastSaveTime = Convert.ToDateTime(reader["LastSaveTime"]); lastSaveTimeLong = lastSaveTime.Value.Ticks; lastSaveTimeStr = lastSaveTimeLong.ToString(); if (lastSaveTime < StartDate || lastSaveTime > EndDate) { MinorProgress += inc; OnMinorProgressChanged(); OnMinorStatusChanged(String.Format("{0} of records exported from " + form.Name + "...", (MinorProgress / 100).ToString("P0"))); if (isCaseForm) { // we want to add the GUID here so related records (e.g. contacts and labs) don't get excluded because // their case wasn't in the date range. _caseGuids.Add(recordGuid); } continue; } } if (form.Name.Equals(Core.Constants.CONTACT_FORM_NAME, StringComparison.OrdinalIgnoreCase) && _contactGuids != null && !_contactGuids.Contains(recordGuid)) { continue; } if (form.Name.Equals(Core.Constants.LAB_FORM_NAME, StringComparison.OrdinalIgnoreCase) && labGuids != null && !labGuids.Contains(recordGuid)) { continue; } writer.WriteStartElement("Record"); writer.WriteAttributeString("Id", recordGuid); writer.WriteAttributeString("FKEY", reader["FKEY"] == DBNull.Value ? String.Empty : reader["FKEY"].ToString()); writer.WriteAttributeString("FirstSaveUserId", reader["FirstSaveLogonName"].ToString()); writer.WriteAttributeString("LastSaveUserId", reader["LastSaveLogonName"].ToString()); if (reader["FirstSaveTime"] != DBNull.Value) { writer.WriteAttributeString("FirstSaveTime", Convert.ToDateTime(reader["FirstSaveTime"]).Ticks.ToString()); } else { writer.WriteAttributeString("FirstSaveTime", String.Empty); } writer.WriteAttributeString("LastSaveTime", lastSaveTimeStr); writer.WriteAttributeString("RecStatus", reader["RecStatus"].ToString()); foreach (IDataField dataField in form.Fields.DataFields) { RenderableField field = dataField as RenderableField; if (field == null || dataField is UniqueKeyField || fieldsToNull.Contains(field.Name)) { continue; } else { if (reader[field.Name] != DBNull.Value && !String.IsNullOrEmpty(reader[field.Name].ToString())) { writer.WriteStartElement(field.Name); WriteFieldValue(writer, reader, field); writer.WriteEndElement(); } } } writer.WriteEndElement(); // record ExportInfo.RecordsPackaged[form]++; MinorProgress += inc; OnMinorProgressChanged(); //OnMinorStatusChanged(String.Format("{1} ({0}) of records exported from " + form.Name + "...", i.ToString(), (MinorProgress / 100).ToString("P0"))); OnMinorStatusChanged(String.Format("{0} of records exported from " + form.Name + "...", (MinorProgress / 100).ToString("P0"))); //i++; } } writer.WriteEndElement(); // data element writer.WriteEndElement(); // form element }
protected override void SetChartProperties() { xyChart.AnimationOnLoad = false; xyChart.Width = ParetoChartParameters.ChartWidth; xyChart.Height = ParetoChartParameters.ChartHeight; //xyChart.Palette = ColumnChartParameters.Palette; switch (ParetoChartParameters.Palette) { case 0: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Atlantic"); break; case 1: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Breeze"); break; case 2: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("ComponentArt"); break; case 3: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Deep"); break; case 4: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Earth"); break; case 5: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Evergreen"); break; case 6: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Heatwave"); break; case 7: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Montreal"); break; case 8: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Pastel"); break; case 9: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Renaissance"); break; case 10: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("SharePoint"); break; case 11: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Study"); break; default: case 12: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantA"); break; case 13: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantB"); break; case 14: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantC"); break; } if (ParetoChartParameters.PaletteColors.Count() == 12) { ComponentArt.Win.DataVisualization.Palette CorpColorPalette = new ComponentArt.Win.DataVisualization.Palette(); CorpColorPalette.PaletteName = "CorpColorPalette"; ///////////////////////////////////// CorpColorPalette.ChartingDataPoints12 = new Object(); var NewPalette12 = (IList)xyChart.Palette.ChartingDataPoints12; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count(); j++) { NewPalette12[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints12 = (Object)NewPalette12; xyChart.Palette.ChartingDataPoints12 = CorpColorPalette.ChartingDataPoints12; ////////////////////////////////// CorpColorPalette.ChartingDataPoints11 = new Object(); var NewPalette11 = (IList)xyChart.Palette.ChartingDataPoints11; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 1; j++) { NewPalette11[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints11 = (Object)NewPalette11; xyChart.Palette.ChartingDataPoints11 = CorpColorPalette.ChartingDataPoints11; ////////////////////////////////// CorpColorPalette.ChartingDataPoints10 = new Object(); var NewPalette10 = (IList)xyChart.Palette.ChartingDataPoints10; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 2; j++) { NewPalette10[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints10 = (Object)NewPalette10; xyChart.Palette.ChartingDataPoints10 = CorpColorPalette.ChartingDataPoints10; ////////////////////////////////// CorpColorPalette.ChartingDataPoints9 = new Object(); var NewPalette9 = (IList)xyChart.Palette.ChartingDataPoints9; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 3; j++) { NewPalette9[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints9 = (Object)NewPalette9; xyChart.Palette.ChartingDataPoints9 = CorpColorPalette.ChartingDataPoints9; ////////////////////////////////// CorpColorPalette.ChartingDataPoints8 = new Object(); var NewPalette8 = (IList)xyChart.Palette.ChartingDataPoints8; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 4; j++) { NewPalette8[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints8 = (Object)NewPalette8; xyChart.Palette.ChartingDataPoints8 = CorpColorPalette.ChartingDataPoints8; ////////////////////////////////// CorpColorPalette.ChartingDataPoints7 = new Object(); var NewPalette7 = (IList)xyChart.Palette.ChartingDataPoints7; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 5; j++) { NewPalette7[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints7 = (Object)NewPalette7; xyChart.Palette.ChartingDataPoints7 = CorpColorPalette.ChartingDataPoints7; ////////////////////////////////// CorpColorPalette.ChartingDataPoints6 = new Object(); var NewPalette6 = (IList)xyChart.Palette.ChartingDataPoints6; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 6; j++) { NewPalette6[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints6 = (Object)NewPalette6; xyChart.Palette.ChartingDataPoints6 = CorpColorPalette.ChartingDataPoints6; ////////////////////////////////// CorpColorPalette.ChartingDataPoints5 = new Object(); var NewPalette5 = (IList)xyChart.Palette.ChartingDataPoints5; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 7; j++) { NewPalette5[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints5 = (Object)NewPalette5; xyChart.Palette.ChartingDataPoints5 = CorpColorPalette.ChartingDataPoints5; ////////////////////////////////// CorpColorPalette.ChartingDataPoints4 = new Object(); var NewPalette4 = (IList)xyChart.Palette.ChartingDataPoints4; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 8; j++) { NewPalette4[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints4 = (Object)NewPalette4; xyChart.Palette.ChartingDataPoints4 = CorpColorPalette.ChartingDataPoints4; ////////////////////////////////// CorpColorPalette.ChartingDataPoints3 = new Object(); var NewPalette3 = (IList)xyChart.Palette.ChartingDataPoints3; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 9; j++) { NewPalette3[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints3 = (Object)NewPalette3; xyChart.Palette.ChartingDataPoints3 = CorpColorPalette.ChartingDataPoints3; ////////////////////////////////// CorpColorPalette.ChartingDataPoints2 = new Object(); var NewPalette2 = (IList)xyChart.Palette.ChartingDataPoints2; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 10; j++) { NewPalette2[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints2 = (Object)NewPalette2; xyChart.Palette.ChartingDataPoints2 = CorpColorPalette.ChartingDataPoints2; ////////////////////////////////// CorpColorPalette.ChartingDataPoints1 = new Object(); var NewPalette1 = (IList)xyChart.Palette.ChartingDataPoints1; for (int j = 0; j < ParetoChartParameters.PaletteColors.Count() - 11; j++) { NewPalette1[j] = (Color)ColorConverter.ConvertFromString(ParetoChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints1 = (Object)NewPalette1; xyChart.Palette.ChartingDataPoints1 = CorpColorPalette.ChartingDataPoints1; } xyChart.DefaultGridLinesVisible = ParetoChartParameters.ShowGridLines; xyChart.LegendDock = ParetoChartParameters.LegendDock; series0.BarRelativeBegin = double.NaN; series0.BarRelativeEnd = double.NaN; switch ((BarSpacing)ParetoChartParameters.BarSpace) { case BarSpacing.None: series0.RelativePointSpace = 0; series0.BarRelativeBegin = 0; series0.BarRelativeEnd = 0; if (ParetoChartParameters.Composition == CompositionKind.SideBySide) { ParetoChartParameters.Composition = CompositionKind.Stacked; } break; case BarSpacing.Small: series0.RelativePointSpace = 0.1; break; case BarSpacing.Medium: series0.RelativePointSpace = 0.4; break; case BarSpacing.Large: series0.RelativePointSpace = 0.8; break; case BarSpacing.Default: default: series0.RelativePointSpace = 0.15; break; } //if (!string.IsNullOrEmpty(ColumnChartSettings.YAxisFormattingString.Trim())) //{ // YAxisCoordinates.FormattingString = ColumnChartSettings.YAxisFormattingString; //} //if (!string.IsNullOrEmpty(ColumnChartSettings.Y2AxisFormattingString.Trim())) //{ // Y2AxisCoordinates.FormattingString = ColumnChartSettings.Y2AxisFormattingString; //} //xyChart.CompositionKind = ColumnChartSettings.Composition; //xyChart.Orientation = ColumnChartSettings.Orientation; //xAxisCoordinates.Angle = Settings.XAxisLabelRotation; //if (!string.IsNullOrEmpty(ParetoChartParameters.YAxisFormat.Trim())) //{ // YAxisCoordinates.FormattingString = ParetoChartParameters.YAxisFormat.Trim(); //} //if (!string.IsNullOrEmpty(ParetoChartParameters.Y2AxisFormat.Trim())) //{ // Y2AxisCoordinates.FormattingString = ParetoChartParameters.Y2AxisFormat.Trim(); //} xyChart.CompositionKind = ParetoChartParameters.Composition; xyChart.Orientation = ParetoChartParameters.Orientation; xAxisCoordinates.Angle = ParetoChartParameters.XAxisAngle; //switch (Settings.XAxisLabelType) //{ // case XAxisLabelType.Custom: // case XAxisLabelType.FieldPrompt: // tblockXAxisLabel.Text = Settings.XAxisLabel; // tblockXAxisLabel.Text = Settings.XAxisLabel; ??? WHY WAS THIS IN THERE TWICE ??? // break; // case XAxisLabelType.None: // tblockXAxisLabel.Text = string.Empty; // break; // default: // tblockXAxisLabel.Text = Settings.XAxisLabel; // break; //} switch (ParetoChartParameters.XAxisLabelType) { default: case 0: //Automatic if (!String.IsNullOrEmpty(ParetoChartParameters.XAxisLabel)) { tblockXAxisLabel.Text = ParetoChartParameters.XAxisLabel; } else { tblockXAxisLabel.Text = ParetoChartParameters.ColumnNames[0]; } break; case 1: //Field Prompt { Field field = DashboardHelper.GetAssociatedField(ParetoChartParameters.ColumnNames[0]); if (field != null) { RenderableField rField = field as RenderableField; tblockXAxisLabel.Text = rField.PromptText; } else { tblockXAxisLabel.Text = ParetoChartParameters.ColumnNames[0]; } } break; case 2: //None tblockXAxisLabel.Text = string.Empty; break; case 3: //Custom tblockXAxisLabel.Text = ParetoChartParameters.XAxisLabel; break; } //x axis angle double angle = 0; //if (double.TryParse(txtXAxisAngle.Text, out angle)) if (double.TryParse(ParetoChartParameters.XAxisAngle.ToString(), out angle)) { xAxisCoordinates.Angle = angle; } if (!string.IsNullOrEmpty(tblockXAxisLabel.Text.Trim())) { tblockXAxisLabel.Visibility = System.Windows.Visibility.Visible; } else { tblockXAxisLabel.Visibility = System.Windows.Visibility.Collapsed; } //YAxisLabel = Settings.YAxisLabel; //Y2AxisLabel = Settings.Y2AxisLabel; //Y2AxisLegendTitle = Settings.Y2AxisLegendTitle; //xyChart.UseDifferentBarColors = ColumnChartSettings.UseDiffColors; //xyChart.LegendVisible = Settings.ShowLegend; //xyChart.Legend.FontSize = Settings.LegendFontSize; YAxisLabel = ParetoChartParameters.YAxisLabel; tblockYAxisLabel.Text = ParetoChartParameters.YAxisLabel; tblockYAxisLabel.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Size textSize = new Size(tblockYAxisLabel.DesiredSize.Width, tblockYAxisLabel.DesiredSize.Height); xyChart.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Size chartSize = new Size(xyChart.DesiredSize.Width, xyChart.DesiredSize.Height); tblockYAxisLabel.Padding = new Thickness(((chartSize.Height - 144) / 2) - (textSize.Width / 2), 2, 0, 2); Y2AxisLabel = ParetoChartParameters.Y2AxisLabel; Y2AxisLegendTitle = ParetoChartParameters.Y2AxisLegendTitle; xyChart.UseDifferentBarColors = ParetoChartParameters.UseDiffColors; //Size textSize = new Size(); //Size chartSize = new Size(); //tblockChartTitle.Text = Settings.ChartTitle; //tblockSubTitle.Text = Settings.ChartSubTitle; tblockChartTitle.Text = ParetoChartParameters.ChartTitle; tblockSubTitle.Text = ParetoChartParameters.ChartSubTitle; tblockStrataTitle.Text = ParetoChartParameters.ChartStrataTitle; if (string.IsNullOrEmpty(tblockChartTitle.Text)) { tblockChartTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockChartTitle.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrEmpty(tblockSubTitle.Text)) { tblockSubTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockSubTitle.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrEmpty(tblockStrataTitle.Text)) { tblockStrataTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockStrataTitle.Visibility = System.Windows.Visibility.Visible; } //yAxis.UseReferenceValue = Settings.UseRefValues; //series0.ShowPointAnnotations = ColumnChartSettings.ShowAnnotations; //series0.BarKind = ColumnChartSettings.BarKind; //series1.ShowPointAnnotations = Settings.ShowAnnotationsY2; //series1.DashStyle = Settings.LineDashStyleY2; //series1.LineKind = Settings.LineKindY2; //series1.Thickness = Settings.Y2LineThickness; yAxis.UseReferenceValue = ParetoChartParameters.UseRefValues; series0.ShowPointAnnotations = ParetoChartParameters.ShowAnnotations; series0.BarKind = ParetoChartParameters.BarKind; series1.ShowPointAnnotations = ParetoChartParameters.Y2ShowAnnotations; series1.DashStyle = ParetoChartParameters.Y2LineDashStyle; series1.LineKind = ParetoChartParameters.Y2LineKind; series1.Thickness = ParetoChartParameters.Y2LineThickness; y2AxisCoordinates.FormattingString = "P0"; xyChart.LegendVisible = ParetoChartParameters.ShowLegend; xyChart.Legend.FontSize = ParetoChartParameters.LegendFontSize; xyChart.Legend.BorderBrush = Brushes.Gray; if (ParetoChartParameters.ShowLegendBorder == true) { xyChart.Legend.BorderThickness = new Thickness(1); } else { xyChart.Legend.BorderThickness = new Thickness(0); } //EI-98 YAxisCoordinates.FontSize = ParetoChartParameters.YAxisFontSize; xAxisCoordinates.FontSize = ParetoChartParameters.XAxisFontSize; tblockXAxisLabel.FontSize = ParetoChartParameters.XAxisLabelFontSize; tblockYAxisLabel.FontSize = ParetoChartParameters.YAxisLabelFontSize; }
/// <summary> /// Creates a new blank row for a given form's base table and all of its page tables. /// </summary> /// <param name="form">The form where the row should be added.</param> /// <param name="guid">The Guid value to use for the row.</param> /// <param name="keyValues">The key values to use for custom matching</param> /// <param name="fkey">The foreign key for the row.</param> /// <param name="firstSaveId">The user ID of the first person that saved this record.</param> /// <param name="firstSaveTime">The time when the record was first saved.</param> /// <param name="lastSaveId">The user ID of the last person that saved this record.</param> /// <param name="lastSaveTime">The time when the record was last saved.</param> protected virtual void CreateNewBlankRow(View form, string guid, Dictionary <Field, object> keyValues = null, string fkey = "", string firstSaveId = "", string lastSaveId = "", DateTime?firstSaveTime = null, DateTime?lastSaveTime = null) { #region Input Validation if (string.IsNullOrEmpty(guid)) { throw new ArgumentNullException("guid"); } if (form == null) { throw new ArgumentNullException("form"); } #endregion // Input Validation if (Conn.State != ConnectionState.Open) { Conn.Open(); } IDbDriver db = DestinationProject.CollectedData.GetDatabase(); StringBuilder sb = new StringBuilder(); sb.Append(" insert into "); sb.Append(db.InsertInEscape(form.TableName)); sb.Append(StringLiterals.SPACE); sb.Append(StringLiterals.SPACE); WordBuilder fields = new WordBuilder(","); fields.Append("[GlobalRecordId]"); if (!string.IsNullOrEmpty(fkey)) { fields.Append("[FKEY]"); } if (!string.IsNullOrEmpty(firstSaveId)) { fields.Append("[FirstSaveLogonName]"); } if (!string.IsNullOrEmpty(lastSaveId)) { fields.Append("[LastSaveLogonName]"); } if (firstSaveTime.HasValue) { fields.Append("[FirstSaveTime]"); } if (lastSaveTime.HasValue) { fields.Append("[LastSaveTime]"); } sb.Append("(" + fields.ToString() + ")"); sb.Append(" values ("); List <QueryParameter> parameters = new List <QueryParameter>(); WordBuilder values = new WordBuilder(","); values.Append("'" + guid + "'"); if (!string.IsNullOrEmpty(fkey)) { values.Append("@FKEY"); parameters.Add(new QueryParameter("@FKEY", DbType.String, fkey)); } if (!string.IsNullOrEmpty(firstSaveId)) { values.Append("@FirstSaveLogonName"); parameters.Add(new QueryParameter("@FirstSaveLogonName", DbType.String, firstSaveId)); } if (!string.IsNullOrEmpty(lastSaveId)) { values.Append("@LastSaveLogonName"); parameters.Add(new QueryParameter("@LastSaveLogonName", DbType.String, lastSaveId)); } if (firstSaveTime.HasValue) { values.Append("@FirstSaveTime"); parameters.Add(new QueryParameter("@FirstSaveTime", DbType.DateTime, firstSaveTime)); } if (lastSaveTime.HasValue) { values.Append("@LastSaveTime"); parameters.Add(new QueryParameter("@LastSaveTime", DbType.DateTime, lastSaveTime)); } sb.Append(values.ToString()); sb.Append(") "); Epi.Data.Query insertQuery = db.CreateQuery(sb.ToString()); insertQuery.Parameters = parameters; if (DestinationProject.CollectedDataDriver.ToLowerInvariant().Contains("epi.data.office")) { IDbCommand command = GetCommand(insertQuery.SqlStatement, Conn, insertQuery.Parameters); object obj = command.ExecuteNonQuery(); } else { db.ExecuteNonQuery(insertQuery); } //Parallel.ForEach(form.Pages, page => foreach (Page page in form.Pages) { WordBuilder wbFields = new WordBuilder(","); WordBuilder wbParams = new WordBuilder(","); List <QueryParameter> queryParams = new List <QueryParameter>(); wbFields.Add("[GlobalRecordId]"); wbParams.Add("@GlobalRecordId"); queryParams.Add(new QueryParameter("@GlobalRecordId", DbType.String, guid)); foreach (KeyValuePair <Field, object> kvp in keyValues) { RenderableField field = kvp.Key as RenderableField; PackageFieldData fieldData = new PackageFieldData(); fieldData.FieldValue = kvp.Value; fieldData.FieldName = field.Name; fieldData.Page = field.Page; if (field.Page.TableName.Equals(page.TableName)) { wbFields.Add(db.InsertInEscape(fieldData.FieldName)); wbParams.Add("@" + fieldData.FieldName); QueryParameter parameter = GetQueryParameterForField(fieldData, form, field.Page); queryParams.Add(parameter); } } sb = new StringBuilder(); sb.Append(" insert into "); sb.Append(db.InsertInEscape(page.TableName)); sb.Append(StringLiterals.SPACE); sb.Append(StringLiterals.SPACE); sb.Append("("); sb.Append(wbFields.ToString()); sb.Append(")"); sb.Append(" values ("); sb.Append(wbParams.ToString()); sb.Append(") "); insertQuery = db.CreateQuery(sb.ToString()); foreach (QueryParameter queryParam in queryParams) { insertQuery.Parameters.Add(queryParam); } if (DestinationProject.CollectedDataDriver.ToLowerInvariant().Contains("epi.data.office")) { IDbCommand command = GetCommand(insertQuery.SqlStatement, Conn, insertQuery.Parameters); object obj = command.ExecuteNonQuery(); } else { db.ExecuteNonQuery(insertQuery); } } //); }
protected override void SetChartProperties() { xyChart.AnimationOnLoad = false; //xyChart.Width = Settings.ChartWidth; //xyChart.Height = Settings.ChartHeight; //xyChart.Palette = Settings.Palette; //xyChart.DefaultGridLinesVisible = Settings.ShowDefaultGridLines; //xyChart.LegendDock = Settings.LegendDock; xyChart.Width = AreaChartParameters.ChartWidth; xyChart.Height = AreaChartParameters.ChartHeight; //xyChart.Palette = Settings.Palette; switch (AreaChartParameters.Palette) { case 0: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Atlantic"); break; case 1: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Breeze"); break; case 2: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("ComponentArt"); break; case 3: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Deep"); break; case 4: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Earth"); break; case 5: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Evergreen"); break; case 6: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Heatwave"); break; case 7: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Montreal"); break; case 8: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Pastel"); break; case 9: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Renaissance"); break; case 10: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("SharePoint"); break; case 11: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("Study"); break; default: case 12: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantA"); break; case 13: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantB"); break; case 14: xyChart.Palette = ComponentArt.Win.DataVisualization.Palette.GetPalette("VibrantC"); break; } if (AreaChartParameters.PaletteColors.Count() == 12) { ComponentArt.Win.DataVisualization.Palette CorpColorPalette = new ComponentArt.Win.DataVisualization.Palette(); CorpColorPalette.PaletteName = "CorpColorPalette"; ///////////////////////////////////// CorpColorPalette.ChartingDataPoints12 = new Object(); var NewPalette12 = (IList)xyChart.Palette.ChartingDataPoints12; for (int j = 0; j < AreaChartParameters.PaletteColors.Count(); j++) { NewPalette12[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints12 = (Object)NewPalette12; xyChart.Palette.ChartingDataPoints12 = CorpColorPalette.ChartingDataPoints12; ////////////////////////////////// CorpColorPalette.ChartingDataPoints11 = new Object(); var NewPalette11 = (IList)xyChart.Palette.ChartingDataPoints11; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 1; j++) { NewPalette11[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints11 = (Object)NewPalette11; xyChart.Palette.ChartingDataPoints11 = CorpColorPalette.ChartingDataPoints11; ////////////////////////////////// CorpColorPalette.ChartingDataPoints10 = new Object(); var NewPalette10 = (IList)xyChart.Palette.ChartingDataPoints10; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 2; j++) { NewPalette10[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints10 = (Object)NewPalette10; xyChart.Palette.ChartingDataPoints10 = CorpColorPalette.ChartingDataPoints10; ////////////////////////////////// CorpColorPalette.ChartingDataPoints9 = new Object(); var NewPalette9 = (IList)xyChart.Palette.ChartingDataPoints9; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 3; j++) { NewPalette9[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints9 = (Object)NewPalette9; xyChart.Palette.ChartingDataPoints9 = CorpColorPalette.ChartingDataPoints9; ////////////////////////////////// CorpColorPalette.ChartingDataPoints8 = new Object(); var NewPalette8 = (IList)xyChart.Palette.ChartingDataPoints8; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 4; j++) { NewPalette8[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints8 = (Object)NewPalette8; xyChart.Palette.ChartingDataPoints8 = CorpColorPalette.ChartingDataPoints8; ////////////////////////////////// CorpColorPalette.ChartingDataPoints7 = new Object(); var NewPalette7 = (IList)xyChart.Palette.ChartingDataPoints7; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 5; j++) { NewPalette7[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints7 = (Object)NewPalette7; xyChart.Palette.ChartingDataPoints7 = CorpColorPalette.ChartingDataPoints7; ////////////////////////////////// CorpColorPalette.ChartingDataPoints6 = new Object(); var NewPalette6 = (IList)xyChart.Palette.ChartingDataPoints6; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 6; j++) { NewPalette6[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints6 = (Object)NewPalette6; xyChart.Palette.ChartingDataPoints6 = CorpColorPalette.ChartingDataPoints6; ////////////////////////////////// CorpColorPalette.ChartingDataPoints5 = new Object(); var NewPalette5 = (IList)xyChart.Palette.ChartingDataPoints5; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 7; j++) { NewPalette5[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints5 = (Object)NewPalette5; xyChart.Palette.ChartingDataPoints5 = CorpColorPalette.ChartingDataPoints5; ////////////////////////////////// CorpColorPalette.ChartingDataPoints4 = new Object(); var NewPalette4 = (IList)xyChart.Palette.ChartingDataPoints4; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 8; j++) { NewPalette4[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints4 = (Object)NewPalette4; xyChart.Palette.ChartingDataPoints4 = CorpColorPalette.ChartingDataPoints4; ////////////////////////////////// CorpColorPalette.ChartingDataPoints3 = new Object(); var NewPalette3 = (IList)xyChart.Palette.ChartingDataPoints3; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 9; j++) { NewPalette3[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints3 = (Object)NewPalette3; xyChart.Palette.ChartingDataPoints3 = CorpColorPalette.ChartingDataPoints3; ////////////////////////////////// CorpColorPalette.ChartingDataPoints2 = new Object(); var NewPalette2 = (IList)xyChart.Palette.ChartingDataPoints2; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 10; j++) { NewPalette2[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints2 = (Object)NewPalette2; xyChart.Palette.ChartingDataPoints2 = CorpColorPalette.ChartingDataPoints2; ////////////////////////////////// CorpColorPalette.ChartingDataPoints1 = new Object(); var NewPalette1 = (IList)xyChart.Palette.ChartingDataPoints1; for (int j = 0; j < AreaChartParameters.PaletteColors.Count() - 11; j++) { NewPalette1[j] = (Color)ColorConverter.ConvertFromString(AreaChartParameters.PaletteColors[j].ToString()); } CorpColorPalette.ChartingDataPoints1 = (Object)NewPalette1; xyChart.Palette.ChartingDataPoints1 = CorpColorPalette.ChartingDataPoints1; } xyChart.DefaultGridLinesVisible = AreaChartParameters.ShowGridLines; xyChart.LegendDock = AreaChartParameters.LegendDock; series0.BarRelativeBegin = double.NaN; series0.BarRelativeEnd = double.NaN; //series0.LineKind = AreaChartSettings.AreaType; series0.LineKind = AreaChartParameters.AreaKind; //tblockChartTitle.Text = Settings.ChartTitle; //tblockSubTitle.Text = Settings.ChartSubTitle; //tblockStrataTitle.Text = Settings.ChartStrataTitle; tblockChartTitle.Text = AreaChartParameters.ChartTitle; tblockSubTitle.Text = AreaChartParameters.ChartSubTitle; tblockStrataTitle.Text = AreaChartParameters.ChartStrataTitle; if (string.IsNullOrEmpty(tblockChartTitle.Text)) { tblockChartTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockChartTitle.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrEmpty(tblockSubTitle.Text)) { tblockSubTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockSubTitle.Visibility = System.Windows.Visibility.Visible; } if (string.IsNullOrEmpty(tblockStrataTitle.Text)) { tblockStrataTitle.Visibility = System.Windows.Visibility.Collapsed; } else { tblockStrataTitle.Visibility = System.Windows.Visibility.Visible; } //yAxis.UseReferenceValue = Settings.UseRefValues; //series0.SeriesLineVisible = AreaChartSettings.ShowSeriesLine; yAxis.UseReferenceValue = AreaChartParameters.UseRefValues; series0.SeriesLineVisible = AreaChartParameters.ShowSeriesLine; //xAxisCoordinates.Angle = Settings.XAxisLabelRotation; xAxisCoordinates.Angle = AreaChartParameters.XAxisAngle; //series0.GradientTopColorShift = new ComponentArt.Win.DataVisualization.Common.ColorShift("A-" + AreaChartSettings.TransparencyTop.ToString()); //series0.GradientBottomColorShift = new ComponentArt.Win.DataVisualization.Common.ColorShift("A-" + AreaChartSettings.TransparencyBottom.ToString()); series0.GradientTopColorShift = new ComponentArt.Win.DataVisualization.Common.ColorShift("A-" + AreaChartParameters.TransTop.ToString()); series0.GradientBottomColorShift = new ComponentArt.Win.DataVisualization.Common.ColorShift("A-" + AreaChartParameters.TransBottom.ToString()); //switch ((EpiDashboard.XAxisLabelType)Settings.XAxisLabelType) //{ // case XAxisLabelType.Custom: // case XAxisLabelType.FieldPrompt: // tblockXAxisLabel.Text = AreaChartParameters.XAxisLabel; // tblockXAxisLabel.Text = AreaChartParameters.XAxisLabel; // break; // case XAxisLabelType.None: // tblockXAxisLabel.Text = string.Empty; // break; // default: // tblockXAxisLabel.Text = AreaChartParameters.XAxisLabel; // break; //} switch (AreaChartParameters.XAxisLabelType) { default: case 0: //Automatic if (!String.IsNullOrEmpty(AreaChartParameters.XAxisLabel)) { tblockXAxisLabel.Text = AreaChartParameters.XAxisLabel; } else { tblockXAxisLabel.Text = AreaChartParameters.ColumnNames[0]; } break; case 1: //Field Prompt { Field field = DashboardHelper.GetAssociatedField(AreaChartParameters.ColumnNames[0]); if (field != null) { RenderableField rField = field as RenderableField; tblockXAxisLabel.Text = rField.PromptText; } else { tblockXAxisLabel.Text = AreaChartParameters.ColumnNames[0]; } } break; case 2: //None tblockXAxisLabel.Text = string.Empty; break; case 3: //Custom tblockXAxisLabel.Text = AreaChartParameters.XAxisLabel; break; } if (!string.IsNullOrEmpty(tblockXAxisLabel.Text.Trim())) { tblockXAxisLabel.Visibility = System.Windows.Visibility.Visible; } else { tblockXAxisLabel.Visibility = System.Windows.Visibility.Collapsed; } if (!string.IsNullOrEmpty(AreaChartParameters.YAxisFormat.Trim())) { YAxisCoordinates.FormattingString = AreaChartParameters.YAxisFormat; } if (!string.IsNullOrEmpty(AreaChartParameters.YAxisFormat.Trim())) { Y2AxisCoordinates.FormattingString = AreaChartParameters.YAxisFormat; } //YAxisLabel = Settings.YAxisLabel; //Y2AxisLabel = Settings.Y2AxisLabel; //Y2AxisLegendTitle = Settings.Y2AxisLegendTitle; YAxisLabel = AreaChartParameters.YAxisLabel; Y2AxisLabel = AreaChartParameters.Y2AxisLabel; Y2AxisLegendTitle = AreaChartParameters.Y2AxisLegendTitle; //xyChart.CompositionKind = AreaChartSettings.Composition; xyChart.CompositionKind = AreaChartParameters.Composition; labelXAxis.Orientation = ChartLabelOrientation.Horizontal; labelXAxis.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; labelYAxis.Orientation = ChartLabelOrientation.Vertical; labelY2Axis.Orientation = ChartLabelOrientation.Vertical; tblockYAxisLabel.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Size textSize = new Size(tblockYAxisLabel.DesiredSize.Width, tblockYAxisLabel.DesiredSize.Height); tblockY2AxisLabel.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Size textSizeY2 = new Size(tblockY2AxisLabel.DesiredSize.Width, tblockY2AxisLabel.DesiredSize.Height); xyChart.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity)); Size chartSize = new Size(xyChart.DesiredSize.Width, xyChart.DesiredSize.Height); tblockYAxisLabel.Padding = new Thickness(((chartSize.Height - 144) / 2) - (textSize.Width / 2), 2, 0, 2); tblockY2AxisLabel.Padding = new Thickness(((chartSize.Height - 144) / 2) - (textSizeY2.Width / 2), 2, 0, 2); //xyChart.LegendVisible = Settings.ShowLegend; //if (Settings.ShowLegendBorder == true) xyChart.LegendVisible = AreaChartParameters.ShowLegend; if (AreaChartParameters.ShowLegendBorder == true) { xyChart.Legend.BorderThickness = new Thickness(1); } else { xyChart.Legend.BorderThickness = new Thickness(0); } //series1.ShowPointAnnotations = Settings.ShowAnnotationsY2; //series1.DashStyle = Settings.LineDashStyleY2; //series1.LineKind = Settings.LineKindY2; //series1.Thickness = Settings.Y2LineThickness; //xyChart.Legend.FontSize = Settings.LegendFontSize; series1.ShowPointAnnotations = AreaChartParameters.Y2ShowAnnotations; series1.DashStyle = AreaChartParameters.Y2LineDashStyle; series1.LineKind = AreaChartParameters.Y2LineKind; series1.Thickness = AreaChartParameters.Y2LineThickness; xyChart.Legend.FontSize = AreaChartParameters.LegendFontSize; //EI-98 YAxisCoordinates.FontSize = AreaChartParameters.YAxisFontSize; xAxisCoordinates.FontSize = AreaChartParameters.XAxisFontSize; tblockXAxisLabel.FontSize = AreaChartParameters.XAxisLabelFontSize; tblockYAxisLabel.FontSize = AreaChartParameters.YAxisLabelFontSize; }
/// <summary> /// Handles the DoWorker event for the worker /// </summary> /// <param name="sender">Object that fired the event</param> /// <param name="e">.NET supplied event parameters</param> private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { lock (syncLock) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToProcessingState)); this.Dispatcher.BeginInvoke(new SimpleCallback(ClearResults)); AddLineListGridDelegate addGrid = new AddLineListGridDelegate(AddLineListGrid); Configuration config = DashboardHelper.Config; string yesValue = config.Settings.RepresentationOfYes; string noValue = config.Settings.RepresentationOfNo; try { DataTable dictionaryTable = DashboardHelper.FieldTable.Copy(); foreach (KeyValuePair <string, string> kvp in DashboardHelper.TableColumnNames) { DataRow row = dictionaryTable.Rows.Find(kvp.Key); if (row == null) { dictionaryTable.Rows.Add(kvp.Key, kvp.Value); } } if (DashboardHelper.IsUsingEpiProject) { dictionaryTable.Columns.Add("Page", typeof(int)); dictionaryTable.Columns.Add("Tab", typeof(int)); dictionaryTable.Columns.Add("Prompt", typeof(string)); dictionaryTable.Columns.Add("Items", typeof(string)); dictionaryTable.Columns.Add("FieldType", typeof(string)); foreach (DataRow fieldRow in dictionaryTable.Rows) { if (fieldRow["epifieldtype"] is RenderableField) { RenderableField renderableField = fieldRow["epifieldtype"] as RenderableField; fieldRow["Page"] = renderableField.Page.Position + 1; fieldRow["Tab"] = renderableField.TabIndex; fieldRow["Prompt"] = renderableField.PromptText; fieldRow["FieldType"] = fieldRow["epifieldtype"].ToString().Replace("Epi.Fields.", String.Empty); if (renderableField is GroupField) { GroupField groupField = renderableField as GroupField; fieldRow["Items"] = groupField.ChildFieldNames; } else if (renderableField is OptionField) { OptionField optionField = renderableField as OptionField; fieldRow["Items"] = optionField.GetOptionsString(); } } fieldRow["datatype"] = fieldRow["datatype"].ToString().Replace("System.", String.Empty); } dictionaryTable.Columns["columnname"].SetOrdinal(0); dictionaryTable.Columns["Prompt"].SetOrdinal(1); dictionaryTable.Columns["formname"].SetOrdinal(2); dictionaryTable.Columns["Page"].SetOrdinal(3); dictionaryTable.Columns["Tab"].SetOrdinal(4); dictionaryTable.Columns["datatype"].SetOrdinal(5); dictionaryTable.Columns["FieldType"].SetOrdinal(6); dictionaryTable.Columns["tablename"].SetOrdinal(7); dictionaryTable.Columns["Items"].SetOrdinal(8); } if (dictionaryTable == null || dictionaryTable.Rows.Count == 0) { this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), "There are no valid fields to display."); } else if (worker.CancellationPending) { this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), SharedStrings.DASHBOARD_GADGET_STATUS_OPERATION_CANCELLED); this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState)); Debug.Print("Data dictionary thread cancelled"); return; } else { this.Dispatcher.BeginInvoke(addGrid, dictionaryTable.AsDataView()); string formatString = string.Empty; } this.Dispatcher.BeginInvoke(new SimpleCallback(RenderFinish)); this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState)); } catch (Exception ex) { this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), ex.Message); this.Dispatcher.BeginInvoke(new SimpleCallback(SetGadgetToFinishedState)); } finally { stopwatch.Stop(); Debug.Print("Data dictionary gadget took " + stopwatch.Elapsed.ToString() + " seconds to complete with " + DashboardHelper.RecordCount.ToString() + " records and the following filters:"); Debug.Print(DashboardHelper.DataFilters.GenerateDataFilterString()); } } }
//void lvMain_MouseRightButtonUp(object sender, MouseButtonEventArgs e) //{ // if(lvMain.SelectedItems.Count == 1) // { // } //} /// <summary> /// Handles the DoWorker event for the worker /// </summary> /// <param name="sender">Object that fired the event</param> /// <param name="e">.NET supplied event parameters</param> private void worker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { lock (syncLock) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); this.Dispatcher.BeginInvoke(new SimpleCallback(SetToProcessingState)); this.Dispatcher.BeginInvoke(new SimpleCallback(ClearResults)); Configuration config = dashboardHelper.Config; string yesValue = config.Settings.RepresentationOfYes; string noValue = config.Settings.RepresentationOfNo; try { DataTable dictionaryTable = dashboardHelper.FieldTable.Copy(); foreach (KeyValuePair <string, string> kvp in dashboardHelper.TableColumnNames) { DataRow row = dictionaryTable.Rows.Find(kvp.Key); if (row == null) { dictionaryTable.Rows.Add(kvp.Key, kvp.Value); } } if (dashboardHelper.IsUsingEpiProject) { dictionaryTable.Columns.Add("Page", typeof(int)); dictionaryTable.Columns.Add("Tab", typeof(int)); dictionaryTable.Columns.Add("Prompt", typeof(string)); dictionaryTable.Columns.Add("Items", typeof(string)); foreach (DataRow fieldRow in dictionaryTable.Rows) { if (fieldRow["epifieldtype"] is RenderableField) { RenderableField renderableField = fieldRow["epifieldtype"] as RenderableField; fieldRow["Page"] = renderableField.Page.Position + 1; fieldRow["Tab"] = renderableField.TabIndex; fieldRow["Prompt"] = renderableField.PromptText; if (renderableField is GroupField) { GroupField groupField = renderableField as GroupField; fieldRow["Items"] = groupField.ChildFieldNames; } else if (renderableField is OptionField) { OptionField optionField = renderableField as OptionField; fieldRow["Items"] = optionField.GetOptionsString(); } } } dictionaryTable.Columns["columnname"].SetOrdinal(0); dictionaryTable.Columns["Prompt"].SetOrdinal(1); dictionaryTable.Columns["formname"].SetOrdinal(2); dictionaryTable.Columns["Page"].SetOrdinal(3); dictionaryTable.Columns["Tab"].SetOrdinal(4); dictionaryTable.Columns["datatype"].SetOrdinal(5); dictionaryTable.Columns["epifieldtype"].SetOrdinal(6); dictionaryTable.Columns["tablename"].SetOrdinal(7); dictionaryTable.Columns["Items"].SetOrdinal(8); } if (dictionaryTable == null || dictionaryTable.Rows.Count == 0) { //this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), "There are no valid fields to display."); this.Dispatcher.BeginInvoke(new SimpleCallback(SetToFinishedState)); Debug.Print("Data dictionary thread cancelled"); return; } else if (worker.CancellationPending) { //this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), SharedStrings.DASHBOARD_GADGET_STATUS_OPERATION_CANCELLED); this.Dispatcher.BeginInvoke(new SimpleCallback(SetToFinishedState)); Debug.Print("Data dictionary thread cancelled"); return; } else { e.Result = dictionaryTable; //this.Dispatcher.BeginInvoke(addGrid, "", "", dictionaryTable.Columns.Count); //string formatString = string.Empty; //this.Dispatcher.BeginInvoke(renderHeader, "", "", dictionaryTable.Columns); //int rowCount = 1; //int columnCount = 1; //foreach (System.Data.DataRow row in dictionaryTable.Rows) //{ // bool isGroup = false; // this.Dispatcher.Invoke(addRow, "", 30); // this.Dispatcher.BeginInvoke(setText, "", new TextBlockConfig(StringLiterals.SPACE + rowCount.ToString() + StringLiterals.SPACE, new Thickness(2, 0, 2, 0), VerticalAlignment.Center, HorizontalAlignment.Center, rowCount, 0, Visibility.Visible), FontWeights.Normal); // columnCount = 1; // foreach (DataColumn column in dictionaryTable.Columns) // { // string displayValue = row[column.ColumnName].ToString(); // if (column.ColumnName.Equals("epifieldtype")) // { // displayValue = displayValue.Replace("Epi.Fields.", ""); // if (isGroup) // { // displayValue = "GroupField"; // } // } // else if (column.ColumnName.Equals("columnname")) // { // isGroup = dashboardHelper.GetGroupFieldsAsList().Contains(displayValue); // } // this.Dispatcher.BeginInvoke(setText, "", new TextBlockConfig(displayValue, new Thickness(8, 8, 8, 8), VerticalAlignment.Center, HorizontalAlignment.Left, rowCount, columnCount, Visibility.Visible), FontWeights.Normal); // columnCount++; // } // rowCount++; //} //this.Dispatcher.BeginInvoke(drawBorders, ""); } //this.Dispatcher.BeginInvoke(new SimpleCallback(RenderFinish)); this.Dispatcher.BeginInvoke(new SimpleCallback(SetToFinishedState)); } catch (Exception ex) { //this.Dispatcher.BeginInvoke(new RenderFinishWithErrorDelegate(RenderFinishWithError), ex.Message); this.Dispatcher.BeginInvoke(new SimpleCallback(SetToFinishedState)); } finally { stopwatch.Stop(); Debug.Print("Data dictionary took " + stopwatch.Elapsed.ToString() + " seconds to complete with " + dashboardHelper.RecordCount.ToString() + " records and the following filters:"); Debug.Print(dashboardHelper.DataFilters.GenerateDataFilterString()); } } }