Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();
            this.Closing += Window_Closing;
            //name of reader added to the roomnamelist
            roomNameList.Add("111111111111");
            roomNameList.Add("222222222222");
            roomNameList.Add("333333333333");
            roomNameList.Add("444444444444");
            roomNameList.Add("555555555555");
            roomNameList.Add("666666666666");
            roomNameList.Add("777777777777");
            roomNameList.Add("888888888888");
            roomNameList.Add("999999999999");
            roomNameList.Add("AAAAAAAAAAAA");
            roomNameList.Add("BBBBBBBBBBBB");
            roomNameList.Add("CCCCCCCCCCCC");
            roomNameList.Add("000011111111");
            roomNameList.Add("000022222222");
            roomNameList.Add("000033333333");
            roomNameList.Add("000044444444");
            roomNameList.Add("000055555555");
            roomNameList.Add("000066666666");
            roomNameList.Add("000077777777");
            roomNameList.Add("000088888888");
            roomNameList.Add("000099999999");
            roomNameList.Add("0000AAAAAAAA");
            roomNameList.Add("0000BBBBBBBB");
            roomNameList.Add("0000CCCCCCCC");

            //the grid of the room
            for (int i = 1; i < 7; i++)
            {
                Room r = new Room(i, 2 * i - 1, 2);
                r.setReader1(roomNameList[2 * i - 2]);
                r.setReader2(roomNameList[2 * i - 1]);
                roomList.Add(r);
                //add reference tag to each room
                for (int m = 0; m < 8; m++)
                {
                    Tags tag = new Tags(referenceTagX[i], referenceTagY[i], referenceTagId[i]);
                    tag.setRoomNumber(m + 1);
                    r.addTag(tag);
                }
            }
            for (int i = 7; i < 13; i++)
            {
                Room r = new Room(i, 2 * i - 1, 10);
                r.setReader1(roomNameList[2 * i - 2]);
                r.setReader2(roomNameList[2 * i - 1]);
                roomList.Add(r);
                for (int m = 0; m < 8; m++)
                {
                    Tags tag = new Tags(referenceTagX[i], referenceTagY[i], referenceTagId[i]);
                    tag.setRoomNumber(m + 1);
                    r.addTag(tag);
                }
            }

            /**
             * //假设将24个阅读器全部加入到里面
             * MacList.Add("speedwayr-10-74-87");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             * MacList.Add("SpeedwayR-xx-xx-xx");
             *
             * //initialize the readers
             * for (int i = 0; i < 24; i++)
             * {
             *      SpeedwayReader Reader = new SpeedwayReader();
             *      ReaderList.Add(Reader);
             *
             *  try
             *  {
             *      // Connect to the reader.
             *      // Replace "SpeedwayR-xx-xx-xx" with your
             *      // reader's host name or IP address.
             *      SpeedwayReader readertemp = (SpeedwayReader)ReaderList[i];
             *      string macString = (String)MacList[i];
             *      readertemp.Connect(macString);
             *
             *      // Remove all settings from the reader.
             *      readertemp.ClearSettings();
             *
             *      // Get the factory default settings
             *      // We'll use these as a starting point
             *      // and then modify the settings we're
             *      // interested in
             *      Settings settings = readertemp.QueryFactorySettings();
             *      settings.Report.IncludeAntennaPortNumber = true;
             *      settings.Report.Mode = ReportMode.Individual;
             *      readertemp.ApplySettings(settings);
             *
             *      // Assign the TagsReported handler.
             *      // This specifies which function to call
             *      // when tags reports are available.
             *      // This function will in turn call a delegate
             *      // to update the UI (Listbox).
             *      readertemp.TagsReported += new EventHandler<TagsReportedEventArgs>(OnTagsReported);
             *  }
             *  catch (OctaneSdkException ex)
             *  {
             *      // An Octane SDK exception occurred. Handle it here.
             *      System.Diagnostics.Trace.WriteLine("An Octane SDK exception has occured : {0}", ex.Message);
             *  }
             *  catch (Exception ex)
             *  {
             *      System.Diagnostics.Trace.WriteLine("An exception has occured : {0}", ex.Message);
             *      }
             *  }
             **/

            //initialize the images
            for (int i = 2; i < 7; i++)
            {
                Image image = new Image();
                Imagelist.Add(image);
                grad1.Children.Add(image);
                image.Source  = new BitmapImage(new Uri(@"Resources\" + i + ".jpg", UriKind.Relative));
                image.Stretch = Stretch.None;
            }
            referenceTagId.Add("0000-0000-0000");
            referenceTagId.Add("1111-1111-1111");
            referenceTagId.Add("2222-2222-2222");
            referenceTagId.Add("3333-3333-3333");
            referenceTagId.Add("4444-4444-4444");
            referenceTagId.Add("5555-5555-5555");
            referenceTagId.Add("6666-6666-6666");
            referenceTagId.Add("7777-7777-7777");
            referenceTagId.Add("8888-8888-8888");

            //intilize reference tags' information
            //12room and each room has 8 reference tags
            for (int m = 0; m < 12; m++)
            {
                for (int i = 0; i < 8; i++)
                {
                    Tags tag = new Tags(referenceTagX[i], referenceTagY[i], referenceTagId[i]);
                    tag.setRoomNumber(m + 1);
                    referenceTagList.Add(tag);
                }
            }
            //initilize untracked tags' information
            for (int i = 0; i < 5; i++)
            {
                Tags tag = new Tags(0, 0, id[i]);
                untrackTagList.Add(tag);
            }
            timer.Interval = TimeSpan.FromMilliseconds(1000);
            timer.Tick    += new EventHandler(changePosition); //你的事件
            timer.Start();
        }
Beispiel #2
0
 public void addTag(Tags tag)
 {
     t.Add(tag);
 }