/// <summary> /// BackGroundWorker Do Work /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void startBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { this.UpperText = "Connecting"; this.LowerText = "Database"; Thread.Sleep(1000); using (SqlConnection testConnection = new SqlConnection(Properties.Settings.Default.Cafeteria_Vernier_dbConnectionString)) { try { testConnection.Open(); } catch { this.UpperText = "Connection"; this.LowerText = "Fault"; Thread.Sleep(1000); new InstallWindow().Show(); this.Close(); return; } } this.UpperText = "Connecting"; this.LowerText = "Service"; Thread.Sleep(2000); //Check connection Named pipe service this.UpperText = "Retrieving"; this.LowerText = "Necessary Information"; Thread.Sleep(2000); MiraculousMethods miraculousMethod = new MiraculousMethods(); miraculousMethod.CheckCashDate(); this.Dispatcher.BeginInvoke(new Action(() => { serverWindow = new MainWindow(); serverWindow.BillConfigInfo = miraculousMethod.LoadBillConfig(); }), DispatcherPriority.Normal); // // //miraculousMethod.MinimumRequirement(); }
private byte[] imageOpenDialogBox() { System.Windows.Forms.OpenFileDialog fileOpenDialogBox = new System.Windows.Forms.OpenFileDialog(); fileOpenDialogBox.Filter = "JPEG|*.jpg|BMP|*.bmp|PNG|*.png"; fileOpenDialogBox.Title = "Select a Images"; fileOpenDialogBox.FilterIndex = 1; fileOpenDialogBox.RestoreDirectory = true; byte[] imageInbytes = null; if (fileOpenDialogBox.ShowDialog().Equals(System.Windows.Forms.DialogResult.OK)) { FileInfo ImageInfo = new FileInfo(fileOpenDialogBox.FileName); if (ImageInfo.Length < 819200) { imageInbytes = new MiraculousMethods().imageToByteArray(fileOpenDialogBox.FileName); } else { DXMessageBox.Show(CVsVariables.ERROR_MESSAGES[0, 5], CVsVariables.SOTWARE_NAME, MessageBoxButton.OK, MessageBoxImage.Stop); } } return(imageInbytes); }