Beispiel #1
0
        private void ListTypeSteps_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var step = (CrmTypeStep)ListTypeSteps.SelectedItem;

            new Thread(() =>
            {
                if (step != null)
                {
                    IsTypeStepSelected = true;

                    // don't fetch from CRM if updated once (caching)
                    if (!step.IsUpdated)
                    {
                        try
                        {
                            UpdateStatus("Updating type step info ...", true);
                            step.UpdateInfo(context);
                            UpdateStatus("-- Finished updating type step info.", false);
                        }
                        catch (Exception exception)
                        {
                            PopException(exception);
                        }
                        finally
                        {
                            UpdateStatus("", false);
                        }
                    }

                    IsAddImageAllowed = (step.Message == "Create" &&
                                         step.Stage == SdkMessageProcessingStep.Enums.Stage.Postoperation) ||
                                        (step.Message != "Create"
                                         &&
                                         !string.IsNullOrEmpty(CrmDataHelper.GetMessagePropertyName(step.Message,
                                                                                                    step.Entity)));
                }
                else
                {
                    IsAddImageAllowed = false;
                }

                // update UI
                UpdateListBindingToEntityChildren(step, ListStepImages);
            }).Start();
        }