예제 #1
0
        public UsrCtlBufferDrawing()
        {
            buffergraphs = new BufferedGraphics[NumLayers];
            InitializeComponent();

            ColorBackGround = Color.Black;
            ColorRectangle  = Color.Green;

            pendotborder     = new Pen(Color.Black);
            brushdotnormal   = new SolidBrush(Color.Red);
            brushdotselected = new SolidBrush(Color.Blue);
            pencircle        = new Pen(Color.Violet, 2);
            brushcircle      = new SolidBrush(Color.Violet);

            InitArray();
            dotwidth = 3;

            vartchange = TypeOfChange.TChangeBackGround;

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
            SetStyle(ControlStyles.Opaque, true);
            mousestartpoint.X = -1;

            InitIter();
        }
예제 #2
0
        private void VerifyPoints()
        {
            ChangeSelection = false;
            Boolean selpoint;

            for (int i = 0; i < NumPoints; i++)
            {
                double dist1 = distance(mousecurrent.X, mousecurrent.Y, mousestartpoint.X, mousestartpoint.Y);
                double dist2 = distance(dots[i].X, dots[i].Y, mousestartpoint.X, mousestartpoint.Y);
                if (dist2 <= dist1)
                {
                    selpoint = true;
                }
                else
                {
                    selpoint = false;
                }

                if (selecpto[i] && !selpoint)
                {
                    ChangeSelection = true;
                }
                if (!selecpto[i] && selpoint)
                {
                    ChangeSelection = true;
                }

                selecpto[i] = selpoint;
            }
            if (ChangeSelection)
            {
                vartchange = TypeOfChange.TChangeDotWidth;
            }
        }
예제 #3
0
 private void UsrCtlBufferDrawing_MouseUp(Object sender, MouseEventArgs e)
 {
     if (mousestartpoint.X != -1)
     {
         ResetSelectPtos();
         vartchange        = TypeOfChange.TChangeDotWidth;
         mousestartpoint.X = -1;
         Invalidate();
     }
 }
예제 #4
0
 private void UsrCtlBufferDrawing_MouseDown(Object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         mousestartpoint.X = e.X;
         mousestartpoint.Y = e.Y;
         vartchange        = TypeOfChange.TChangeSelCircle;
         Invalidate();
     }
 }
예제 #5
0
        private void FisherCollection_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            TypeOfChange c = TypeOfChange.Added;

            EditSuccess = false;
            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
            {
                int    newIndex  = e.NewStartingIndex;
                Fisher newFisher = FisherCollection[newIndex];

                if (Fishers.Add(newFisher))
                {
                    CurrentEntity = newFisher;
                    EditSuccess   = true;
                }
            }
            break;

            case NotifyCollectionChangedAction.Remove:
            {
                List <Fisher> tempListOfRemovedItems = e.OldItems.OfType <Fisher>().ToList();
                if (Fishers.Delete(tempListOfRemovedItems[0]))
                {
                    EditSuccess   = true;
                    CurrentEntity = null;
                }
                c = TypeOfChange.Deleted;
            }
            break;

            case NotifyCollectionChangedAction.Replace:
            {
                List <Fisher> tempList = e.NewItems.OfType <Fisher>().ToList();
                if (Fishers.Update(tempList[0]))
                {
                    EditSuccess   = true;
                    CurrentEntity = tempList[0];
                }
                c = TypeOfChange.Edited;
            }
            break;
            }

            if (EditSuccess && EntitiesChanged != null)
            {
                EntitiesChangedEventArg ece = new EntitiesChangedEventArg
                {
                    TypeOfChange = c,
                    Entity       = CurrentEntity
                };
                EntitiesChanged(this, ece);
            }
        }
예제 #6
0
 private void UsrCtlBufferDrawing_Move(Object sender, MouseEventArgs e)
 {
     mousecurrent.X = e.X;
     mousecurrent.Y = e.Y;
     if (mousestartpoint.X != -1)
     {
         vartchange = TypeOfChange.TChangeSelCircle;
         VerifyPoints();
         Invalidate();
     }
 }
예제 #7
0
        private void UsrCtlBufferDrawing_Resize(Object sender, EventArgs e)
        {
            BufferedGraphicsContext context;

            context = BufferedGraphicsManager.Current;
            context.MaximumBuffer = new Size(Width + 1, Height + 1);
            for (int i = 0; i < NumLayers; i++)
            {
                buffergraphs[i] = context.Allocate(CreateGraphics(), new Rectangle(0, 0, Width, Height));
            }
            vartchange = TypeOfChange.TChangeBackGround;
            Invalidate();
        }
예제 #8
0
        public void ObjectComparison <T>(T originalObject, T updatedObject, string firstProperty,
                                         string secondProperty, TypeOfChange typeOfChange, List <Approval> approvalList, DateTime dateOdChange)
        {
            var originalFirstValue = typeof(T).GetProperty(firstProperty)?.GetValue(originalObject);
            var updatedFirstValue  = typeof(T).GetProperty(firstProperty)?.GetValue(updatedObject);
            var updatedSecondValue = typeof(T).GetProperty(secondProperty)?.GetValue(updatedObject);

            if (!originalFirstValue.Equals(updatedFirstValue))
            {
                _auditLogService.AddRecord(true, typeOfChange, originalFirstValue.ToString(),
                                           updatedFirstValue.ToString(), approvalList, dateOdChange);
            }

            if (!updatedFirstValue.Equals(updatedSecondValue))
            {
                _auditLogService.AddRecord(false, typeOfChange, updatedFirstValue.ToString(),
                                           updatedSecondValue.ToString(), approvalList, dateOdChange);
            }
        }
