private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            string       container = "";
            int          counter   = 0;
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");

            while ((line = file.ReadLine()) != null)
            {
                if (counter == 2)
                {
                    line      = "";
                    container = container + " " + line;
                }
                else
                {
                    container = container + " " + line;
                }
                counter++;
            }
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.clearPlayerInventory(container);
            PlayerCapacity pi = new PlayerCapacity();

            pi.Show();
            this.Close();
        }
        private void bntPlayerCapacity_Click(object sender, RoutedEventArgs e)
        {
            PlayerCapacity pc = new PlayerCapacity();

            pc.Show();
            this.Close();
        }
 private void btnDeleteCapacity_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (lboxPlayerCapacity.SelectedItem != null)
         {
             lboxPlayerCapacity.Items.Remove(lboxPlayerCapacity.SelectedItem);
             var list = "";
             foreach (var item in lboxPlayerCapacity.Items)
             {
                 list = list + "/" + item.ToString();
             }
             string       container = "";
             int          counter   = 0;
             string       line;
             StreamReader file = new StreamReader(@"c:\JDR(Lisa)\PlayerCreation.txt");
             while ((line = file.ReadLine()) != null)
             {
                 if (counter == 2)
                 {
                     container = container + " " + list;
                 }
                 else
                 {
                     container = container + " " + line;
                 }
                 counter++;
             }
             file.Close();
             Service.TXTFile tf = new Service.TXTFile();
             tf.change(container, "PlayerCreation");
             PlayerCapacity pi = new PlayerCapacity();
             pi.Show();
             this.Close();
         }
         else
         {
             MessageBox.Show("Aucune ligne n'est sélectionnée.");
         }
     }
     catch (Exception error)
     {
         MessageBox.Show(error.Message);
     };
 }
Exemple #4
0
        private void bntAddCapacity_Click(object sender, RoutedEventArgs e)
        {
            string       item      = txtAddCapacity.Text;
            string       container = "";
            string       line;
            StreamReader file = new StreamReader(@"c:\JDR(Lisa)\ListCapacity.txt");

            while ((line = file.ReadLine()) != null)
            {
                container = container + " " + line;
            }
            container = container + " " + item;
            file.Close();
            Service.TXTFile tf = new Service.TXTFile();
            tf.change(container, "ListCapacity");
            PlayerCapacity ac = new PlayerCapacity();

            ac.Show();
            this.Close();
        }