Esempio n. 1
0
 private void btnMigrate_Click(object sender, System.EventArgs e)
 {
     ListViewItem lvi = this.listView1.SelectedItems[0];
     if (lvi == null)
         return;
        bool encr = false;
        if( lvi.SubItems[2].Text == Resource.GetString("Encrypted"))
     encr = true;
     if (this.Merge == true)
     {
         this.iFolderLocation = lvi.SubItems[1].Text;
         this.UserName = lvi.SubItems[0].Text;
         DirectoryInfo dir = new DirectoryInfo(this.iFolderLocation);
         if (dir.Exists == false)
         {
             System.Resources.ResourceManager resManager = new System.Resources.ResourceManager(typeof(GlobalProperties));
             MyMessageBox mmb = new MyMessageBox(resManager.GetString("FolderDoesNotExistError"), resManager.GetString("FolderDoesNotExistErrorTitle"), resManager.GetString("FolderDoesNotExistErrorDesc"), MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
             mmb.ShowDialog();
             this.iFolderLocation = null;
         }
         else if (dir.Exists && dir.Name.Equals(this.iFolderName, StringComparison.CurrentCultureIgnoreCase) == false)
         {
             MyMessageBox mmb = new MyMessageBox(Resource.GetString("MigrationRenamePrompt.Text"), Resource.GetString("MigrationAlert"), "", MyMessageBoxButtons.YesNo, MyMessageBoxIcon.Question);
             DialogResult res = mmb.ShowDialog();
             if (res == DialogResult.Yes)
             {
                 try
                 {
                         dir.MoveTo(Path.Combine(dir.Parent.FullName, this.iFolderName));
                         this.iFolderLocation = Path.Combine(dir.Parent.FullName, this.iFolderName);
                 }
                 catch (Exception ex)
                 {
                     MyMessageBox mmb1 = new MyMessageBox("Unable to rename the selected location.", "Migration Alert", ex.Message, MyMessageBoxButtons.OK, MyMessageBoxIcon.Error);
                     mmb1.ShowDialog();
                     this.iFolderLocation = null;
                     this.UserName = null;
                     return;
                 }
             }
             else
             {
                 this.iFolderLocation = null;
                 this.UserName = null;
                 return;
             }
         }
         else if (dir.Name.Equals(this.iFolderName, StringComparison.CurrentCultureIgnoreCase))
         {
             this.iFolderLocation = Path.Combine(dir.Parent.FullName, this.iFolderName);
         }
         this.Dispose(true);
         return;
     }
        MigrationWizard migrationWizard = new MigrationWizard( lvi.SubItems[0].Text, lvi.SubItems[1].Text, encr, ifWebService, this.simiasWebService);
        if ( migrationWizard.ShowDialog() == DialogResult.OK )
        {
        }
        migrationWizard.Dispose();
        AddMigrationDetails();
 }