예제 #1
0
        private async void btnDataView_Click(object sender, EventArgs e)
        {
            frmWaiting waiting = new frmWaiting();

            if (!Share.CheckOpened(waiting.Name))
            {
                waiting.Show();
                waiting.Focus();
                waiting.TopMost = true;
                waiting.Text    = "Excuting DataSearch...";
            }
            _iStartDate = int.Parse(sDate.Value.ToShortDateString().Replace("-", ""));
            _iEndDate   = int.Parse(eDate.Value.ToShortDateString().Replace("-", ""));

            btnDataView.Enabled = false;
            btnDataView.Text    = "EXcuting";

            DGVGrd.Visible = false;
            Task searchTask = Task.Run(() => SearchAsync());

            await searchTask;

            DGVGrd.Visible = true;
            DGVGrd.Refresh();
            btnDataView.Enabled = true;
            btnDataView.Text    = "Search";

            waiting.Close();
            waiting.Dispose();
            waiting = null;
        }
예제 #2
0
        private async void btnExportExcel_Click(object sender, EventArgs e)
        {
            btnExportExcel.Enabled = false;
            btnExportExcel.Text    = "EXcuting";

            frmWaiting waiting = new frmWaiting();

            if (!Share.CheckOpened(waiting.Name))
            {
                waiting.Show();
                waiting.Focus();
                waiting.TopMost = true;
                waiting.Text    = "Exporting Excelfile...";
            }

            if (DGVGrd.RowCount > 1)
            {
                SaveFileDialog1.Filter           = "Excel Files|*.xlsx";
                SaveFileDialog1.InitialDirectory = MyApp.Path;
                if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string sTmpName;
                    sTmpName = SaveFileDialog1.FileName;

                    DGVGrd.SelectAll();  // DataGridView control
                    DataObject dataObj = DGVGrd.GetClipboardContent();
                    Clipboard.SetDataObject(dataObj, false);
                    DGVGrd.ClearSelection();

                    Task excelTask = Task.Run(() => ExportExcelAsync(sTmpName));

                    await excelTask;
                }
            }
            else
            {
                MessageBox.Show("데이터가 존재 하지 않습니다.", "엑셀저장 에러", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            btnExportExcel.Enabled = true;
            btnExportExcel.Text    = "Excel";

            waiting.Close();
            waiting.Dispose();
            waiting = null;
        }
예제 #3
0
        private void UC_DataView_Load(object sender, EventArgs e)
        {
            try
            {
                //다른 쓰레드에서 윈폼 컨트롤 사용가능 (비동기 작업에서 사용)
                Control.CheckForIllegalCrossThreadCalls = false;
                DGVGrd.DoubleBuffered(true);
                CB_TableName.Items.Clear();
                CB_TableName.Items.Add("-Measure-");
                CB_TableName.Items.Add("-MasterData-");
                CB_TableName.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                StackTrace trace      = new StackTrace(ex, true);
                StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1);
                int        lineNumber = stackFrame.GetFileLineNumber();

                I_Sub.ErrorLog(($"({lineNumber}) : {ex.ToString()}"));
            }
        }