private void RequestReadVariantCoding_OnResponse(Object response) { Diagnostic.DiagnosticResponse res = (Diagnostic.DiagnosticResponse)response; MethodInvoker LabelUpdate = delegate { lCOMStatus.Text = "Request Read Variant Coding Data: Response Received!"; lCOMStatus.BackColor = System.Drawing.SystemColors.Control; if (res.Positive == true) { // set country variant bits depending on what country name was received mVCCountryType = System.Convert.ToByte(res.GetParameter("Codingstring.CountryType", Diagnostic.eValueType.cNumericValue)); // set vehicle type bits depending on what vehicle type was received mVCVehicleType = System.Convert.ToByte(res.GetParameter("Codingstring.VehicleType", Diagnostic.eValueType.cNumericValue)); // set special settings bits mVCSpecial = System.Convert.ToByte(res.GetParameter("Codingstring.SpecialAdjustment", Diagnostic.eValueType.cNumericValue)); //assign recieved data to the correspondending GUI Elements AssignDataToGui(); lWriteStatus.Text = "Reading succeeded!"; lWriteStatus.BackColor = System.Drawing.Color.Lime; } else { lWriteStatus.Text = "Request Programming Session failed!"; lWriteStatus.BackColor = System.Drawing.Color.Red; } }; SendDefaultSessionRequest(); Invoke(LabelUpdate); }
private void RequestSeedRequest_OnResponse(Object response) { Diagnostic.DiagnosticResponse res = (Diagnostic.DiagnosticResponse)response; MethodInvoker LabelUpdate = delegate { lCOMStatus.Text = "Request Seed Request: Response Received!"; lCOMStatus.BackColor = System.Drawing.SystemColors.Control; if (res.Positive == true) { long seed, key; seed = System.Convert.ToInt32(res.GetParameter("SecuritySeed", Diagnostic.eValueType.cNumericValue)); key = CalculateKey(seed); key = key & 65535; lWriteStatus.Text = "Seed " + String.Format("{0:X2}", (uint)System.Convert.ToUInt32(seed.ToString())) + " key " + String.Format("{0:X2}", (uint)System.Convert.ToUInt32(key.ToString())); SendSendKeyRequest(key); } else { lWriteStatus.Text = "Seed Request failed!"; lWriteStatus.BackColor = System.Drawing.Color.Red; } }; Invoke(LabelUpdate); }