Пример #1
0
        protected T SetValue <T>(T oldValue,
                                 T value,
                                 string name,
                                 ref ComponentFieldFlags flag,
                                 Action <T, T> onChangedAction = null)
        {
            if (Equals(oldValue,
                       value))
            {
                ComponentFieldFlags newFlag = FieldFlagMapping.SafeGet(name,
                                                                       ComponentFieldFlags.None);

                if (newFlag != ComponentFieldFlags.None)
                {
                    flag |= newFlag;
                }

                onChangedAction?.Invoke(oldValue,
                                        value);

#if DEBUG
                //System.Diagnostics.Debug.WriteLine("[{0}] {1}: {2}",
                //                                   GetType().Name,
                //                                   name,
                //                                   value);
#endif
            }

            return(value);
        }
Пример #2
0
        protected T SetValue <T>(T oldValue,
                                 T value,
                                 string name,
                                 ref ComponentFieldFlags flag,
                                 Action <T, T> onChangedAction = null)
        {
            if (Equals(oldValue,
                       value))
            {
                ComponentFieldFlags newFlag = FieldFlagMapping.SafeRead(name,
                                                                        ComponentFieldFlags.None);

                if (newFlag != ComponentFieldFlags.None)
                {
                    flag |= newFlag;
                }

                onChangedAction?.Invoke(oldValue,
                                        value);

#if DEBUG_REGISTRIES
                LogTo.Debug("[{0}] {1}: {2}",
                            GetType().Name,
                            name,
                            value);
#endif
            }

            return(value);
        }
Пример #3
0
        protected void Update(short left,
                              short top,
                              short right,
                              short bottom,
                              AtFlags displayAt,
                              ComponentFieldFlags flags)
        {
#if DEBUG
            //System.Diagnostics.Debug.WriteLine("[{0}] Updating component", new[] { this.GetType().Name });
#endif

            Left = SetValue(Left,
                            left,
                            nameof(Left),
                            ref flags);
            Top = SetValue(Top,
                           top,
                           nameof(Top),
                           ref flags);
            Right = SetValue(Right,
                             right,
                             nameof(Right),
                             ref flags);
            Bottom = SetValue(Bottom,
                              bottom,
                              nameof(Bottom),
                              ref flags);
            DisplayAt = SetValue(DisplayAt,
                                 displayAt,
                                 nameof(DisplayAt),
                                 ref flags);
        }
Пример #4
0
        protected void Update(short left,
                              short top,
                              short width,
                              short height,
                              AtFlags displayAt,
                              ComponentFieldFlags flags)
        {
#if DEBUG_REGISTRIES
            LogTo.Debug("[{0}] Updating component",
                        GetType().Name);
#endif

            Left = SetValue(Left,
                            left,
                            nameof(Left),
                            ref flags);
            Top = SetValue(Top,
                           top,
                           nameof(Top),
                           ref flags);
            Width = SetValue(Width,
                             width,
                             nameof(Width),
                             ref flags);
            Height = SetValue(Height,
                              height,
                              nameof(Height),
                              ref flags);
            DisplayAt = SetValue(DisplayAt,
                                 displayAt,
                                 nameof(DisplayAt),
                                 ref flags);
        }
Пример #5
0
 public SMComponentChangedArgs(ISuperMemo smMgmt,
                               IComponent component,
                               ComponentFieldFlags changedFields)
     : base(smMgmt)
 {
     Component     = component;
     ChangedFields = changedFields;
 }
Пример #6
0
        public void Update(ref InfComponentsImage17 comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            ImageId = SetValue(ImageId, comp.registryId, nameof(ImageId), ref flags);
            Stretch = SetValue(Stretch, (ImageStretchMode)comp.stretchType, nameof(Stretch), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.width, comp.height,
                (AtFlags)comp.displayAt,
                flags
                );
        }
        public void Update(ref InfComponentsHtml comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            TextId     = SetValue(TextId, comp.registryId, nameof(TextId), ref flags);
            IsFullHtml = SetValue(IsFullHtml, comp.isFullHtml != 0, nameof(IsFullHtml), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.width, comp.height,
                (AtFlags)comp.displayAt,
                flags
                );
        }
        public void Update(ref InfComponentsRtf comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            TextId     = SetValue(TextId, comp.registryId, nameof(TextId), ref flags);
            ColorRed   = SetValue(ColorRed, comp.colorRed, nameof(ColorRed), ref flags);
            ColorGreen = SetValue(ColorGreen, comp.colorGreen, nameof(ColorGreen), ref flags);
            ColorBlue  = SetValue(ColorBlue, comp.colorBlue, nameof(ColorBlue), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.width, comp.height,
                (AtFlags)comp.displayAt,
                flags
                );
        }
Пример #9
0
        public void Update(InfComponentsText comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            TextId        = SetValue(TextId, comp.registryId, nameof(TextId), ref flags);
            ColorRed      = SetValue(ColorRed, comp.colorRed, nameof(ColorRed), ref flags);
            ColorGreen    = SetValue(ColorGreen, comp.colorGreen, nameof(ColorGreen), ref flags);
            ColorBlue     = SetValue(ColorBlue, comp.colorBlue, nameof(ColorBlue), ref flags);
            TextAlignment = SetValue(TextAlignment, (TextAlignment)comp.textAlignment, nameof(TextAlignment), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.right, comp.bottom,
                (AtFlags)comp.displayAt,
                flags
                );
        }
        public void Update(ref InfComponentsVideo17 comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            VideoId      = SetValue(VideoId, comp.registryId, nameof(VideoId), ref flags);
            IsContinuous = SetValue(IsContinuous, comp.isContinuous, nameof(IsContinuous), ref flags);
            IsFullScreen = SetValue(IsFullScreen, comp.isFullScreen, nameof(IsFullScreen), ref flags);
            ExtractStart = SetValue(ExtractStart, comp.extractStart, nameof(ExtractStart), ref flags);
            ExtractStop  = SetValue(ExtractStop, comp.extractStop, nameof(ExtractStop), ref flags);
            Panel        = SetValue(Panel, (MediaPanelType)comp.panel, nameof(Panel), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.width, comp.height,
                (AtFlags)comp.displayAt,
                flags
                );
        }
Пример #11
0
        public void Update(InfComponentsSound comp)
        {
            ComponentFieldFlags flags = ComponentFieldFlags.None;

            SoundId       = SetValue(SoundId, comp.registryId, nameof(SoundId), ref flags);
            ColorRed      = SetValue(ColorRed, comp.colorRed, nameof(ColorRed), ref flags);
            ColorGreen    = SetValue(ColorGreen, comp.colorGreen, nameof(ColorGreen), ref flags);
            ColorBlue     = SetValue(ColorBlue, comp.colorBlue, nameof(ColorBlue), ref flags);
            PlayAt        = SetValue(PlayAt, (AtFlags)comp.playAt, nameof(PlayAt), ref flags);
            ExtractStart  = SetValue(ExtractStart, comp.extractStart, nameof(ExtractStart), ref flags);
            ExtractStop   = SetValue(ExtractStop, comp.extractStop, nameof(ExtractStop), ref flags);
            IsContinuous  = SetValue(IsContinuous, comp.isContinuous, nameof(IsContinuous), ref flags);
            Panel         = SetValue(Panel, (MediaPanelType)comp.panel, nameof(Panel), ref flags);
            TextAlignment = SetValue(TextAlignment, (TextAlignment)comp.textAlignment, nameof(TextAlignment), ref flags);

            base.Update(
                comp.left, comp.top,
                comp.right, comp.bottom,
                (AtFlags)comp.displayAt,
                flags
                );
        }