コード例 #1
0
        /// <summary>
        /// Notification method activated from Adaptor
        /// </summary>
        /// <param name="aSender">
        /// Object that made change <see cref="System.Object"/>
        /// </param>
        public virtual void GetDataFromDataSource(object aSender)
        {
/*			if (Adaptor.FinalTarget == null) {
 *                              Visible = false;
 *                              Sensitive = false;
 *                              return;
 *                      }*/
//System.Data.Bindings.DebugInformation.ConsoleDebug.TraceStack ("GetData");
            object vis, sen;

            CachedProperty.UncachedGetValue(Adaptor.FinalTarget, VisibleMapping, out vis, false);
            CachedProperty.UncachedGetValue(Adaptor.FinalTarget, SensitiveMapping, out sen, false);
            if (firsttime == false)
            {
                if (((bool)vis == Visible) && ((bool)sen == Sensitive) && (lastTarget.Target == adaptor.FinalTarget))
                {
                    return;
                }
            }
//System.Console.WriteLine("AssignData (" + adaptor.FinalTarget + ") vis=" + (bool) vis + " sen=" + (bool) sen);
            Gtk.Application.Invoke(delegate {
                Visible   = (bool)vis;
                Sensitive = (bool)sen;
//System.Console.WriteLine("Set firsttime");
                firsttime         = false;
                lastTarget.Target = adaptor.FinalTarget;
            });
        }
コード例 #2
0
        /// <summary>
        /// Resolves final target for Adaptor
        /// </summary>
        /// <returns>
        /// Object of the final target this adaptor is pointing to <see cref="System.Object"/>
        /// </returns>
        protected override object DoGetFinalTarget(out bool aCallControl)
        {
            aCallControl = false;
            if (GetDefaultProperty() == null)
            {
                return(null);
            }
            object res = base.DoGetFinalTarget(out aCallControl);

            finalTarget.Target = null;
            if (res == null)
            {
                return(null);
            }
            // Resolve forward if mapped property is adaptor
            object tgt = null;

            if (GetDefaultProperty() == null)
            {
                return(null);
            }
            if (CachedProperty.UncachedGetValue(res, GetDefaultProperty().Name, out tgt) == false)
            {
                tgt = ConnectionProvider.ResolveTargetForObject(tgt);
            }
            // set checks
            if (DataSourceType != null)
            {
                if (TypeValidator.IsCompatible(tgt.GetType(), DataSourceType) == true)
                {
                    return(tgt);
                }
                return(null);
            }
            else
            {
                return(tgt);
            }
        }