Exemple #1
0
 private void MakeMemCard(int iUpdateFlag)
 {
     foreach (var item in lstCardsByDb)
     {
         if (dicMemCardWithAllInfo.ContainsKey(item.Id))
         {
             MemCardWithCommDev mem = dicMemCardWithAllInfo[item.Id];
             mem.UpdateFlag = iUpdateFlag;
             if (mem.cardInfo.UpdateDt.Value != item.UpdateDt)
             {
                 mem.cardInfo = item; // 更新
                 // todo 可能会造成内存泄漏,一直有部分list没有删除
             }
         }
         else
         {
             MemCardWithCommDev aNewMemCard = new MemCardWithCommDev()
             {
                 cardInfo   = item,
                 RefProject = null,
                 UpdateFlag = iUpdateFlag
             };
             dicMemCardWithAllInfo.Add(aNewMemCard.cardInfo.Id, aNewMemCard);
         }
     }
 }
Exemple #2
0
        private void timerGetStatus_Tick(object sender, EventArgs e)
        {
            try
            {
                foreach (ListViewItem item in listViewCardList.Items)
                {
                    MemCfgInfo.MemCardWithCommDev dev = item.Tag as MemCfgInfo.MemCardWithCommDev;

                    item.SubItems[1].Text  = DbConstDefine.GetStringByStatus((DbConstDefine.ValueFlag)dev.CurStatus);
                    item.SubItems[11].Text = dev.strGettedValues;
                    item.SubItems[12].Text = dev.dtGetted.ToString();
                }

                buttonStart.Enabled = !TcpServerForGPRSDev.Get().GetStatus();
                buttonStop.Enabled  = TcpServerForGPRSDev.Get().GetStatus();
            }
            catch (Exception ex)
            {
                LogMgr.WriteErrorDefSys("timer get status error:");
                LogMgr.WriteErrorDefSys(ex.Message);
            }
        }