private void button8_Click(object sender, RoutedEventArgs e) { grdMain.Children.OfType <DataGrid>().ToList().ForEach(b => grdMain.Children.Remove(b)); spGenerateExcel = null; spExcell = null; spOpenmiracleExport = null; spTally = null; mainmaenu.Visibility = Visibility.Hidden; LoginUser loginuser = new LoginUser(propertiess); string ss = loginuser.txtUserName.Text; grdMain.Children.Add(loginuser); }
void btnClick(object sender, RoutedEventArgs e) { if (Process == "btnImportFromTally") { if (spTally == null || !spTally.CheckTallyConnection()) { spTally = new Tally(); } } else if (Process == "btnImportFromExcel") { spExcell = new ExcellSp(); } else if (Process == "btnExportExcel") { if (spOpenmiracleExport == null) { spOpenmiracleExport = new OpenmiracleExport(); } if (spGenerateExcel == null) { spGenerateExcel = new GenerateExcell(); } } else if (Process == "btnExcellFormat") { if (spGenerateExcel == null) { spGenerateExcel = new GenerateExcell(); } } if (((spTally != null) ? spTally.CheckTallyConnection() : false) || ((spExcell != null) ? spExcell.CheckExcellConnection() : false) || spOpenmiracleExport != null || spGenerateExcel != null) { if (!bg.IsBusy) { pbProgressBar.IsIndeterminate = true; bg.RunWorkerAsync((sender as Button).ToolTip); } } else { ShowMessage(Process); } }
private void btnProcess_Click(object sender, RoutedEventArgs e) { grdMain.Children.OfType <DataGrid>().ToList().ForEach(b => grdMain.Children.Remove(b)); grdMain.Children.OfType <AboutUs>().ToList().ForEach(b => grdMain.Children.Remove(b)); grdMain.Children.OfType <ContactUs>().ToList().ForEach(b => grdMain.Children.Remove(b)); switch (Process) { case ("btnImportFromTally"): btnImportFromTally.Content = null; btnImportFromTally.Background = images; break; case ("btnImportFromExcel"): btnImportFromExcel.Content = null; btnImportFromExcel.Background = images; break; case ("btnExcellFormat"): btnExcellFormat.Content = null; btnExcellFormat.Background = images; break; case ("btnExportExcel"): btnExportExcel.Content = null; btnExportExcel.Background = images; break; case ("btnAboutUs"): btnAboutUs.Content = null; btnAboutUs.Background = images; break; case ("btnContactUs"): btnContactUs.Content = null; btnContactUs.Background = images; break; default: break; } if ((sender as Button).Content == null) { images = (ImageBrush)(sender as Button).Background; (sender as Button).Background = Brushes.Goldenrod; Process = (sender as Button).Name; } switch ((sender as Button).Name) { case ("btnImportFromTally"): (sender as Button).Content = "Import\n Tally."; spExcell = null; spGenerateExcel = null; spOpenmiracleExport = null; break; case ("btnImportFromExcel"): (sender as Button).Content = "Import\n Excel."; spTally = null; spGenerateExcel = null; spOpenmiracleExport = null; break; case ("btnExcellFormat"): (sender as Button).Content = "Generate\n Format"; spTally = null; spExcell = null; spOpenmiracleExport = null; break; case ("btnExportExcel"): (sender as Button).Content = "Export\n Excel"; spTally = null; spExcell = null; break; case ("btnAboutUs"): (sender as Button).Content = "About\n Us"; spTally = null; spExcell = null; spGenerateExcel = null; spOpenmiracleExport = null; if (grdMain.Children.OfType <AboutUs>().ToList().Count == 0) { AboutUs obj = new AboutUs(); grdMain.Children.Add(obj); } break; case ("btnContactUs"): (sender as Button).Content = "Contact\n Us"; spTally = null; spExcell = null; spGenerateExcel = null; spOpenmiracleExport = null; if (grdMain.Children.OfType <ContactUs>().ToList().Count == 0) { ContactUs obj = new ContactUs(); grdMain.Children.Add(obj); } break; default: break; } }