Beispiel #1
0
        public void Clear()
        {
            // raise the BeforeChanged event
            var args = new BeforeChangedEventArgs();

            BeforeChanged?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }

            _currentSelection.Clear();
            Changed?.Invoke(this, EventArgs.Empty);
        }
Beispiel #2
0
        private void ApplyChange(TextSnapshotMock snapshot)
        {
            Changing?.Invoke(this, new TextContentChangingEventArgs(CurrentSnapshot, new object(), CancelAction));

            var before = CurrentSnapshot;

            CurrentSnapshot = snapshot;

            var args = new TextContentChangedEventArgs(before, CurrentSnapshot, EditOptions.None, new object());

            BeforeChanged?.Invoke(this, args);
            ChangedHighPriority?.Invoke(this, args);
            Changed?.Invoke(this, args);
            ChangedLowPriority?.Invoke(this, args);
            PostChanged?.Invoke(this, EventArgs.Empty);
        }
Beispiel #3
0
        public static void Set(int uiScalePercent = 100)
        {
            if (!_initialized && !Runtime.IsLinux && Environment.OSVersion.Version.Major >= 6)
            {
                SetProcessDPIAware();
            }

            if (_initialized && _uiScalePercent == uiScalePercent)
            {
                return;
            }

            _initialized = true;

            _uiScalePercent = uiScalePercent;
            _scale          = getDpiScale().MultiplyBy(_uiScalePercent / 100f);

            BeforeChanged?.Invoke();
            Changed?.Invoke();
            AfterChanged?.Invoke();
        }
Beispiel #4
0
        public void Replace(IEnumerable <IEntity> newSelection)
        {
            if (newSelection == null)
            {
                throw new ArgumentNullException(nameof(newSelection));
            }

            // raise the BeforeChanged event
            var args = new BeforeChangedEventArgs();

            BeforeChanged?.Invoke(this, args);
            if (args.Cancel)
            {
                return;
            }

            _currentSelection.Clear();
            _currentSelection.AddRange(newSelection);

            // notify listeners
            Changed?.Invoke(this, EventArgs.Empty);
        }