private async void GetAccountOwnerDetails(object o, RoutedEventArgs e) { //perform await funtion to get accout holder details var bs = new BusyScreen(); bs.Show(); bs.Topmost = true; await Task.Delay(3000); bs.Close(); //txtAccountHolder.Text = "ADESANYA OLUFEMI S. :-: Number :-: " + accNumberTxt.Text + " Bank :-: " + txtBankName.Text; //if successful enable continue btn btnContinue.IsEnabled = true; }
private void DoStartCount(object sender, RoutedEventArgs e) { //start glory string rtn = null; int colTotal = 0; txtTotalCounted.Text = ""; //open glory again to recount string[] words = null; if (_handle.Equals("") || _handle == null) { rtn = Gctrl.DoGloryOpen("DLLTEST"); MessageBox.Show(rtn); } if (rtn != null) { words = rtn.Split(','); } if (words != null) { _handle = words[1]; } try { BusyScreen bs = new BusyScreen(); MoreNote mn = new MoreNote(); DialogScreen dialog = new DialogScreen(); bs.Topmost = true; bs.ShowDialog(); //skip delock goto countStart; deLock: //call method to delock glory if error occur in glory Gctrl.DoGlyAsyncDeLock(_handle); countStart: //Do count start Delay 3 seconds Thread.Sleep(3000); var rtnCntStart = Gctrl.DoGlyAsyncDeCntStart(_handle); if (rtnCntStart.Contains("ERROR")) { goto deLock; } //Delay 3 seconds Thread.Sleep(3000); var rtnCountData = Gctrl.DoCountData(); if (!rtnCountData.Contains("ERROR") && rtnCountData != "") { //remove first part of string from the returned string var countData = rtnCountData.Split(':'); //create array from the second part of returned string var countDataArr = countData[1]; var primeArray = countDataArr.Split(','); //prepare datatable for the array elements DataSet ds = new DataSet(); DataTable dt = new DataTable(); dt.Columns.Add("NOTE"); dt.Columns.Add("QUANTITY"); dt.Columns.Add("TOTAL"); for (int i = 0; i < primeArray.Length; i += 5) { int first = Convert.ToInt16(primeArray[i]); int second = Convert.ToInt16(primeArray[i + 1]); int third = first * second; if (second != 0) { colTotal += third; dt.Rows.Add(first, second, third); } } ds.Tables.Add(dt); //clear grids datasource grdCount.DataContext = null; grdCount.ItemsSource = ds.Tables[0].DefaultView; txtTotalCounted.Text = colTotal.ToString(); //disable start-count btn if (colTotal != 0) { mn.Topmost = true; mn.ShowDialog(); btnBack.IsEnabled = false; btnStartCount.Content = "ADD-MORE"; btnStartCount.IsEnabled = true; btnAccept.IsEnabled = true; btnReject.IsEnabled = true; } else { btnBack.IsEnabled = true; btnStartCount.IsEnabled = true; btnAccept.IsEnabled = false; btnReject.IsEnabled = false; btnStartCount.Content = "START-COUNT"; bs.Close(); mn.Close(); } //bs.Close(); //mn.Close(); var window = IsWindowOpen <Window>("Deposit"); if (window != null) { window.Close(); } var winDepCount = IsWindowOpen <Window>("DepositCount"); if (winDepCount != null) { winDepCount.WindowStyle = WindowStyle.None; winDepCount.Activate(); winDepCount.Topmost = true; winDepCount.ShowDialog(); } //await PutMethodDelay(5000); Thread.Sleep(2000); } else { dialog.Topmost = true; dialog.ShowDialog(); //_dialog.Close(); bs.Close(); //close glory bcos count is empty Gctrl.DoGloryClose(_handle); _handle = null; Thread.Sleep(2000); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }