Exemplo n.º 1
0
        /// <summary>
        /// 获取指定时间的Tag
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="curtags"></param>
        private void GetDateTimeTag(DateTime dt, out Dictionary <string, CardImg> curtags)
        {
            int      index = 0;
            DateTime curtagdt;

            curtags = new Dictionary <string, CardImg>();
            while (Allpack.Count > 0 && index < Allpack.Count)
            {
                curtagdt = new DateTime(Allpack[index].ReceiTime.Year, Allpack[index].ReceiTime.Month, Allpack[index].ReceiTime.Day, Allpack[index].ReceiTime.Hour, Allpack[index].ReceiTime.Minute, Allpack[index].ReceiTime.Second);
                if (DateTime.Compare(dt, curtagdt) == 0)
                {
                    CardImg tag   = null;
                    string  strid = Allpack[index].ID[0].ToString("X2") + Allpack[index].ID[1].ToString("X2");
                    if (curtags.TryGetValue(strid, out tag))
                    {
                        tag = (CardImg)Form1.CopyObject(Allpack[index]);
                    }
                    else
                    {
                        curtags.Add(strid, Allpack[index]);
                    }
                }
                else if (DateTime.Compare(curtagdt, dt) < 0)
                {
                    Allpack.RemoveAt(index);
                }
                else
                {
                    return;
                }
                index++;
            }
            return;
        }
Exemplo n.º 2
0
        //得到文件
        public static void GetRecord(string strfile, ref List <CardImg> tags)
        {
            lock (obj_lock)
            {
                savefstr = new FileStream(strfile, FileMode.Open, FileAccess.Read);
                byte[]  bytes = new byte[tagpacklen];
                CardImg tpk   = null;
                int     place = 1;

                int curlen = savefstr.Read(bytes, 0, bytes.Length);
                //每次读取的字节数必须为tagpacklen长度
                while (curlen >= tagpacklen)
                {   //0xfd(1byte)+0x01(1byte)+ID(3byte)+Type(1byte)+RD(3byte)+Sig(1byte)+Batt(1byte)+NoExe(2byte)+Sleep(2byte)+ReportDT(7byte)+index(1byte)+cs(1byte)+0xfc(1byte)
                    tpk = new CardImg();

                    tags.Add(tpk);
                    savefstr.Seek(tagpacklen * place, SeekOrigin.Begin);
                    curlen = savefstr.Read(bytes, 0, bytes.Length);
                    place++;
                }
                if (null != savefstr)
                {
                    savefstr.Close();
                }
                savefstr = null;
            }
        }
Exemplo n.º 3
0
        //TagPack => bytes
        public static byte[] ParseTagPack(CardImg tpk)
        {
            //数据包格式:0xfd(1byte)+0x01(1byte)+ID(2byte)+Type(1byte)+RD(2byte)+Sig(1byte)+Batt(1byte)+NoExe(2byte)+Sleep(2byte)+ReportDT(7byte)+index(1byte)+cs(1byte)+0xfc(1byte)
            byte[] bytes = new byte[tagpacklen];
            bytes[0] = 0xfd;
            bytes[1] = 0x01;

            bytes[21] = 0;
            for (int i = 0; i < 21; i++)
            {
                bytes[21] += bytes[i];
            }
            bytes[22] = 0xfc;
            return(bytes);
        }
Exemplo n.º 4
0
        private void YesBtnClick(object sender, RoutedEventArgs e)
        {
            this.luckyOffer.Accept();
            DoubleAnimation da = new DoubleAnimation();

            da.From     = 150;
            da.To       = 0;
            da.Duration = new Duration(TimeSpan.FromMilliseconds(350));
            CardImg.BeginAnimation(Image.HeightProperty, da);
            MessageTextBox.Text = this.luckyOffer.CardMessage;

            YesBtn.IsEnabled  = false;
            YesBtn.Visibility = Visibility.Collapsed;
            NoBtn.IsEnabled   = false;
            NoBtn.Visibility  = Visibility.Collapsed;
            OKBtn.IsEnabled   = true;
            OKBtn.Visibility  = Visibility.Visible;
        }
