コード例 #1
0
 private void AddElement()
 {
     using (AddElementDialog dialog = new AddElementDialog())
     {
         dialog.EnsureButtonClick += (sender1, e1) =>
         {
             List <ElementModel> emb = new List <ElementModel>();
             int span = GetSpan(dialog.DataType);
             for (int j = 0, i = 0; j < dialog.AddNums; i += span, j++)
             {
                 ElementModel ele = new ElementModel(dialog.IntrasegmentType != string.Empty, dialog.DataType);
                 ele.AddrType         = dialog.AddrType;
                 ele.DataType         = dialog.DataType;
                 ele.StartAddr        = (uint)(dialog.StartAddr + i);
                 ele.IntrasegmentType = dialog.IntrasegmentType;
                 ele.IntrasegmentAddr = dialog.IntrasegmentAddr;
                 emb.Add(ele);
             }
             Manager.Add(emb);
             foreach (ElementModel ele in emb)
             {
                 CurrentTable.AddElement(
                     Manager.Get(ele));
             }
             dialog.Close();
         };
         dialog.ShowDialog();
     }
 }