public override void Initialize(EditingContext context) { this.context = context; AttachedPropertiesService propertiesService = this.context.Services.GetService <AttachedPropertiesService>(); helpService = this.context.Services.GetService <IIntegratedHelpService>(); oldSelection = this.context.Items.GetValue <Selection>(); isPrimarySelectionProperty = new AttachedProperty <bool>() { Getter = (modelItem) => (this.context.Items.GetValue <Selection>().PrimarySelection == modelItem), Name = "IsPrimarySelection", OwnerType = typeof(Object) }; isSelectionProperty = new AttachedProperty <bool>() { Getter = (modelItem) => (((IList)this.context.Items.GetValue <Selection>().SelectedObjects).Contains(modelItem)), Name = "IsSelection", OwnerType = typeof(Object) }; propertiesService.AddProperty(isPrimarySelectionProperty); propertiesService.AddProperty(isSelectionProperty); if (this.context.Services.GetService <ViewService>() == null) { view = new System.Activities.Presentation.View.DesignerView(this.context); WorkflowViewService viewService = new WorkflowViewService(context); WorkflowViewStateService viewStateService = new WorkflowViewStateService(context); this.context.Services.Publish <ViewService>(viewService); this.context.Services.Publish <VirtualizedContainerService>(new VirtualizedContainerService(this.context)); this.context.Services.Publish <ViewStateService>(viewStateService); this.context.Services.Publish <DesignerView>(view); WorkflowAnnotationAdornerService annotationService = new WorkflowAnnotationAdornerService(); annotationService.Initialize(this.context, view.scrollViewer); this.context.Services.Publish <AnnotationAdornerService>(annotationService); this.context.Services.Subscribe <ModelService>(delegate(ModelService modelService) { this.modelService = modelService; if (modelService.Root != null) { view.MakeRootDesigner(modelService.Root); } view.RestoreDesignerStates(); this.context.Items.Subscribe <Selection>(new SubscribeContextCallback <Selection>(OnItemSelected)); }); } if (helpService != null) { helpService.AddContextAttribute(string.Empty, KeywordForWorkflowDesignerHomePage, HelpKeywordType.F1Keyword); } }
public override void Initialize(EditingContext context) { this.context = context; AttachedPropertiesService propertiesService = this.context.Services.GetService<AttachedPropertiesService>(); helpService = this.context.Services.GetService<IIntegratedHelpService>(); oldSelection = this.context.Items.GetValue<Selection>(); isPrimarySelectionProperty = new AttachedProperty<bool>() { Getter = (modelItem) => (this.context.Items.GetValue<Selection>().PrimarySelection == modelItem), Name = "IsPrimarySelection", OwnerType = typeof(Object) }; isSelectionProperty = new AttachedProperty<bool>() { Getter = (modelItem) => (((IList)this.context.Items.GetValue<Selection>().SelectedObjects).Contains(modelItem)), Name = "IsSelection", OwnerType = typeof(Object) }; propertiesService.AddProperty(isPrimarySelectionProperty); propertiesService.AddProperty(isSelectionProperty); if (this.context.Services.GetService<ViewService>() == null) { view = new System.Activities.Presentation.View.DesignerView(this.context); WorkflowViewService viewService = new WorkflowViewService(context); WorkflowViewStateService viewStateService = new WorkflowViewStateService(context); this.context.Services.Publish<ViewService>(viewService); this.context.Services.Publish<VirtualizedContainerService>(new VirtualizedContainerService(this.context)); this.context.Services.Publish<ViewStateService>(viewStateService); this.context.Services.Publish<DesignerView>(view); WorkflowAnnotationAdornerService annotationService = new WorkflowAnnotationAdornerService(); annotationService.Initialize(this.context, view.scrollViewer); this.context.Services.Publish<AnnotationAdornerService>(annotationService); this.context.Services.Subscribe<ModelService>(delegate(ModelService modelService) { this.modelService = modelService; if (modelService.Root != null) { view.MakeRootDesigner(modelService.Root); } view.RestoreDesignerStates(); this.context.Items.Subscribe<Selection>(new SubscribeContextCallback<Selection>(OnItemSelected)); }); } if (helpService != null) { helpService.AddContextAttribute(string.Empty, KeywordForWorkflowDesignerHomePage, HelpKeywordType.F1Keyword); } }
void OnHelpExecuted(Object sender, ExecutedRoutedEventArgs e) { if (this.Context != null) { IIntegratedHelpService help = this.Context.Services.GetService <IIntegratedHelpService>(); if (help != null) { help.ShowHelpFromKeyword(this.helpKeyword); return; } } System.Diagnostics.Process.Start(SR.DefaultHelpUrl); }
public void Initialize() { if (this.isInitialized) { return; } this.ModelItem = this.workflowViewElement.ModelItem; this.EditingContext = this.workflowViewElement.Context; if (!this.CanInitialize()) { return; } this.EditingContext.Items.Subscribe <ReadOnlyState>(this.OnReadOnlyStateChanged); this.ViewStateService.ViewStateChanged += new ViewStateChangedEventHandler(this.OnViewStateChanged); this.ModelItem.PropertyChanged += new PropertyChangedEventHandler(this.OnModelItemPropertyChanged); this.Indicator.IsMouseOverChanged += new EventHandler(this.OnIndicatorIsMouseOverChanged); this.helpService = this.EditingContext.Services.GetService <IIntegratedHelpService>(); this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null; if (this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue == null) { this.Indicator.Visibility = Visibility.Collapsed; if (this.dockedAnnotation != null) { this.DockedAnnotation.Visibility = Visibility.Collapsed; } } else { if (this.IsAnnotationDocked) { this.Indicator.Visibility = Visibility.Collapsed; this.DockedAnnotation.Visibility = Visibility.Visible; this.status = AnnotationStatus.Docked; } else { this.Indicator.Visibility = Visibility.Visible; this.DockedAnnotation.Visibility = Visibility.Collapsed; } } this.isInitialized = true; }
private void OnHelpExecuted(object sender, ExecutedRoutedEventArgs e) { if (this.Context == null) { return; } IIntegratedHelpService help = this.Context.Services.GetService <IIntegratedHelpService>(); if (help != null) { help.ShowHelpFromKeyword(HelpKeywords.ErrorView); } else { System.Diagnostics.Process.Start(SR.DefaultHelpUrl); } }
protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e) { IIntegratedHelpService helpService = this.Context.Services.GetService <IIntegratedHelpService>(); if (helpService != null) { if ((Boolean)e.NewValue) { this.isSelectionChangedInternally = true; this.Context.Items.SetValue(new Selection()); this.isSelectionChangedInternally = false; helpService.AddContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(typeof(ImportDesigner)), System.ComponentModel.Design.HelpKeywordType.F1Keyword); } else { helpService.RemoveContextAttribute(string.Empty, WorkflowViewManager.GetF1HelpTypeKeyword(typeof(ImportDesigner))); } } base.OnIsKeyboardFocusWithinChanged(e); }
public void Initialize() { if (this.isInitialized) { return; } this.ModelItem = this.workflowViewElement.ModelItem; this.EditingContext = this.workflowViewElement.Context; if (!this.CanInitialize()) { return; } this.EditingContext.Items.Subscribe<ReadOnlyState>(this.OnReadOnlyStateChanged); this.ViewStateService.ViewStateChanged += new ViewStateChangedEventHandler(this.OnViewStateChanged); this.ModelItem.PropertyChanged += new PropertyChangedEventHandler(this.OnModelItemPropertyChanged); this.Indicator.IsMouseOverChanged += new EventHandler(this.OnIndicatorIsMouseOverChanged); this.helpService = this.EditingContext.Services.GetService<IIntegratedHelpService>(); this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null; if (this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue == null) { this.Indicator.Visibility = Visibility.Collapsed; if (this.dockedAnnotation != null) { this.DockedAnnotation.Visibility = Visibility.Collapsed; } } else { if (this.IsAnnotationDocked) { this.Indicator.Visibility = Visibility.Collapsed; this.DockedAnnotation.Visibility = Visibility.Visible; this.status = AnnotationStatus.Docked; } else { this.Indicator.Visibility = Visibility.Visible; this.DockedAnnotation.Visibility = Visibility.Collapsed; } } this.isInitialized = true; }