Beispiel #1
0
        public void ClearSignatures()
        {
            var changes = new SignatureChanges();

            while (CurrentSignatures.Count > 0)
            {
                var index            = CurrentSignatures.Count - 1;
                var currentSignature = CurrentSignatures[index];

                changes.Removed.Add(currentSignature);

                CurrentSignatures.RemoveAt(index);

                for (var i = 0; i < Pages.Count; i++)
                {
                    foreach (var uiElement in currentSignature.UIElements)
                    {
                        Pages[i].RemoveUIElement(uiElement.Item2);
                    }
                }
            }

            if (changes.Removed.Count > 0)
            {
                UndoChangeList.Add(changes);
            }
        }
Beispiel #2
0
        private void ProcessSignatureChanges(SignatureChanges signatureChanges, bool inverted)
        {
            List <SignatureChange> added   = signatureChanges.Added;
            List <SignatureChange> removed = signatureChanges.Removed;

            if (inverted)
            {
                added   = signatureChanges.Removed;
                removed = signatureChanges.Added;
            }

            foreach (var signatureChange in added)
            {
                CurrentSignatures.Add(signatureChange);

                foreach (var uiElement in signatureChange.UIElements)
                {
                    Pages[uiElement.Item1].AddUIElement(uiElement.Item2);
                }
            }

            foreach (var signatureChange in removed)
            {
                CurrentSignatures.Remove(signatureChange);

                foreach (var uiElement in signatureChange.UIElements)
                {
                    Pages[uiElement.Item1].RemoveUIElement(uiElement.Item2);
                }
            }
        }
Beispiel #3
0
        private TextBox AddSignatureNoCopy(SignatureChange signatureChange, int textboxToReturnPageIndex = -1)
        {
            CurrentSignatures.Add(signatureChange);

            var changes = new SignatureChanges();

            changes.Added.Add(signatureChange);
            UndoChangeList.Add(changes);

            return(AddSignatureToPages(signatureChange, textboxToReturnPageIndex));
        }
Beispiel #4
0
        public void AddSignaturesAndCopy(List <SignatureChange> signatures)
        {
            var changes = new SignatureChanges();

            foreach (var signature in signatures)
            {
                if (!CurrentSignatures.Exists(s => s is SignatureChange sc && sc.Equals(signature)))
                {
                    var copy = signature.Copy();

                    CurrentSignatures.Add(copy);
                    AddSignatureToPages(copy);

                    changes.Added.Add(copy);
                }
            }

            if (changes.Added.Count > 0)
            {
                UndoChangeList.Add(changes);
            }
        }