/// <summary> /// Show log profiles settings in the UI /// </summary> /// <param name="profile">log profile</param> void IUserInterface.ShowNewProfileSettings(LogProfile profile) { Trace("ShowNewProfileSettings"); foreach (DataGridViewRow row in this.parameterGrid.Rows) { row.Cells[(int)GridColumns.Enabled].Value = false; foreach (LogColumn column in profile.Columns) { Parameter parameter = column.Parameter; Parameter rowParameter = (Parameter)row.Cells[(int)GridColumns.Parameter].Value; if (rowParameter.Id == parameter.Id) { row.Cells[(int)GridColumns.Enabled].Value = true; DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)row.Cells[(int)GridColumns.Conversions]; Conversion selectedConversion = profile.GetConversions(parameter)[0]; string selectedUnits = selectedConversion.Units; foreach (Conversion conversion in cell.Items) { if (conversion.Units == selectedUnits) { cell.Value = conversion; } } } } } }
/* internal static void CompareArrays<T>(T[] expected, T[] actual) * { * Assert.AreEqual(expected.Length, actual.Length, "Packet length"); * for (int i = 0; i < expected.Length; i++) * { * Assert.AreEqual(expected[i], actual[i], "Offset[" + i.ToString() + "]"); * } * }*/ internal static void AssertContains(LogProfile profile, string parameterId, string conversionUnits) { foreach (LogColumn column in profile.Columns) { if (column.Parameter.Id == parameterId) { IList <Conversion> conversions = profile.GetConversions(column.Parameter); foreach (Conversion conversion in conversions) { if (conversion.Units == conversionUnits) { return; } } } } Assert.Fail("Selected parameters does not contain " + parameterId + " / " + conversionUnits); }
private void AddScreenParameters(LogProfile profile, SawMillScreen screen) { if (this.database == null) { throw new InvalidOperationException("Logger must be connected and database must be initialized before calling AddScreenParameters"); } LogProfile screenProfile = screen.GetProfile(this.database); foreach (LogColumn column in screenProfile.Columns) { Parameter parameter = column.Parameter; IList <Conversion> conversions = screenProfile.GetConversions(parameter); foreach (Conversion conversion in conversions) { profile.Add(parameter, conversion); } } }