Esempio n. 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            //Make api call
            //First find out what type of backup is needed to be done
            //Second Reschedule todays backup
            //Start a backup immedietly
            //Check that source and destination are set up
            
            
            if (DataManager.getSource() == "Select Drive..." || DataManager.getDestination() == "Select Location...")
            {
                MessageBox.Show("Please Setup Your Source And Destination Folders In the Settings Tab.");
            }
            else{
                // turn timed backups off






                BackupTools bt = new BackupTools();
                bt.deleteFolder();
                statusLB.Text = "Creating VHD and Uploading it.";
                pictureBox1.Image = Properties.Resources.backingup;
                 String[] source = { DataManager.getSource()}; //"d:\\BackupTarget"
                 String destination = DataManager.getDestination();
                //StartBackup is the function you need
             
                InitTimer();
                bt.StartBackup(source, destination, 0);
                //Create name
                string dater = DateTime.Now.ToString("MMddyyyyhmmtt");
                string nameVHD = "Backup-"+dater+".vhd";
                DataManager.setVHDName(nameVHD);

                RecloApiCaller.authorizeUpload(DataManager.getUserID(), DataManager.getToken(), DataManager.getVHDName(), "20", (string res) => upload_callback(res));
            }
          
        }
Esempio n. 2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
           //Check if time since last backup and scheduled has been exceeded
            if(DateTime.Compare(DataManager.getDate(), DateTime.Now) < 0)
            {

            }
            else 
            {
                BackupTools bt = new BackupTools();
                bt.deleteFolder();
                // statusLB.Text = "Creating VHD and Uploading it.";
                String[] source = {DataManager.getSource()}; //"d:\\BackupTarget"
                String destination = DataManager.getDestination();
                //StartBackup is the function you need
             
                //Create name
                string dater = DateTime.Now.ToString("MMddyyyyhmmtt");
                string nameVHD = "Backup-" + dater + ".vhd";
                DataManager.setVHDName(nameVHD);

             
                if(DataManager.getCount() == 0)
                {
                    bt.StartBackup(source, destination, 0); //full backup
                }
                else
                {
                    bt.StartBackup(source, destination, 1); //incremental backup
                }
                RecloApiCaller.authorizeUpload(DataManager.getUserID(), DataManager.getToken(), DataManager.getVHDName(), "20", (string res) => upload_callback(res));
            }
        }