} /* ConfigurationLoad */ private void ConfigurationSave() { if (dataFieldAssignments == null) { return; } if (String.IsNullOrEmpty(configFileName)) { return; } System.IO.StreamWriter o = null; try{ o = new System.IO.StreamWriter(configFileName); } catch (Exception) { o = null; return; } o.WriteLine("//ImageViewer Configuration File"); o.WriteLine("//"); o.WriteLine("//DateTime Saved" + "\t" + DateTime.Now.ToString("F")); o.WriteLine("//"); o.WriteLine("DataLabel0" + "\t" + PicesInstrumentData.FieldName(dataFieldAssignments[0])); o.WriteLine("DataLabel1" + "\t" + PicesInstrumentData.FieldName(dataFieldAssignments[1])); o.WriteLine("DataLabel2" + "\t" + PicesInstrumentData.FieldName(dataFieldAssignments[2])); o.WriteLine("DataLabel3" + "\t" + PicesInstrumentData.FieldName(dataFieldAssignments[3])); o.Close(); o = null; } /* ConfigurationSave*/
private void BuildDataFieldList() { int origWindowHeight = this.Height; int origDataFieldListHeight = DataFieldList.Height; int origWindowWidth = this.Width; int origDataFieldListWidth = DataFieldList.Width; int fieldNum = 0; for (fieldNum = 0; fieldNum < PicesInstrumentData.NumFields(); fieldNum++) { DataFieldList.Items.Add(PicesInstrumentData.FieldName(fieldNum)); } DataFieldList.SelectedItem = selectedDataField; int totalHeightNeeded = PicesInstrumentData.NumFields() * DataFieldList.ItemHeight + 30; DataFieldList.Height = totalHeightNeeded; int newWindowHeight = DataFieldList.Height + (origWindowHeight - origDataFieldListHeight); int newWindowWidth = DataFieldList.Width + (origWindowWidth - origDataFieldListWidth); this.Height = newWindowHeight; this.Width = newWindowWidth; }
} /* ConfigurationSave*/ private void UpdateDataFields() { if ((instrumentData == null) || (dataFieldAssignments == null)) { return; } for (int x = 0; x < DataLabels.Length; x++) { DataLabels [x].Text = PicesInstrumentData.FieldName(dataFieldAssignments[x]); displayDataFields[x].Text = instrumentData.FieldToStr(dataFieldAssignments[x]); } } /* UpdatedataFields*/
private void SelectDataField(int dataLabelNum) { String existingSelField = DataLabels[dataLabelNum].Text; SelectAInstrumentDataField f = new SelectAInstrumentDataField(existingSelField); f.ShowDialog(); string newSelectedDataFieldStr = f.SelectedDataField; int fieldIdxNew = PicesInstrumentData.GetFieldNum(newSelectedDataFieldStr); if (fieldIdxNew >= 0) { dataFieldAssignments[dataLabelNum] = fieldIdxNew; DataLabels[dataLabelNum].Text = PicesInstrumentData.FieldName(fieldIdxNew); ConfigurationSave(); } UpdateDataFields(); } /* SelectDataField */