private void HandleKeyPress(object sender, KeyEventArgs e) { try { if (e.Key == Key.Return) { //Btn_save_Click(null, null); } } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Chk_allPackages_Checked(object sender, RoutedEventArgs e) { try { cb_package.SelectedItem = null; cb_package.IsEnabled = false; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { try { e.Cancel = true; this.Visibility = Visibility.Hidden; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
public uc_packages() { try { InitializeComponent(); HelpClass.defaultDatePickerStyle(dp_endDate); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Btn_colse_Click(object sender, RoutedEventArgs e) { try { isActive = false; this.Close(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Btn_ok_Click(object sender, RoutedEventArgs e) { try { isOk = true; this.Close(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Tgl_Count_Unchecked(object sender, RoutedEventArgs e) { try { string name = ((ToggleButton)sender).Name; chkCount(name, false); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void validateEmptyEvent(object sender) { try { string name = sender.GetType().Name; validateEmpty(name, sender); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void P_showPassword_MouseLeave(object sender, MouseEventArgs e) { try { txtShowPassword.Visibility = Visibility.Collapsed; txtPassword.Visibility = Visibility.Visible; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void hidePassword(TextBox tb, PasswordBox pb) { try { tb.Visibility = Visibility.Collapsed; pb.Visibility = Visibility.Visible; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) {//load try { HelpClass.StartAwait(grid_main); btns = new Button[] { btn_firstPage, btn_prevPage, btn_activePage, btn_nextPage, btn_lastPage }; #region translate if (MainWindow.lang.Equals("en")) { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.LeftToRight; } else { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly()); grid_main.FlowDirection = FlowDirection.RightToLeft; } translat(); #endregion #region fill page count combo var typelist = new[] { new { Text = "20", Value = "20" }, new { Text = "50", Value = "50" }, new { Text = "100", Value = "100" } }; cb_itemPerPage.DisplayMemberPath = "Text"; cb_itemPerPage.SelectedValuePath = "Value"; cb_itemPerPage.ItemsSource = typelist; #endregion chk_allSerials.IsChecked = false; posSerialsQuery = await RefreshList(); isActiveCount = posSerials.Count(s => s.isActive == 1); pu = await puModel.GetByID(packageUserID); p = await pModel.GetByID(pu.packageId.Value); cb_itemPerPage.SelectedIndex = 0; Tb_search_TextChanged(tb_search, null); HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private void ValidateEmpty_PasswordChanged(object sender, RoutedEventArgs e) { try { HelpClass.validate(requiredControlList, this); p_error_password.Visibility = Visibility.Collapsed; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Btn_preview_Click(object sender, RoutedEventArgs e) {//preview try { HelpClass.StartAwait(grid_main); #region string pdfpath = ""; // pdfpath = @"\Thumb\report\temp.pdf"; pdfpath = reportclass.PathUp(Directory.GetCurrentDirectory(), 2, pdfpath); if (packuser.packageUserId <= 0) { //no book saved Toaster.ShowWarning(Window.GetWindow(this), message: "You have to book first", animation: ToasterAnimation.FadeIn); } else { result = await BuildReport(); if (result == "0") { // not payed yet Toaster.ShowWarning(Window.GetWindow(this), message: "The customer must pay first", animation: ToasterAnimation.FadeIn); } else { Window.GetWindow(this).Opacity = 0.2; LocalReportExtensions.ExportToPDF(rep, pdfpath); wd_previewPdf w = new wd_previewPdf(); w.pdfPath = pdfpath; if (!string.IsNullOrEmpty(w.pdfPath)) { w.ShowDialog(); w.wb_pdfWebViewer.Dispose(); } Window.GetWindow(this).Opacity = 1; } } #endregion HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private async void Dg_user_SelectionChanged(object sender, SelectionChangedEventArgs e) {//selection try { HelpClass.StartAwait(grid_main); if (dg_user.SelectedIndex != -1) { user = dg_user.SelectedItem as Users; this.DataContext = user; if (user != null) { btn_packages.IsEnabled = true; btn_customers.IsEnabled = true; tb_code.Text = user.code; cb_country.SelectedValue = user.countryId; this.DataContext = user; await getImg(); #region delete if (user.canDelete) { btn_delete.Content = MainWindow.resourcemanager.GetString("trDelete"); } else { if (user.isActive == 0) { btn_delete.Content = MainWindow.resourcemanager.GetString("trActive"); } else { btn_delete.Content = MainWindow.resourcemanager.GetString("trInActive"); } } #endregion HelpClass.getMobile(user.mobile, cb_areaMobile, tb_mobile); HelpClass.getPhone(user.phone, cb_areaPhone, cb_areaPhoneLocal, tb_phone); HelpClass.getPhone(user.fax, cb_areaFax, cb_areaFaxLocal, tb_fax); } } HelpClass.clearValidate(requiredControlList, this); p_error_email.Visibility = Visibility.Collapsed; HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private void Grid_BeginningEdit(object sender, DataGridBeginningEditEventArgs e) { //// Have to do this in the unusual case where the border of the cell gets selected. //// and causes a crash 'EditItem is not allowed' try { e.Cancel = true; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Chk_Unchecked(object sender, RoutedEventArgs e) { try { string name = ((CheckBox)sender).Name; chkAll(name, false); await Search(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Btn_colse_Click(object sender, RoutedEventArgs e) {//close try { this.Close(); // Collect all generations of memory. GC.Collect(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
public MainWindow() { try { InitializeComponent(); mainWindow = this; windowFlowDirection(); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Btn_clearCustomer_Click(object sender, RoutedEventArgs e) {//clear customer try { cb_customer.SelectedIndex = -1; cb_package.IsEnabled = false; cb_period.IsEnabled = false; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Cb_country_SelectionChanged(object sender, SelectionChangedEventArgs e) {//select country try { cb_areaMobile.SelectedIndex = cb_country.SelectedIndex; cb_areaFax.SelectedIndex = cb_country.SelectedIndex; cb_areaPhone.SelectedIndex = cb_country.SelectedIndex; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Window_Loaded(object sender, RoutedEventArgs e) {//load try { HelpClass.StartAwait(grid_agentPackage); #region translate if (MainWindow.lang.Equals("en")) { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.en_file", Assembly.GetExecutingAssembly()); grid_agentPackage.FlowDirection = FlowDirection.LeftToRight; } else { MainWindow.resourcemanager = new ResourceManager("AdministratorApp.ar_file", Assembly.GetExecutingAssembly()); grid_agentPackage.FlowDirection = FlowDirection.RightToLeft; } translat(); #endregion allPackagesSource = await packageModel.GetByAgentCountryId(agentID); selectedPackagesSource = await packageModel.GetPackagesByAgent(agentID); allPackages.AddRange(allPackagesSource); //remove selected packages from all packages foreach (var i in selectedPackagesSource) { //package = await packageModel.GetByID(i.packageId); package = allPackages.Where(p => p.packageId == i.packageId).FirstOrDefault(); allPackages.Remove(package); } dg_allPackages.ItemsSource = allPackages; dg_allPackages.SelectedValuePath = "packageId"; dg_allPackages.DisplayMemberPath = "packageName"; dg_selectedPackages.ItemsSource = selectedPackagesSource; dg_selectedPackages.SelectedValuePath = "packageId"; dg_selectedPackages.DisplayMemberPath = "packageName"; HelpClass.EndAwait(grid_agentPackage); } catch (Exception ex) { HelpClass.EndAwait(grid_agentPackage); HelpClass.ExceptionMessage(ex, this); } }
private void Btn_packages_Click(object sender, RoutedEventArgs e) { try { Button button = sender as Button; colorButtonRefreash(button.Tag.ToString()); grid_main.Children.Clear(); grid_main.Children.Add(uc_packages.Instance); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void BTN_logOut_Click(object sender, RoutedEventArgs e) {//log out try { await close(); Application.Current.Shutdown(); System.Diagnostics.Process.Start(Application.ResourceAssembly.Location); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Number_PreviewTextInput(object sender, TextCompositionEventArgs e) { //only digits try { TextBox textBox = sender as TextBox; HelpClass.InputJustNumber(ref textBox); Regex regex = new Regex("[^0-9]+"); e.Handled = regex.IsMatch(e.Text); } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private void Txb_searchitems_TextChanged(object sender, TextChangedEventArgs e) {//search try { txtSearch = txb_searchitems.Text; packageQuery = allPackages.Where(s => s.packageName.Contains(txtSearch)); dg_allPackages.ItemsSource = packageQuery; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
public uc_packageUser() { try { InitializeComponent(); HelpClass.defaultDatePickerStyle(dp_bookDate); HelpClass.defaultDatePickerStyle(dp_expireDate); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private async void Cb_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { HelpClass.EndAwait(grid_main); await Search(); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private void Btn_clear_Click(object sender, RoutedEventArgs e) { try { HelpClass.StartAwait(grid_main); Clear(); HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }
private void Btn_customers_Click(object sender, RoutedEventArgs e) {//customers try { Window.GetWindow(this).Opacity = 0.2; wd_customers w = new wd_customers(); w.agentID = user.userId; w.ShowDialog(); Window.GetWindow(this).Opacity = 1; } catch (Exception ex) { HelpClass.ExceptionMessage(ex, this); } }
private async void Tb_search_TextChanged(object sender, TextChangedEventArgs e) {//search try { HelpClass.StartAwait(grid_main); await Search(); HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }