private async void UserControl_Loaded(object sender, RoutedEventArgs e) {//load try { HelpClass.StartAwait(grid_main); #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("ag")) { dpnl_country.Visibility = Visibility.Visible; bdr_country.Visibility = Visibility.Collapsed; await FillCombo.fillCountriesNames(cb_countries); bdr_agent.Visibility = Visibility.Collapsed; } else { dpnl_country.Visibility = Visibility.Collapsed; bdr_country.Visibility = Visibility.Visible; tb_country.Text = await HelpClass.getCountry(MainWindow.userLogin.countryId.Value); dpnl_agent.Visibility = Visibility.Collapsed; bdr_agent.Visibility = Visibility.Visible; tb_agent.Text = MainWindow.userLogin.accountName; var typelist = new[] { new { Text = MainWindow.userLogin.name + " " + MainWindow.userLogin.lastName, Value = MainWindow.userLogin.userId } }; cb_agents.DisplayMemberPath = "Text"; cb_agents.SelectedValuePath = "Value"; cb_agents.ItemsSource = typelist; cb_agents.SelectedIndex = 0; } await Search(); HelpClass.EndAwait(grid_main); } catch (Exception ex) { HelpClass.EndAwait(grid_main); HelpClass.ExceptionMessage(ex, this); } }