Exemplo n.º 1
0
        /// <summary>
        /// Event Handler for Migrate Button click event
        /// </summary>
        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)
            {
                // Merege with the iFolder selected...
                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 /*dir.Name != this.iFolderName*/)
                {
                    // Prompt for the Rename of the iFolder...
                    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)
                        {
                            /// Unable to rename...
                            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);

            //	accountWizard.EnterpriseConnect += new Novell.Wizard.AccountWizard.EnterpriseConnectDelegate(accountWizard_EnterpriseConnect);
            if (migrationWizard.ShowDialog() == DialogResult.OK)
            {
                /*
                 * // Display the iFolders dialog.
                 * if ( DisplayiFolderDialog != null )
                 * {
                 *      DisplayiFolderDialog( this, new EventArgs() );
                 * }
                 */
            }
            migrationWizard.Dispose();
            AddMigrationDetails();
        }