Example #1
0
        public void RemoveInvokesCallback()
        {
            var invokedCallback = false;
            var textBlock       = new TextBlock();
            var key             = new object();

            _toastNotificationService.Display(key, textBlock, () => { invokedCallback = true; });
            Assert.True(_toastNotificationService.Remove(key));
            Assert.True(invokedCallback);
        }
        private void OnStateChanged(object sender, EventArgs e)
        {
            switch (_keyBindingService.ConflictingKeyBindingState)
            {
            case ConflictingKeyBindingState.HasNotChecked:
            case ConflictingKeyBindingState.ConflictsIgnoredOrResolved:
                if (_hasDisplayed)
                {
                    _toastNotificationService.Remove(_toastKey);
                }
                break;

            case ConflictingKeyBindingState.FoundConflicts:
                _toastNotificationService.Display(_toastKey, _control, OnNotificationClosed);
                _hasDisplayed = true;
                break;

            default:
                throw new Exception("Enum value unknown");
            }
        }