예제 #9
0
        public void AddRecord(bool isPlanned, TypeOfChange typeOfChange, string originalValue,
                              string newValue, List <Approval> approvalList, DateTime dateOfChang = default,
                              List <string> affectedDays = default)
        {
            var auditLogEntry = new AuditLogEntry()
            {
                //todo ask (the date must be from the date of the change)
                StartDateOfChange = _globalVariablesService.GetGlobalStartDateOfChange(),
                EndDateOfChange   = DateTime.UtcNow,
                AffectedDays      = affectedDays,
                TypeOfChange      = typeOfChange.ToString(),
                IsPlanned         = isPlanned,
                OriginalValue     = originalValue,
                NewValue          = newValue,
                Approvals         = approvalList
            };

            _globalVariablesService.AddGlobalAuditLogEntry(auditLogEntry);
            _globalVariablesService.AddGlobalDatesOfChange(dateOfChang);
        }
 internal SelectedItemsChangedEventArgs(RowIdentifier[] items, TypeOfChange changeType)
 {
     _items      = items;
     _changeType = changeType;
 }
예제 #11
0
 private void AddRecord(bool isPlanned, TypeOfChange typeOfChange, string originalValue, string newValue,
                        List <Approval> approvalList, DateTime dateOfChang, List <string> affectedDays = default)
 {
     _auditLogService.AddRecord(isPlanned, typeOfChange, originalValue, newValue, approvalList, dateOfChang, affectedDays);
 }
예제 #12
0
 public TimelineChange(TypeOfChange changeType, int targetNoteId, object changedData)
 {
     _changeType = changeType;
     _changedIdeaID = targetNoteId;
     _metaData = changedData;
 }
예제 #13
0
        private void UsrCtlBufferDrawing_Paint(Object sender, PaintEventArgs e)
        {
            if (e.ClipRectangle.Width == 0)
            {
                return;
            }

            Stopwatch sw = Stopwatch.StartNew();

            if (!uselayers)
            {
                DrawFirstLayer(buffergraphs[0].Graphics, e.ClipRectangle);
                DrawSecondLayer(buffergraphs[0].Graphics, e.ClipRectangle);
                DrawThirdLayer(buffergraphs[0].Graphics, e.ClipRectangle);
                DrawFourthLayer(buffergraphs[0].Graphics, e.ClipRectangle);
                buffergraphs[0].Render(e.Graphics);

                sw.Stop();
                timeused = sw.Elapsed;
                return;
            }

            if (vartchange == TypeOfChange.TChangeBackGround)
            {
                DrawFirstLayer(buffergraphs[(int)TypeOfChange.TChangeBackGround].Graphics, e.ClipRectangle);
                buffergraphs[(int)TypeOfChange.TChangeBackGround].Render(buffergraphs[(int)TypeOfChange.TChangeRectangles].Graphics);
            }
            if (vartchange == TypeOfChange.TChangeRectangles)
            {
                buffergraphs[(int)TypeOfChange.TChangeBackGround].Render(buffergraphs[(int)TypeOfChange.TChangeRectangles].Graphics);
            }

            if (vartchange == TypeOfChange.TChangeBackGround || vartchange == TypeOfChange.TChangeRectangles)
            {
                DrawSecondLayer(buffergraphs[(int)TypeOfChange.TChangeRectangles].Graphics, e.ClipRectangle);
                buffergraphs[(int)TypeOfChange.TChangeRectangles].Render(buffergraphs[(int)TypeOfChange.TChangeDotWidth].Graphics);
            }
            if (vartchange == TypeOfChange.TChangeDotWidth)
            {
                buffergraphs[(int)TypeOfChange.TChangeRectangles].Render(buffergraphs[(int)TypeOfChange.TChangeDotWidth].Graphics);
            }

            if (vartchange == TypeOfChange.TChangeBackGround || vartchange == TypeOfChange.TChangeRectangles ||
                vartchange == TypeOfChange.TChangeDotWidth)
            {
                DrawThirdLayer(buffergraphs[(int)TypeOfChange.TChangeDotWidth].Graphics, e.ClipRectangle);
                buffergraphs[(int)TypeOfChange.TChangeDotWidth].Render(buffergraphs[(int)TypeOfChange.TChangeSelCircle].Graphics);
            }
            if (vartchange == TypeOfChange.TChangeSelCircle)
            {
                buffergraphs[(int)TypeOfChange.TChangeDotWidth].Render(buffergraphs[(int)TypeOfChange.TChangeSelCircle].Graphics);
            }

            if (vartchange != TypeOfChange.TChangeNone)
            {
                DrawFourthLayer(buffergraphs[(int)TypeOfChange.TChangeSelCircle].Graphics, e.ClipRectangle);
                buffergraphs[(int)TypeOfChange.TChangeSelCircle].Render(e.Graphics);
                //buffergraphs[(int)TypeOfChange.TChangeSelCircle].Render(Graphics.FromHwnd(this.Handle));
            }
            if (vartchange == TypeOfChange.TChangeNone)
            {
                buffergraphs[(int)TypeOfChange.TChangeSelCircle].Render(e.Graphics);
            }
            //buffergraphs[(int)TypeOfChange.TChangeSelCircle].Render(Graphics.FromHwnd(this.Handle));

            vartchange = TypeOfChange.TChangeNone;
            sw.Stop();
            timeused = sw.Elapsed;
        }
예제 #14
0
 public AnimEffectBoneChange(SerializationInfo info, StreamingContext ctxt)
 {
     type     = (TypeOfChange)info.GetValue("Type", typeof(TypeOfChange));
     FromMset = (int)info.GetValue("FromMset", typeof(int));
 }
예제 #15
0
 public TimelineChange(TypeOfChange changeType, int targetNoteId, object changedData)
 {
     _changeType    = changeType;
     _changedIdeaID = targetNoteId;
     _metaData      = changedData;
 }