示例#1
0
 private void LoadFile()
 {
     try
     {
         Dictionary <string, string> dictionary = new Dictionary <string, string>();
         XmlRead read = new XmlRead();
         Dictionary <string, string> item = read.GetItem(FileName.File1);
         foreach (KeyValuePair <string, string> pair in item)
         {
             this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value);
             dictionary.Add(pair.Key, pair.Value);
         }
         this.combobox.Items.Add("----------------------");
         Dictionary <string, string> dictionary3 = read.GetItem(FileName.File2);
         foreach (KeyValuePair <string, string> pair in dictionary3)
         {
             this.combobox.Items.Add("[" + pair.Key + "]" + pair.Value);
             dictionary.Add(pair.Key, pair.Value);
         }
         this.file_1.set_FileFilter("Excel文件(*.xls)|*.xls");
         this.file_2.set_FileFilter("Excel文件(*.xls)|*.xls");
         this.file_1.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File1Path");
         this.file_2.get_TextBoxFile().Text = IniRead.GetPrivateProfileString("File", "File2Path");
         this.com_sheet_1.Text = IniRead.GetPrivateProfileString("File", "TableInFile1");
         this.com_sheet_2.Text = IniRead.GetPrivateProfileString("File", "TableInFile2");
         string privateProfileString = IniRead.GetPrivateProfileString("FieldCon", "FileNumber");
         int    result = 1;
         int.TryParse(privateProfileString, out result);
         this.radioButton1.Checked = result == 1;
         this.radioButton2.Checked = result == 2;
         DataGridView view  = this.dataGridView1;
         DataTable    table = WenBenItem.Items();
         foreach (DataRow row in table.Rows)
         {
             string str2 = IniRead.GetPrivateProfileString("FieldCon", row["key"].ToString());
             if (str2 != "0.0")
             {
                 view.Rows[Convert.ToInt32(row["id"]) - 1].Cells["WenJianLie"].Value = str2;
             }
         }
         view.Rows[6].Cells["MoRen"].Value    = IniRead.GetPrivateProfileString("FieldCon", "DefaultFuHeRen");
         view.Rows[7].Cells["MoRen"].Value    = IniRead.GetPrivateProfileString("FieldCon", "DefaultShouKuanRen");
         view.Rows[0x13].Cells["MoRen"].Value = IniRead.GetPrivateProfileString("FieldCon", "DefaultShuiLv");
         this.combo_1.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "MainTableField") + "]" + read.GetKey1();
         this.combo_2.Text = "[" + IniRead.GetPrivateProfileString("TableCon", "AssistantTableField") + "]" + read.GetKey2();
         this.txt_1.Text   = IniRead.GetPrivateProfileString("TableCon", "MainTableIgnoreRow");
         this.txt_2.Text   = IniRead.GetPrivateProfileString("TableCon", "AssistantTableIgnoreRow");
     }
     catch (Exception exception)
     {
         HandleException.HandleError(exception);
     }
 }