コード例 #1
0
        static Type ResolveGenericParameters(DependencyObject dropTarget, EditingContext context, Type type)
        {
            // look to see if there is a DefaultTypeArgumentAttribute on it
            DefaultTypeArgumentAttribute typeArgumentAttribute = ExtensibilityAccessor.GetAttribute <DefaultTypeArgumentAttribute>(type);

            if (typeArgumentAttribute != null && typeArgumentAttribute.Type != null)
            {
                type = type.MakeGenericType(typeArgumentAttribute.Type);
            }
            else //require user to resolve generic arguments
            {
                ActivityTypeResolver wnd = new ActivityTypeResolver();
                if (null != context)
                {
                    WindowHelperService service = context.Services.GetService <WindowHelperService>();
                    if (null != service)
                    {
                        service.TrySetWindowOwner(dropTarget, wnd);
                    }
                }

                TypeResolvingOptions dropTargetOptions   = null;
                TypeResolvingOptions activityTypeOptions = null;

                //try to see if the container has any customization for type resolver
                ICompositeView container = dropTarget as ICompositeView;
                if (container != null)
                {
                    dropTargetOptions = container.DroppingTypeResolvingOptions;
                }

                //try to see if the activity type in discourse has any customization for type resolver
                TypeResolvingOptionsAttribute attr = WorkflowViewService.GetAttribute <TypeResolvingOptionsAttribute>(type);
                if (attr != null)
                {
                    activityTypeOptions = attr.TypeResolvingOptions;
                }
                //if both have type resolver, try to merge them
                TypeResolvingOptions options = TypeResolvingOptions.Merge(dropTargetOptions, activityTypeOptions);
                if (options != null)
                {
                    wnd.Options = options;
                }

                wnd.Context    = context;
                wnd.EditedType = type;
                wnd.Width      = 340;
                wnd.Height     = 200;
                type           = (true == wnd.ShowDialog() ? wnd.ConcreteType : null);
            }
            return(type);
        }
コード例 #2
0
        bool?Show(bool okCancel)
        {
            WorkflowElementDialogWindow wnd = new WorkflowElementDialogWindow(this, okCancel, this.EnableMinimizeButton, this.EnableMaximizeButton, this.OnOk)
            {
                Title = this.Title
            };

            if (null != this.Context)
            {
                WindowHelperService srv = this.Context.Services.GetService <WindowHelperService>();
                if (null != srv)
                {
                    srv.TrySetWindowOwner(this.Owner, wnd);
                }
            }
            wnd.Closed += (s, e) => { this.OnWorkflowElementDialogClosed(((Window)s).DialogResult); };
            return(wnd.ShowDialog());
        }
コード例 #3
0
ファイル: TypeBrowser.xaml.cs プロジェクト: dox0/DotNet471RS3
 public bool?ShowDialog(DependencyObject owner)
 {
     WindowHelperService.TrySetWindowOwner(owner, this.Context, this);
     this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new Action(() => { this.perfEventProvider.TypeBrowserApplicationIdleAfterShowDialog(); }));
     return(base.ShowDialog());
 }
コード例 #4
0
 void SetWindowOwner(Window wnd)
 {
     WindowHelperService.TrySetWindowOwner(this, this.Context, wnd);
 }