Пример #1
0
        public void TestBackup()
        {
            XMLDataList.Load(text);
            int size = XMLDataList.Length;

            Assert.AreEqual(length, size);
            XMLDataListEntry current = XMLDataList.Head;

            while (current != null)
            {
                Assert.IsNotNull(MoniteeList.FindMonitee(current.Data.MoniteePath));
                current = current.Next;
            }

            XMLDataList.BackUpData();
            Assert.IsTrue(System.IO.File.Exists("MonitoredFolders.bkup"));
            XmlDocument xdoc = new XmlDocument();

            try
            {
                xdoc.Load("MonitoredFolders.bkup");
            }
            catch (Exception e)
            {
                throw;
            }
        }
Пример #2
0
 /// <summary>
 /// ensures the monitor closes for the right reasons.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void MonitorUI_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     if (e.CloseReason == System.Windows.Forms.CloseReason.WindowsShutDown ||
         e.CloseReason == System.Windows.Forms.CloseReason.TaskManagerClosing ||
         e.CloseReason == System.Windows.Forms.CloseReason.ApplicationExitCall ||
         e.CloseReason == System.Windows.Forms.CloseReason.UserClosing)
     {
         XMLDataList.BackUpData();
         this.notifyIcon.Visible = false;
         this.CallClose();
     }
     else
     {
         //this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
         this.Hide();
     }
 }
Пример #3
0
 /// <summary>
 /// To temporary stop or start monitoring files.
 /// </summary>
 /// <param name="sender">sender</param>
 /// <param name="e">e</param>
 void StartMonitorProc_Click(object sender, System.EventArgs e)
 {
     XMLDataList.BackUpData();
 }