Exemplo n.º 1
0
        // BackgroundWorker 執行完成
        private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Result != null)
            {
                ShowSaveFileDialogRe showSaveFileDialogRe = Fun.ShowSaveFileDialog(e.Result.ToString(), null);

                // 存檔按鈕
                if (showSaveFileDialogRe.dialogResult == DialogResult.OK)
                {
                    string finishedFileName = showSaveFileDialogRe.msg;

                    SetOutputExcelFileName(finishedFileName);
                    // 如果是覆蓋原檔案,必需要重新讀取ComboboxItem
                    if (finishedFileName != null)
                    {
                        if (finishedFileName.Equals(bwGenExcelArgs.sourceFile))
                        {
                            setComboboxItem(finishedFileName);
                        }
                    }
                }
                else if (showSaveFileDialogRe.dialogResult == DialogResult.Abort)
                {
                    Fun.showMessageBox(
                        string.Format("{0}",
                                      showSaveFileDialogRe.msg), "SaveAs error");
                }
            }
            this.SetButtonStatus(true);
        }
Exemplo n.º 2
0
        // 存檔視窗
        private void RunShowSaveFileDialogRe(string tempFilename)
        {
            ShowSaveFileDialogRe showSaveFileDialogRe = Fun.ShowSaveFileDialog(tempFilename, saveAsFile);

            // 存檔按鈕
            if (showSaveFileDialogRe.dialogResult == DialogResult.OK)
            {
                string finishedFileName = showSaveFileDialogRe.msg;

                SetOutputExcelFileName(finishedFileName);
                openExcel.Visible = true;
            }
            else if (showSaveFileDialogRe.dialogResult == DialogResult.Abort)
            {
                Fun.showMessageBox(
                    string.Format("{0}",
                                  showSaveFileDialogRe.msg), "SaveAs error");
            }
        }