private void projectMigrationWizzard_BeforeSwitchPages(object sender, CristiPotlog.Controls.Wizard.BeforeSwitchPagesEventArgs e) { // get wizard page already displayed WizardPage oldPage = projectMigrationWizzard.Pages[e.OldIndex]; // check if we're going forward from options page if (oldPage == fromStudioVersion && e.NewIndex > e.OldIndex) { var selectedStudioVersionsGeneric = chkSourceStudioVersions.CheckedObjects; if (selectedStudioVersionsGeneric.Count == 0) { MessageBox.Show(this, Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Please_select_a_Studio_version_, Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Select_a_studio_version, MessageBoxButtons.OK); e.Cancel = true; return; } if (selectedStudioVersionsGeneric.Count > 1) { MessageBox.Show(this, Resources .MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Please_select_only_one_version, Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Only_one_version , MessageBoxButtons.OK); e.Cancel = true; return; } } if (oldPage == toStudioVersion && e.NewIndex > e.OldIndex) { var selectedDestinationStudioVersionsGeneric = chkDestinationStudioVersion.CheckedObjects; if (selectedDestinationStudioVersionsGeneric.Count == 0) { MessageBox.Show(this, Resources .MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Please_select_a_Studio_version_, Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Select_a_studio_version, MessageBoxButtons.OK); e.Cancel = true; return; } if (selectedDestinationStudioVersionsGeneric.Count > 1) { MessageBox.Show(this, Resources .MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Please_select_only_one_version, Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Only_one_version , MessageBoxButtons.OK); e.Cancel = true; return; } var selectedSourceStudioVersionsGeneric = chkSourceStudioVersions.CheckedObjects; var destinationStudioVersion = (StudioVersion) selectedDestinationStudioVersionsGeneric[0]; var sourceStudioVersion = (StudioVersion) selectedSourceStudioVersionsGeneric[0]; if (destinationStudioVersion.Equals(selectedSourceStudioVersionsGeneric[0])) { MessageBox.Show(this, string.Format("Destination version ({0}) must be different than the source version ({1})", destinationStudioVersion.PublicVersion, sourceStudioVersion.PublicVersion), Resources.MigrateProjects_projectMigrationWizzard_BeforeSwitchPages_Same_version , MessageBoxButtons.OK); e.Cancel = true; return; } var migrateProjects = new MigrateProjectsService(sourceStudioVersion, destinationStudioVersion); var projects = migrateProjects.GetProjectsToBeMigrated(); projectsToBeMoved.SetObjects(projects); foreach (OLVListItem item in from OLVListItem item in projectsToBeMoved.Items let project = (Project)item.RowObject where !Path.IsPathRooted(project.ProjectFilePath) select item) { item.Checked = true; } } }
void _bw_DoWork(object sender, DoWorkEventArgs e) { if (e.Argument == null) return; var taskArgument = (TaskArgument)e.Argument; var mpService = new MigrateProjectsService(taskArgument.SourceStudioVersion, taskArgument.DestinationStudioVersion); mpService.MigrateProjects(taskArgument.Projects, taskArgument.ProjectToBeMoved, _bw.ReportProgress); _bw.ReportProgress(95); if (taskArgument.MigrateTranslationMemories) { mpService.MigrateTranslationMemories(); } _bw.ReportProgress(100); }