} //GetVersion private void ShowApplyForm(object sender, EventArgs e) { SharePointVersion version = GetVersion("to apply the template to"); if (version != SharePointVersion.SharePoint_Invalid) { TargetWin applyForm = new TargetWin(); applyForm.FormClosed += new FormClosedEventHandler(DestroyForm); applyForm.Text = "Apply Template To "; switch (version) { case SharePointVersion.SharePoint_2013_On_Premises: applyForm.Text += Constants.SharePoint_2013_On_Premises; break; case SharePointVersion.SharePoint_2016_On_Premises: applyForm.Text += Constants.SharePoint_2016_On_Premises; break; case SharePointVersion.SharePoint_2016_OnLine: applyForm.Text += Constants.SharePoint_2016_Online; break; default: break; } applyForm.ApplyTemplate = ApplySPTemplate; applyForm.SelectedVersion = version; applyForm.OpenTemplate = OpenFile; applyForm.SetStatusBarText = SetStatusBarText; applyForm.MdiParent = this; applyForm.Show(); } } //ShowApplyForm
} //CreateSPTemplate private bool ApplySPTemplate(Form callee, ProvisioningOptions provisioningOptions) { TargetWin callForm = callee as TargetWin; bool result = false; callForm.Visible = false; provisioningOptions.SharePointVersion = callForm.SelectedVersion; string spVersionTitle = EnsureVersionLoaded(provisioningOptions.SharePointVersion); ProgressWin progressWin = StartProgressWin(false, spVersionTitle); _lbOutput = progressWin.ResultOutput; switch (provisioningOptions.SharePointVersion) { case SharePointVersion.SharePoint_2013_On_Premises: result = _sp2013OnPrem.ApplyProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange); break; case SharePointVersion.SharePoint_2016_On_Premises: result = _sp2016OnPrem.ApplyProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange); break; case SharePointVersion.SharePoint_2016_OnLine: result = _sp2016Online.ApplyProvisioningTemplate(provisioningOptions, WriteMessage, WriteMessageRange); break; } callForm.Visible = true; FinishProgressWin(progressWin); return(result); } //ApplySPTemplate