Example #1
0
        /// <summary>
        /// Initializes the report item.
        /// </summary>
        /// <param name="dataContext">Data context associated with this report item.</param>
        /// <param name="properties">Property bag associated with this report item.</param>
        public override void Initialize(IDataScope dataContext, IPropertyBag properties)
        {
            base.Initialize(dataContext, properties);

            Debug.Assert(dataContext is CustomData, "Expected IDataScope to be CustomData!");
            _customData = dataContext as CustomData;
        }
Example #2
0
        /// <summary>
        /// Initializes the report item.
        /// </summary>
        /// <param name="dataContext">Data context associated with this report item.</param>
        /// <param name="properties">Property bag associated with this report item.</param>
        public virtual void Initialize(IDataScope dataContext, IPropertyBag properties)
        {
            if (properties == null)
            {
                throw new ArgumentNullException("properties");
            }

            _dataScope   = dataContext;
            _propertyBag = properties;
        }
Example #3
0
 void IReportItem.Initialize(IDataScope dataContext, IPropertyBag properties)
 {
     _dataScope  = dataContext;
     _properties = properties;
 }
Example #4
0
 public override IContext createContext(NodeMapInfo map, IContextObject owner, IDataScope globalData)
 {
     return(new SkillSubContext(map, owner, globalData));
 }
Example #5
0
 public SkillSubContext(NodeMapInfo map, IContextObject owner, IDataScope globalData)
     : base(map, owner, globalData)
 {
 }
Example #6
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (service != null)
         {
             IObjectPointer mm = value as IObjectPointer;
             if (mm == null)
             {
                 PropertyPointer pp = new PropertyPointer();
                 IDataScope      dv = context.Instance as IDataScope;
                 if (dv != null)
                 {
                     pp.Scope = dv.ScopeDataType;
                     pp.Owner = dv.ScopeOwner;
                 }
                 mm = pp;
             }
             if (mm != null)
             {
                 IMethod      imScope = null;
                 Type         t       = service.GetType();
                 PropertyInfo pif0    = t.GetProperty("OwnerGrid");
                 if (pif0 != null)
                 {
                     object           pv = pif0.GetValue(service, null);
                     MathPropertyGrid pg = pv as MathPropertyGrid;
                     if (pg != null)
                     {
                         imScope = pg.ScopeMethod;
                     }
                 }
                 if (imScope == null)
                 {
                     IScopeMethodHolder mh = context.Instance as IScopeMethodHolder;
                     if (mh != null)
                     {
                         imScope = mh.GetScopeMethod();
                     }
                 }
                 DataTypePointer scope = null;
                 IOwnerScope     ios   = context.Instance as IOwnerScope;
                 if (ios != null)
                 {
                     scope = ios.OwnerScope;
                 }
                 if (scope == null)
                 {
                     ParameterValue pv = context.Instance as ParameterValue;
                     if (pv != null && pv.DataType != null && pv.DataType.BaseClassType != null)
                     {
                         if (typeof(Delegate).IsAssignableFrom(pv.DataType.BaseClassType))
                         {
                             scope = pv.DataType;
                         }
                     }
                 }
                 FrmObjectExplorer dlg = DesignUtil.GetPropertySelector(mm, imScope, scope);
                 if (dlg != null)
                 {
                     OnDialogCreated(dlg);
                     if (service.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                     {
                         bool   isValid = true;
                         string msg     = string.Empty;
                         if (MethodEditContext.IsWebPage)
                         {
                             IObjectPointer iop = dlg.SelectedObject as IObjectPointer;
                             if (iop != null)
                             {
                                 if (MethodEditContext.UseClientPropertyOnly)
                                 {
                                     if (iop.RunAt == EnumWebRunAt.Server)
                                     {
                                         isValid = false;
                                         msg     = "Server value is not allowed";
                                     }
                                 }
                                 else if (MethodEditContext.UseServerPropertyOnly)
                                 {
                                     if (iop.RunAt == EnumWebRunAt.Client)
                                     {
                                         isValid = false;
                                         msg     = "Client value is not allowed";
                                     }
                                 }
                             }
                         }
                         if (!isValid)
                         {
                             MessageBox.Show(msg, "Select value", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                         else
                         {
                             value = dlg.SelectedObject;
                             if (context.PropertyDescriptor.IsReadOnly)
                             {
                                 //manually set it
                                 PropertyInfo pif = context.Instance.GetType().GetProperty(context.PropertyDescriptor.Name);
                                 pif.SetValue(context.Instance, value, new object[] { });
                             }
                         }
                     }
                     dlg.ResetSelectLValue();
                 }
             }
         }
     }
     return(value);
 }