public void TestVINClicked(object sender, EventArgs e) { if (Vin.IsValid(VINNumber.Text) == false) { DisplayAlert("Vin Number", "VIN number is not valid", "Ok"); } else { Year.Text = Vin.GetModelYear(VINNumber.Text).ToString(); Manufacturer.SelectedItem = Vin.GetWorldManufacturer(VINNumber.Text); } }
public HitForm(string[] hit_info) { InitializeComponent(); int[] colors = new int[4] { 255, 128, 128, 128 }; string tmp = ""; try { tmp = hit_info[2].Replace("Color [", "").Replace("]", ""); string[] colors_temp = tmp.Split(','); colors[0] = int.Parse(colors_temp[0].Replace("A=", "").Replace(",", "")); colors[1] = int.Parse(colors_temp[1].Replace("R=", "").Replace(",", "")); colors[2] = int.Parse(colors_temp[2].Replace("G=", "").Replace(",", "")); colors[3] = int.Parse(colors_temp[3].Replace("B=", "").Replace(",", "")); } catch (Exception ex) { } label_database.BackColor = Color.FromArgb(colors[0], colors[1], colors[2], colors[3]); label_database.Text = hit_info[8]; label_vrm.Text = hit_info[13]; label_field1.Text = hit_info[3]; label_field2.Text = hit_info[4]; label_field3.Text = hit_info[5]; label_field4.Text = hit_info[6]; label_field5.Text = hit_info[7]; label_make.Text = Vin.GetWorldManufacturer(hit_info[3]); label_model.Text = Vin.GetModelYear(hit_info[3]).ToString(); label_information.Text = hit_info[8]; try { System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"sounds\Siren.wav"); player.Play(); } catch (Exception) { } }
public void TestGetYearForAForceDown() { Assert.AreEqual(1980, Vin.GetModelYear("111111111A", 1980)); }
public void TestGetYearForA() { Assert.AreEqual(2010, Vin.GetModelYear("111111111A")); }
public void TestGetYear() { Assert.AreEqual(2001, Vin.GetModelYear("1111111111")); }
public void TestGetYearForDChar() { Assert.AreEqual(2013, Vin.GetModelYear('D'), "This should be 2013 because 1983 is less likely (given now is 2016)."); }
public void TestGetYearForK() { Assert.AreEqual(1989, Vin.GetModelYear("111111111K"), "This should be 1989 because 2019 vehicles do not exist yet (given now is 2016)."); }
private void TagReceived(object sender) { var tag = (ReadTag)sender; this.Invoke((MethodInvoker) delegate() { try { tag.tagVIN = tag.tagVIN.Trim(); tag.tagVIN = tag.tagVIN.Replace("\0", ""); if (tag.tagVIN != "" & tag.tagVIN != _lastVIN) { iCountReads++; lblReadTags.Text = iCountReads.ToString(); DataRow t = tableReads.NewRow(); t.ItemArray = new Object[] { tag.tagEPC, tag.tagUSER, tag.tagFolio, tag.tagVIN, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), Vin.GetWorldManufacturer(tag.tagVIN), Vin.GetModelYear(tag.tagVIN).ToString(), tag.anntena.Equals("antenna=2") ? "Left" : "Right", "" }; _lastVIN = tag.tagVIN; try { System.Media.SoundPlayer player = new System.Media.SoundPlayer(@"sounds\Beep.wav"); player.Play(); } catch (Exception) { } DateTime dt = DateTime.Now; List <string> rwesult = hls.SearchVIN(tag.tagVIN); hitLogger.Debug("Search time: " + (DateTime.Now - dt).TotalMilliseconds.ToString()); foreach (string result in rwesult) { t.SetField <string>("Hit", "True"); string[] data = result.Split('|'); if (data.Length != 15) { continue; } hitLogger.Info(result); new HitForm(data).ShowDialog(); } tableReads.Rows.Add(t); dgvReaders.FirstDisplayedScrollingRowIndex = 0; } } catch (Exception ex) { Console.WriteLine(ex); } }); }