예제 #1
0
 public Settings()
 {
     try
     {
         InitializeComponent();
         reader = new XML(@"C:\ProgramData\Autodesk\Inventor Addins\Modules.xml");
         strs   = new System.Collections.Generic.List <string>();
         attr   = new List <string>();
         strs   = reader.ReadXML("Spec", ref attr);
         string[] names = attr.ToArray();
         lstbox.Items.AddRange(names);
         lstbox.CheckOnClick = true;
         bool check;
         for (int i = 0; i < lstbox.Items.Count; i++)
         {
             if (strs[i] == "1")
             {
                 check = true;
             }
             else
             {
                 check = false;
             }
             lstbox.SetItemChecked(i, check);
         }
         reader.Save();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
예제 #2
0
 private void btn_Click(object sender, EventArgs e)
 {
     try
     {
         bool check;
         for (int i = 0; i < lstbox.Items.Count; i++)
         {
             check = lstbox.GetItemChecked(i);
             if (check)
             {
                 strs[i] = "1";
             }
             else
             {
                 strs[i] = "0";
             }
         }
         reader.WriteXML(strs);
         reader.Save();
         Macros.StandardAddInServer.settings();
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }