• Dictionary tabPage使用


      1 public override bool AccptChange() 
      2       { 
      3           //if (oldvalue == null || oldvalue.Count <= 0) 
      4           //{ 
      5           //    return true; 
      6           //} 
      7           Dictionary<string, object>[] g = new Dictionary<string, object>[4]; 
      8           g[0] = new Dictionary<string, object>(); 
      9           g[1] = new Dictionary<string, object>(); 
     10           g[2] = new Dictionary<string, object>(); 
     11           g[3] = new Dictionary<string, object>();        
     12           foreach (var item in oldvalue) 
     13           {                
     14                   string tabitem = item.Key.ToString().Remove(3); 
     15                   if (tabitem == "Do1") 
     16                   {  
     17                      if (rdcheck1.Checked) 
     18                      { 
     19                          g[0].Add(item.Key, item.Value); 
     20                          g[0] = FillControl.GetValueNew(list); 
     21                          if (SetSetting(g[0],1)) 
     22                          {                                
     23                              return true; 
     24                          } 
     25                          return false; 
     26                      }     
     27                   } 
     28                   if (tabitem == "Do2") 
     29                   {  
     30                       if (rdcheck2.Checked) 
     31                       { 
     32                           g[1].Add(item.Key, item.Value); 
     33                           g[1] = FillControl.GetValueNew(listDO2); 
     34                           if (SetSetting(g[1],2)) 
     35                           { 
     36                               this.tabPage2.Parent = this.tabControl1; 
     37                               this.tabPage1.Parent = null; 
     38                               this.tabPage3.Parent = null; 
     39                               this.tabPage4.Parent = null; 
     40                               return true; 
     41                           } 
     42                           return false; 
     43                       }   
     44                   } 
     45                   if (tabitem == "Do3") 
     46                   { 
     47                       if (rdcheck3.Checked) 
     48                       { 
     49                           g[2].Add(item.Key, item.Value); 
     50                           g[2] = FillControl.GetValueNew(listDO3); 
     51                           if (SetSetting(g[2],3)) 
     52                           { 
     53                               return true; 
     54                           } 
     55                           return false; 
     56                       } 
     57                   } 
     58                   if (tabitem == "Do4") 
     59                   { 
     60                       if (rd4check.Checked) 
     61                       { 
     62                           g[3].Add(item.Key, item.Value); 
     63                           g[3] = FillControl.GetValueNew(listDO4); 
     64                           if (SetSetting(g[3],4)) 
     65                           { 
     66                               return true; 
     67                           } 
     68                           return false; 
     69                       } 
     70                   }                     
     71           } 
     72           return false; 
     73       } 
     74       public override bool CancelChange() 
     75       { 
     76           //if (oldvalue == null || oldvalue.Count <= 0) 
     77           //{ 
     78           //    return false; 
     79           //} 
     80           Dictionary<string, object>[] g = new Dictionary<string, object>[4]; 
     81           g[0] = new Dictionary<string, object>(); 
     82           g[1] = new Dictionary<string, object>(); 
     83           g[2] = new Dictionary<string, object>(); 
     84           g[3] = new Dictionary<string, object>(); 
     85           foreach (var item in oldvalue) 
     86           { 
     87               string tabitem = item.Key.ToString().Remove(3); 
     88               if (tabitem == "Do1") 
     89               { 
     90                   if (rdcheck1.Checked) 
     91                   { 
     92                       g[0].Add(item.Key, item.Value); 
     93                       g[0] = FillControl.GetValueNew(list); 
     94                       if (SetSetting(g[0], 1)) 
     95                       { 
     96                           this.tabPage1.Parent = this.tabControl1; 
     97                           this.tabPage2.Parent = null; 
     98                           this.tabPage3.Parent = null; 
     99                           this.tabPage4.Parent = null; 
    100                           return true; 
    101                       } 
    102                       return false; 
    103                   } 
    104               } 
    105               if (tabitem == "Do2") 
    106               { 
    107                   if (rdcheck2.Checked) 
    108                   { 
    109                       g[1].Add(item.Key, item.Value); 
    110                       g[1] = FillControl.GetValueNew(listDO2); 
    111                       if (SetSetting(g[1], 2)) 
    112                       { 
    113                           this.tabPage2.Parent = this.tabControl1; 
    114                           this.tabPage1.Parent = null; 
    115                           this.tabPage3.Parent = null; 
    116                           this.tabPage4.Parent = null; 
    117                           return true; 
    118                       } 
    119                       return false; 
    120                   } 
    121               } 
    122               if (tabitem == "Do3") 
    123               { 
    124                   if (rdcheck3.Checked) 
    125                   { 
    126                       g[2].Add(item.Key, item.Value); 
    127                       g[2] = FillControl.GetValueNew(listDO3); 
    128                       if (SetSetting(g[2], 3)) 
    129                       { 
    130                           return true; 
    131                       } 
    132                       return false; 
    133                   } 
    134               } 
    135               if (tabitem == "Do4") 
    136               { 
    137                   if (rd4check.Checked) 
    138                   { 
    139                       g[3].Add(item.Key, item.Value); 
    140                       g[3] = FillControl.GetValueNew(listDO4); 
    141                       if (SetSetting(g[3], 4)) 
    142                       { 
    143                           return true; 
    144                       } 
    145                       return false; 
    146                   } 
    147               } 
    148           }          
    149           return false; 
    150       }
    151 收藏于 2013-06-07
  • 相关阅读:
    两种称谓
    HDU 1074

    Educational Codeforces Round 44
    nowcoder—Beauty of Trees
    nowcoder-练习赛16
    c++作业-8
    差的东西
    nowcoder-挑战赛14
    BZOJ2548 [CTSC2002] 灭鼠行动
  • 原文地址:https://www.cnblogs.com/dqh123/p/9469827.html
Copyright © 2020-2023  润新知