Ejemplo n.º 1
0
        private async Task PerformAddingPluginStep(string folder, Guid idPluginType, string name)
        {
            var service = await GetService();

            if (service == null)
            {
                return;
            }

            List <SdkMessageFilter> filters = await GetSdkMessageFiltersAsync(service);

            var step = new SdkMessageProcessingStep()
            {
                EventHandler = new EntityReference(PluginType.EntityLogicalName, idPluginType),
            };

            var thread = new System.Threading.Thread(() =>
            {
                try
                {
                    var form = new WindowSdkMessageProcessingStep(_iWriteToOutput, service, filters, step);

                    form.ShowDialog();
                }
                catch (Exception ex)
                {
                    DTEHelper.WriteExceptionToOutput(null, ex);
                }
            });

            thread.SetApartmentState(System.Threading.ApartmentState.STA);

            thread.Start();
        }
Ejemplo n.º 2
0
        private async Task PerformAddingPluginStep(string folder, Guid idPluginType, string name)
        {
            var service = await GetService();

            List <SdkMessageFilter> filters = null;

            if (!_cacheMessageFilters.ContainsKey(service.ConnectionData.ConnectionId))
            {
                if (!_cacheTaskGettingMessageFilters.ContainsKey(service.ConnectionData.ConnectionId))
                {
                    _cacheTaskGettingMessageFilters[service.ConnectionData.ConnectionId] = GetSdkMessageFiltersAsync(service);
                }

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

                await _cacheTaskGettingMessageFilters[service.ConnectionData.ConnectionId];

                ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.GettingMessagesCompleted);
            }

            filters = _cacheMessageFilters[service.ConnectionData.ConnectionId];

            var step = new SdkMessageProcessingStep()
            {
                EventHandler = new EntityReference(PluginType.EntityLogicalName, idPluginType),
            };

            System.Threading.Thread worker = new System.Threading.Thread(() =>
            {
                try
                {
                    var form = new WindowSdkMessageProcessingStep(_iWriteToOutput, service, filters, step);

                    form.ShowDialog();
                }
                catch (Exception ex)
                {
                    DTEHelper.WriteExceptionToOutput(null, ex);
                }
            });

            worker.SetApartmentState(System.Threading.ApartmentState.STA);

            worker.Start();
        }