private void Dashboard_changeProgress(string mssg) { Label l = mw.Controls.Find("label4", true)[0] as Label; ProgressBar pbar = mw.Controls.Find("progressBar1", true)[0] as ProgressBar; dgp.updateProgress(file_loaded, richTextBox1.TextLength > 0 ? 1 : 0); l.Text = dgp.completedSteps().ToString() + " /"; pbar.Value = dgp.completedSteps(); l.Refresh(); }
private void Button1_Click_1(object sender, EventArgs e) { LoadingSpinner ls = new LoadingSpinner(this, AppMessages.messages["data_save"]); try { ls.show(); ExcelReader excelReader = new ExcelReader(); excelReader.saveExcelFromDataGridView( new DataGridView[2] { dataGridView1, dataGridView2 }, new int[2] { 1, 2 }, new string[2] { "Sales Forecast", "Cost Of Sales" } ); TableGenerator tbl = new TableGenerator(); tbl.GenerateMultipleTable(new DataGridView[2] { dataGridView1, dataGridView2 }, "sales_forecast_table.rtf", new string[2] { "Sales Forecast", "Cost Of Sales" }); ChartGenerator cgr = new ChartGenerator(); cgr.generateBarChart(dataGridView1, "generate.png", "Forecast Sales"); cgr.ImageToRtf("sales_forecast_table.rtf", "generate.png"); cgr.generateBarChart(dataGridView2, "generate1.png", "Cost of Sales"); cgr.ImageToRtf("sales_forecast_table.rtf", "generate1.png"); Label l = mw.Controls.Find("label4", true)[0] as Label; ProgressBar pbar = mw.Controls.Find("progressBar1", true)[0] as ProgressBar; dgp.updateProgress("sales_forecast_table.rtf", dataGridView1.Rows.Count > 0 && dataGridView2.Rows.Count > 0 ? 1 : 0); l.Text = dgp.completedSteps().ToString() + " /"; pbar.Value = dgp.completedSteps(); l.Refresh(); } catch (Exception ex) { MessageBox.Show("Exception: " + ex.Message); } finally { ls.hide(); } }
private void Button1_Click(object sender, EventArgs e) { if (validateData()) { LoadingSpinner ls = new LoadingSpinner(this, AppMessages.messages["data_save"]); try { ls.show(); ExcelReader excelReader = new ExcelReader(); excelReader.saveExcelFromDataGridView( new DataGridView[1] { dataGridView1 }, new int[1] { 1 }, new string[1] { "Market Analysis" } ); TableGenerator tbl = new TableGenerator(); tbl.Generate(dataGridView1, "market_analysis.rtf"); ChartGenerator cgen = new ChartGenerator(); cgen.generatePieChart(dataGridView1, "generated.png", "Market Analysis"); cgen.ImageToRtf("market_analysis.rtf", "generated.png"); Label l = mw.Controls.Find("label4", true)[0] as Label; ProgressBar pbar = mw.Controls.Find("progressBar1", true)[0] as ProgressBar; dgp.updateProgress("market_analysis.rtf", dataGridView1.Rows.Count > 0 ? 1 : 0); l.Text = dgp.completedSteps().ToString() + " /"; pbar.Value = dgp.completedSteps(); l.Refresh(); } catch (Exception ex) { MessageBox.Show("Exception: " + ex.Message); } finally { ls.hide(); } } else { MessageBox.Show("Percentage cannot exceed 100 !"); } }
private void SaveBt_Click(object sender, EventArgs e) { try { this.richTextBox1.SaveFile(ProjectConfig.projectPath + "\\" + "financial_statement.rtf"); Label l = mw.Controls.Find("label4", true)[0] as Label; ProgressBar pbar = mw.Controls.Find("progressBar1", true)[0] as ProgressBar; dgp.updateProgress("financial_statement.rtf", richTextBox1.TextLength == 0 ? 0 : 1); l.Text = dgp.completedSteps().ToString() + " /"; pbar.Value = dgp.completedSteps(); l.Refresh(); MessageBox.Show("Saved successfully !"); } catch (Exception ex) { MessageBox.Show("Exception: " + ex.Message); } }
private void saveOpenSections() { if (WorkProgress.workItems.Count > 0) { DocumentProgressor dgp = new DocumentProgressor(); var confirmResult = MessageBox.Show("You have unsaved sections in your project.\nDo you want to save them ?", "Unsaved work", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { LoadingSpinner ls = new LoadingSpinner(this, "Saving work in progress.."); try { ls.show(); foreach (var w in WorkProgress.workItems) { RichTextBox rtb = new RichTextBox(); rtb.Rtf = w.data; rtb.SaveFile(Path.Combine(ProjectConfig.projectPath, w.filename)); dgp.updateProgress(w.filename, rtb.TextLength > 0 ? 1 : 0); rtb.Dispose(); } } catch (Exception e) { MessageBox.Show("Exception: " + e.Message); } finally { ls.hide(); } } else { return; } } else { return; } }