Ejemplo n.º 1
0
        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)
            {
            }
        }
Ejemplo n.º 3
0
 public void TestToyotaMatchingFirstTwo()
 {
     Assert.AreEqual("Toyota USA - trucks", Vin.GetWorldManufacturer("5TG"));
 }
Ejemplo n.º 4
0
 public void TestInternational()
 {
     Assert.AreEqual("International", Vin.GetWorldManufacturer("1HT"));
 }
Ejemplo n.º 5
0
 public void TestFord()
 {
     Assert.AreEqual("Ford Motor Company", Vin.GetWorldManufacturer("1FD"));
 }
Ejemplo n.º 6
0
 public void TestInvalidWmi()
 {
     Assert.AreEqual(string.Empty, Vin.GetWorldManufacturer("111"));
 }
Ejemplo n.º 7
0
        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);
                }
            });
        }