Exemplo n.º 5
0
        private void MyTimer_Tick(Object obj, EventArgs args)
        {
            CardImg tagimg = null;
            string  strname = "", strtag = "";

            if (null == frm)
            {
                return;
            }
            recordtb.Clear();
            try
            {
                foreach (KeyValuePair <string, PrecisePositionLibrary.TagPack> tag in PrecisePositionLibrary.PrecisePosition.TagPacks)
                {
                    //判断是否是跟踪模式
                    if (frm.isTrace)
                    {
                        if (!tag.Key.Equals(frm.TraceTagId))
                        {
                            continue;
                        }
                    }
                    frm.CardImgs.TryGetValue(tag.Key, out tagimg);
                    if (null == tagimg || !tagimg.isShowTag)
                    {
                        continue;
                    }
                    if (null == recordtb || recordtb.IsDisposed)
                    {
                        return;
                    }
                    strname = Ini.GetValue(Ini.CardPath, tag.Key, Ini.Name);
                    strtag  = ((null == strname) || "".Equals(strname)) ? (tag.Key) : (strname + "(" + tag.Key + ")");
                    recordtb.AppendText("####TagID:" + strtag + " index:" + tag.Value.index + " BasicStationTotalNum:" + tag.Value.TotalbasicNum + " ReceiveBasicStationNum:" + tag.Value.CurBasicNum + "\r\n");
                    foreach (KeyValuePair <string, PrecisePositionLibrary.BasicReportTag> br in tag.Value.CurBasicReport)
                    {
                        strname = Ini.GetValue(Ini.PortPath, br.Key, Ini.Name);
                        strtag  = ((null == strname) || "".Equals(strname)) ? (br.Key) : (strname + "(" + br.Key + ")");
                        recordtb.AppendText("        BasicStationID:" + strtag + " Priority:" + br.Value.Priority + " Distanse:" + string.Format("{0:F2}", br.Value.distanse) + "\r\n");
                    }
                }
            }
            catch (Exception) { }
        }
Exemplo n.º 6
0
        public override void SetData(int card, int num)
        {
            Any.gameObject.SetActive(card == 0);

            CardImg.gameObject.SetActive(card != 0);

            if (card != 0)
            {
                CardImg.sprite = GameCenter.Assets.GetMahjongSprite(card);
                CardImg.SetNativeSize();

                CardValue.text = GameCenter.Shortcuts.MahjongQuery.Query(card) + "张";
            }
            else
            {
                //任意牌
                CardValue.text = GameCenter.DataCenter.LeaveMahjongCnt.ToString() + "张";
            }
        }
Exemplo n.º 7
0
 private void ShowTag()
 {
     try
     {
         Dictionary <string, CardImg> dictags = new Dictionary <string, CardImg>();
         string StrID = "";
         int    index = 0;
         //String strgroupid = "";
         while (isStop)
         {
             if (DateTime.Compare(startdt, enddt) >= 0)
             {//达到设置的最终时间后,停止显示
                 isStop = false;
                 this.Invoke(new Action(() =>
                 {
                     StopTrace();
                 }));
                 break;
             }
             Thread.Sleep((int)(TabSec * 1000));
             this.Invoke(new Action(() =>
             {
                 label8.Text = "The current time is " + startdt.ToString();
             }));
             //Allpack是所有记录讯息
             for (int i = index; i < Allpack.Count; i++)
             {
                 if (DateTime.Compare(startdt, Allpack[i].ReceiTime) < 0)
                 {//此时时间早于数据包上报的时间
                     index = i;
                     break;
                 }
                 StrID = Allpack[i].ID[0].ToString("X2") + Allpack[i].ID[1];
                 CardImg tagimg = null;
                 if (dictags.TryGetValue(StrID, out tagimg))
                 {
                     tagimg.CardPoint    = Allpack[i].CardPoint;
                     tagimg.isShowImg    = Allpack[i].isShowImg;
                     tagimg.LocaType     = Allpack[i].LocaType;
                     tagimg.isOverNoMove = Allpack[i].isOverNoMove;
                     tagimg.isLowBattery = Allpack[i].isLowBattery;
                     System.Buffer.BlockCopy(Allpack[i].GroupID, 0, tagimg.GroupID, 0, 2);
                 }
                 else
                 {
                     dictags.Add(StrID, (CardImg)Form1.CopyObject(Allpack[i]));
                 }
             }
             if (!Parameter.isSupportMulArea)
             {
                 if (TraceMode == 0)
                 {//以坐标进行显示时每次清楚地图
                     if (!Parameter.isSupportMulArea)
                     {
                         CurBitMap = DxfMapParam.GetDxfMap(StrMapPath, Dxf.scale, DrawPanel.Width / 2, DrawPanel.Height / 2, DrawPanel.Width, DrawPanel.Height);
                         if (null == CurBitMap)
                         {
                             continue;
                         }
                         else
                         {
                             DrawPanel_Paint(null, null);
                         }
                     }
                 }
             }
             DrawTagNode(dictags);
             try
             {
                 startdt = startdt.AddSeconds(1);
             }
             catch (Exception)
             {
             }
         }
     }
     catch (System.Threading.ThreadAbortException)
     {
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
         return;
     }
 }