Ejemplo n.º 1
0
 // save
 private void button12_Click(object sender, EventArgs e)
 {
     try {
         int j = 0;
         arr save = new arr();
         save.data = new int[i];
         for (j = 0; j < i; j++) {
             save.data[j] = mouse_pos[j];
         }
         save.num = j;
         SaveXML.SaveData(save, "data.xml");
         listView1.Items.Clear();
         listView1.Items.Add("Saved");
     }
     catch
     {
         listView1.Items.Clear();
         listView1.Items.Add("Unexpected error");
     }
 }
Ejemplo n.º 2
0
 private void button12_Click(object sender, EventArgs e) // save
 {
     try {
         int j    = 0;
         arr save = new arr();
         save.data = new int[i];
         for (j = 0; j < i; j++)
         {
             save.data[j] = mouse_pos[j];
         }
         save.num = j;
         SaveXML.SaveData(save, "data.xml");
         listView1.Items.Clear();
         listView1.Items.Add("Saved");
     }
     catch
     {
         listView1.Items.Clear();
         listView1.Items.Add("Unexpected error");
     }
 }
Ejemplo n.º 3
0
 private void button13_Click(object sender, EventArgs e) // load
 {
     if (File.Exists("data.xml"))
     {
         XmlSerializer xs   = new XmlSerializer(typeof(arr));
         FileStream    read = new FileStream("data.xml", FileMode.Open, FileAccess.Read, FileShare.Read);
         arr           load = (arr)xs.Deserialize(read);
         i = 0;
         for (i = 0; i < load.num; i++)
         {
             mouse_pos[i] = load.data[i];
         }
         listView1.Items.Clear();
         listView1.Items.Add("Loaded");
         read.Close();
     }
     else
     {
         listView1.Items.Clear();
         listView1.Items.Add("Could not find save file");
     }
 }