Пример #1
0
        private void buttonSaveAndExit_Click(object sender, EventArgs e)
        {
            string Date = DateTime.Now.ToLongDateString();
            string Time = DateTime.Now.ToLongTimeString();

            MessageBox.Show($"Saved!\n{Date}\n{Time}");
            // Display Screen
            var newForm = new DisplayScreen();

            newForm.Show();
        }
Пример #2
0
        private void buttonSaveAndExit_Click(object sender, EventArgs e)
        {
            Method.Contacts = Contacts;
            string Date = DateTime.Now.ToLongDateString();
            string Time = DateTime.Now.ToLongTimeString();
            MessageBox.Show($"Saved!\n{Date}\n{Time}");

            // Display Screen
            var newForm = new DisplayScreen();
            newForm.Show();

            // Save/Write Data to text file 
            string file_name = @"FileSave";
            string str = JsonConvert.SerializeObject(Contacts);
            File.WriteAllText(file_name, str);
        }