示例#1
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);
                requiredControlList = new List <string> {
                    "name", "lastName", "accountName", "mobile", "country"
                };

                #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;
                }
                translate();
                #endregion

                if ((MainWindow.userLogin.type.Equals("ad")) || (MainWindow.userLogin.type.Equals("us")))
                {
                    btn_packages.Visibility = Visibility.Visible; btn_customers.Visibility = Visibility.Visible;
                }
                else
                {
                    btn_packages.Visibility = Visibility.Collapsed; btn_customers.Visibility = Visibility.Collapsed;
                }

                await FillCombo.fillCountries(cb_areaMobile);

                await FillCombo.fillCountries(cb_areaPhone);

                await FillCombo.fillCountries(cb_areaFax);

                await FillCombo.fillCountriesNames(cb_country);

                FillCombo.fillAgentLevel(cb_agentLevel);

                Keyboard.Focus(tb_code);

                await Search();

                Clear();

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }
示例#2
0
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {//load
            try
            {
                HelpClass.StartAwait(grid_main);

                requiredControlList = new List <string> {
                    "custname", "lastName", "mobile", "country"
                };

                #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;
                }
                translate();
                #endregion

                await FillCombo.fillCountries(cb_areaMobile);

                await FillCombo.fillCountries(cb_areaPhone);

                await FillCombo.fillCountries(cb_areaFax);

                await FillCombo.fillCountriesNames(cb_country);

                FillCombo.fillAgentLevel(cb_custlevel);

                customer = await customerModel.GetByID(customerID);

                if (customer != null)
                {
                    this.DataContext         = customer;
                    tb_custCode.Text         = customer.custCode;
                    cb_country.SelectedValue = customer.countryId;
                    this.DataContext         = customer;
                    await getImg();

                    HelpClass.getMobile(customer.mobile, cb_areaMobile, tb_mobile);
                    HelpClass.getPhone(customer.phone, cb_areaPhone, cb_areaPhoneLocal, tb_phone);
                    HelpClass.getPhone(customer.fax, cb_areaFax, cb_areaFaxLocal, tb_fax);
                }
                else
                {
                    Clear();
                }

                HelpClass.EndAwait(grid_main);
            }
            catch (Exception ex)
            {
                HelpClass.EndAwait(grid_main);
                HelpClass.ExceptionMessage(ex, this);
            }
        }