private byte[] selectImageFromFile() { byte[] imageInbytes = null; using (System.Windows.Forms.OpenFileDialog imageOpenBox = new System.Windows.Forms.OpenFileDialog()) { imageOpenBox.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); imageOpenBox.Filter = "JPGE (*.jpg)|*.jpg|PNG (*.png)|*.png|BMP (*.bmp)|*.bmp|All (*.*)|*.*"; imageOpenBox.FilterIndex = 0; imageOpenBox.RestoreDirectory = true; if (imageOpenBox.ShowDialog().Equals(System.Windows.Forms.DialogResult.OK)) { imageInbytes = new MiraculousMethods().imageToByteArray(imageOpenBox.FileName); } } return imageInbytes; }
/// <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(); }