public static Cleanup GetInstance()
 {
     if (_Instance == null)
     {
         _Instance = new Cleanup();
         _Instance.FilesToDelete = new List <string>();
     }
     return(_Instance);
 }
        private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            Logging.WriteLine("Cleanup ...");
            foreach (string file in Cleanup.GetInstance().FilesToDelete)
            {
                try
                {
                    Logging.WriteLine(string.Format("Deleting file '{0}'", file));
                    System.IO.File.Delete(file);
                }
                catch (Exception ex)
                {
                    Logging.WriteLine(string.Format("Unable to delete file: {0}", ex.Message));
                }
            }

            Logging.WriteLine("Stopping chat notifier.");
            Properties.Settings.Default.Save();
        }