Exemplo n.º 1
0
        private static string GetInformationToSave(int cas, MainWindow mw)
        {
            ListBox listBox = new ListBox();

            switch (cas)
            {
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                    break;
                case 4:
                    break;
                case 5:
                    listBox = mw.listBoxError_Test;
                    break;
            }

            string contents = "";
            foreach (string ligne in listBox.Items)
            {
                contents += ligne + "\r\n";
            }

            return contents;
        }
Exemplo n.º 2
0
        public static void SaveInformations(MainWindow mw, int cas)
        {
            try
            {
                SaveFileDialog saveFile = new SaveFileDialog();
                saveFile.AddExtension = true;
                saveFile.Filter = "Text documents (.txt)|*.txt";
                saveFile.DefaultExt = ".txt";
                bool? result = saveFile.ShowDialog();

                if (result == true)
                {
                    File.WriteAllText(saveFile.FileName, GetInformationToSave(cas, mw));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Erreur", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 3
0
 public Util_Test(MainWindow mw)
 {
     this.mw = mw;
 }