Example #1
0
 private void RemoveProgram_Button_Click(object sender, RoutedEventArgs e)
 {
     if (SelectedProgram != null)
     {
         VPNPrograms.Remove(SelectedProgram);
         SavePrograms();
     }
 }
Example #2
0
        private void SavePrograms()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(List <string>));

            using (TextWriter writer = new StreamWriter("VPNetMonProgramsList.xml"))
            {
                serializer.Serialize(writer, VPNPrograms.ToList());
                writer.Close();
            }
        }
Example #3
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();
            }
        }
Example #4
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) { }
        }