/// <summary>
 /// call this functio before call Show() in the main window
 /// init the controllers to display right contents
 /// </summary>
 /// <param name="mappingPair">
 /// null means adding a new MappingPair
 /// not null means editing a existing pair
 /// </param>
 public void Init(MappingPairType mappingPair)
 {
     this.ClickConfirm = false;
     if (mappingPair == null)
     {
         this.MappingPair = new MappingPairType();
         this.Title = "新建";
     }
     else
     {
         this.MappingPair = mappingPair;
         this.Title = "编辑";
     }
     //do not forget this sentence
     //as the mappingpair is changing, so remember to change the data context
     this.DataContext = this.MappingPair;
 }
 /// <summary>
 /// add or update a mapping pair in the mapping list
 /// </summary>
 /// <param name="oriVkCode"></param>
 /// <param name="mappingVkCode"></param>
 public void UpdateMappingPair(MappingPairType mappingPair)
 {
     Boolean exist = false;
     for (int i = 0; i < this.mappingPairList.Count; i++)
     {
         if (this.mappingPairList[i].OriginalVkCode == mappingPair.OriginalVkCode)
         {
             this.mappingPairList[i] = mappingPair;
             exist = true;
             break;
         }
     }
     if (!exist)
     {
         this.mappingPairList.Add(mappingPair);
     }
     this.mappingDict[mappingPair.OriginalVkCode] = mappingPair.MappingVkCode;
     OnPropertyChanged("MappingPairs");
 }