Пример #1
0
        private void DialogWindow_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = this;

            new Thread(() =>
            {
                try
                {
                    ShowBusy("Getting user list ...");
                    UserList = new List <ComboUser>(CrmDataHelper
                                                    .GetUsers(Context));

                    ShowBusy("Getting entity list ...");
                    EntityList = new List <string>(CrmDataHelper
                                                   .GetEntityNames(Context));

                    User = CrmStep.UserId == Guid.Empty
                                                                                  ? UserList.First()
                                                                                  : UserList.First(userQ => userQ.Id == CrmStep.UserId);

                    Entity = string.IsNullOrEmpty(Entity) ? "none" : Entity;

                    Dispatcher.Invoke(() => ComboBoxEntities.Focus());
                }
                catch (Exception exception)
                {
                    PopException(exception);
                }
                finally
                {
                    HideBusy();
                }
            }).Start();
        }