Esempio n. 1
0
        private void AddProgram_Button_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Multiselect = false;

            bool?userClickedOK = openFileDialog.ShowDialog();

            // Process input if the user clicked OK.
            if (userClickedOK == true)
            {
                VPNPrograms.Add(openFileDialog.FileName);
                SavePrograms();
            }
        }
Esempio n. 2
0
        private void LoadPrograms()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(List <string>));

            try
            {
                using (TextReader reader = new StreamReader("VPNetMonProgramsList.xml"))
                {
                    foreach (string prog in (List <string>)serializer.Deserialize(reader))
                    {
                        VPNPrograms.Add(prog);
                    }
                    reader.Close();
                }
            }
            catch (Exception ex) { }
        }