public void ChangeMousePointer(XlMousePointer pt) { // Cursor need to be queued as macro ExcelAsyncUtil.QueueAsMacro(() => { _App.Cursor = pt; }); }
public void SaveTemplate(Workbook workbook) { WaitingForm frmWaiting = null; XlMousePointer originalCursor = XlMousePointer.xlDefault; try { originalCursor = workbook.Application.Cursor; //if (templateInfo.IsProntoDoc) //{ string filter = "Pronto Document Excel|*.pde"; //switch (type) //{ // case TemplateType.Pdw: // filter = PdwFilter; // break; // case TemplateType.Pdh: // filter = PdhFilter; // break; // case TemplateType.Pdz: // filter = PdzFilter; // break; // default: // break; //} SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = filter; if (saveDialog.ShowDialog() == DialogResult.OK) { // set wating cursor workbook.Application.Cursor = XlMousePointer.xlWait; frmWaiting = new WaitingForm(); frmWaiting.Show(); //save the map information between excel table/cell and business domain tree into customer xml part of file. process.SaveMapInfo(workbook); //save exported items into customer xml part if (export.exportItems != null && export.exportItems.Count > 0)//there is some data to export. { export.SaveExportInfo(workbook); export.ExportXsd(workbook); } //save condition goal seek information into customer xml part. if (condGS.cgsInfo.CGSInfos.Count > 0) { condGS.SaveCGSInfo(workbook); } workbook.SaveAs(saveDialog.FileName); if (File.Exists(workbook.FullName)) { MessageBox.Show(string.Format("ProntoDoc template {0} saved.", workbook.FullName)); } } //} //else // MessageBox.Show(MessageUtils.Expand(Properties.Resources.ipm_NotIsProntoDoc, // Properties.Resources.ipe_NotIsProntoDoc)); } catch (Exception ex) { MessageBox.Show(ex.Message); } //catch (BaseException baseExp) //{ // ManagerException mgrExp = new ManagerException(ErrorCode.ipe_SavePdwError); // mgrExp.Errors.Add(baseExp); // LogUtils.LogManagerError(mgrExp); //} finally { try { if (frmWaiting != null) { frmWaiting.Close(); frmWaiting.Dispose(); } workbook.Application.Cursor = originalCursor; } catch { } } }