Example #1
0
        private async Task ShowExistingCustomControls()
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            var service = await GetService();

            ToggleControls(service.ConnectionData, false, Properties.WindowStatusStrings.LoadingForms);

            this._itemsSource.Clear();

            IEnumerable <CustomControl> list = Enumerable.Empty <CustomControl>();

            string textName = string.Empty;

            txtBFilter.Dispatcher.Invoke(() =>
            {
                textName = txtBFilter.Text.Trim().ToLower();
            });

            try
            {
                if (service != null)
                {
                    var repository = new CustomControlRepository(service);
                    list = await repository.GetListAsync(textName
                                                         , new ColumnSet
                                                         (
                                                             CustomControl.Schema.Attributes.customcontrolid
                                                             , CustomControl.Schema.Attributes.name
                                                             , CustomControl.Schema.Attributes.compatibledatatypes
                                                             , CustomControl.Schema.Attributes.ismanaged
                                                         )
                                                         );
                }
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(service.ConnectionData, ex);
            }

            LoadCustomControls(list);

            ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.LoadingFormsCompletedFormat1, list.Count());
        }
        private async Task ShowExistingCustomControls()
        {
            if (!this.IsControlsEnabled)
            {
                return;
            }

            var connectionData = GetSelectedConnection();

            ToggleControls(connectionData, false, Properties.OutputStrings.LoadingCustomControls);

            string textName = string.Empty;

            this.Dispatcher.Invoke(() =>
            {
                this._itemsSource.Clear();

                textName = txtBFilter.Text.Trim().ToLower();
            });

            IEnumerable <CustomControl> list = Enumerable.Empty <CustomControl>();

            try
            {
                var service = await GetService();

                if (service != null)
                {
                    var repository = new CustomControlRepository(service);
                    list = await repository.GetListAsync(textName
                                                         , new ColumnSet
                                                         (
                                                             CustomControl.Schema.Attributes.customcontrolid
                                                             , CustomControl.Schema.Attributes.name
                                                             , CustomControl.Schema.Attributes.compatibledatatypes
                                                             , CustomControl.Schema.Attributes.ismanaged
                                                         )
                                                         );
                }
            }
            catch (Exception ex)
            {
                this._iWriteToOutput.WriteErrorToOutput(connectionData, ex);
            }

            this.lstVwCustomControls.Dispatcher.Invoke(() =>
            {
                foreach (var entity in list
                         .OrderBy(ent => ent.Name)
                         .ThenBy(ent => ent.CompatibleDataTypes)
                         )
                {
                    var item = new EntityViewItem(entity);

                    this._itemsSource.Add(item);
                }

                if (this.lstVwCustomControls.Items.Count == 1)
                {
                    this.lstVwCustomControls.SelectedItem = this.lstVwCustomControls.Items[0];
                }
            });

            ToggleControls(connectionData, true, Properties.OutputStrings.LoadingCustomControlsCompletedFormat1, list.Count());
        }