コード例 #1
0
        /// <summary>
        /// Returns copy of the item.
        ///
        /// This routine is called to propagate the item
        /// within each view (both in the same view as well as
        /// across multiple views in multi-user displays)
        /// </summary>
        public override BaseItem Copy()
        {
            NoteCustomItem objCopy = new NoteCustomItem();

            CopyToItem(objCopy);

            return(objCopy);
        }
コード例 #2
0
        /// <summary>
        /// Copies the CustomCalendarItem specific properties
        /// to new instance of the item
        /// </summary>
        /// <param name="copy">New CustomCalendarItem instance</param>
        protected override void CopyToItem(BaseItem copy)
        {
            NoteCustomItem objCopy = copy as NoteCustomItem;

            base.CopyToItem(objCopy);

            // All private data that you want to carried
            // forward, needs to be propagated here

            objCopy._Image = this._Image;
        }
コード例 #3
0
        /// <summary>
        /// Handles TextChange events for the BaseCalendarItem
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void BaseCalendarItem_TextChanged(object sender, EventArgs e)
        {
            NoteCustomItem nci = BaseCalendarItem as NoteCustomItem;

            if (nci != null)
            {
                Text = nci.Text;

                Refresh();
            }
        }
コード例 #4
0
        /// <summary>
        /// Handles TextChanged events for the specific item.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ItemTextChanged(object sender, EventArgs e)
        {
            NoteCustomItem nci = BaseCalendarItem as NoteCustomItem;

            // Propagate the event to all other potential versions
            // via the BaseCalendarItem

            if (nci != null)
            {
                nci.Text = Text;
            }
        }
コード例 #5
0
        /// <summary>
        /// Hooks or unhooks our BaseCalendarItem events.
        ///
        /// In order to keep all displayed items "in-sync", it is necessary
        /// to propagate data to and from the BaseCalendarItem.  This is
        /// accomplished via hooking those members you are interested in, at
        /// both the item (HookEvents) and BaseCalendarItem (HookBaseEvents)
        /// level.
        /// </summary>
        /// <param name="hook">true to hook, false to unhook</param>
        private void HookBaseEvents(bool hook)
        {
            NoteCustomItem nci = BaseCalendarItem as NoteCustomItem;

            if (nci != null)
            {
                if (hook == true)
                {
                    nci.TextChanged +=
                        new EventHandler(BaseCalendarItem_TextChanged);
                }
                else
                {
                    nci.TextChanged -=
                        new EventHandler(BaseCalendarItem_TextChanged);
                }
            }
        }