コード例 #1
0
        /// <summary>
        /// Transfers attributes from another <see cref="Element"/> object to this one.
        /// Existing values are not replaced. Provides an inheritance-like relation.
        /// </summary>
        /// <param name="parent">The object to take the attributes from.</param>
        internal void InheritFrom([NotNull] Element parent)
        {
            #region Sanity checks
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            #endregion

            // Check if values are unset and need inheritance)
            if (Version == null)
            {
                Version = parent.Version;
            }
            if (VersionModifier == null)
            {
                VersionModifier = parent.VersionModifier;
            }
            if (Released == default(DateTime))
            {
                Released = parent.Released;
            }
            if (Main == null)
            {
                Main = parent.Main;
            }
            if (SelfTest == null)
            {
                SelfTest = parent.SelfTest;
            }
            if (DocDir == null)
            {
                DocDir = parent.DocDir;
            }
            if (License == null)
            {
                License = parent.License;
            }
            if (Stability == Stability.Unset)
            {
                Stability = parent.Stability;
            }
            if (Languages.Count == 0)
            {
                Languages = new LanguageSet(parent.Languages);
            }
            if (Architecture == default(Architecture))
            {
                Architecture = parent.Architecture;
            }

            // Accumulate list entries
            Commands.AddRange(parent.Commands);
            Dependencies.AddRange(parent.Dependencies);
            Restrictions.AddRange(parent.Restrictions);
            Bindings.AddRange(parent.Bindings);
        }
コード例 #2
0
 protected void OnCreate(Bundle savedInstanceState, int resourceId)
 {
     base.OnCreate(savedInstanceState);
     ResourceId = resourceId;
     SetContentView(resourceId);
     Cheeseknife.Bind(this);
     Bindings.AddRange(Bind(this, Controller));
     Bindings.AddRange(BindXml(this, Controller));
     BindCommands(this, Controller);
     Bindings.AddRange(BindImages(this, Controller));
 }
コード例 #3
0
        public View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, int resourceId)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            var view = inflater.Inflate(resourceId, container, false);

            Cheeseknife.Bind(this, view);
            Bindings.AddRange(Bind(this, Controller));
            Bindings.AddRange(BindXml(this, Controller));
            BindCommands(this, Controller);
            Bindings.AddRange(BindImages(this, Controller));
            return(view);
        }