Example #1
0
        public void Close(IModalToken openToken)
        {
            Contract.Requires <InvalidOperationException>(IsOpen, "Close called when ModalControl was not oppen.");
            Contract.Requires <ArgumentException>(openToken != null, "openToken must be non-null");
            Debug.Assert(!_content.IsEmpty());

            var tokenAndRemainder = _content.SkipWhile(cw => cw != openToken).ToList();

            Util.ThrowUnless <ArgumentException>(tokenAndRemainder.Any(), "The provided token does not exist");
            Debug.Assert(tokenAndRemainder.First() == openToken);
            foreach (var item in tokenAndRemainder.Skip(1))
            {
                Util.ThrowUnless <ArgumentException>(item.AllowsCloseWithAncestor, "One of the items after the provided token does not allow close with ancenstor");
            }

            Debug.Assert(_content.Count > 0);

            tokenAndRemainder.Reverse();
            foreach (var last in tokenAndRemainder)
            {
                Debug.Assert(_content.Last() == last);
                last.Close();
                _content.RemoveLast();
            }
            if (_content.IsEmpty())
            {
                updateState();
            }
            else
            {
                Debug.Assert(_content.All(cw => !cw.IsEnabled));
                _content.Last().IsEnabled = true;
            }
        }
Example #2
0
        private void t4_reopen()
        {
            _token1 = _modalControl.Open(_content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(t5_afterOpen);
        }
Example #3
0
        private void t8_after1stClosed()
        {
            Assert.AreEqual(0, _contentHolder.Children.Count);
            Assert.IsFalse(_modalControl.IsOpen);
            var content1 = GetContent("Content 1");

            _token1 = _modalControl.Open(content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(t9_afterOpen);
        }
Example #4
0
        public void TestModal()
        {
            Assert.IsTrue(_modalControl.IsTargetSet);
            Assert.IsFalse(_modalControl.IsOpen);

            var content1 = GetContent("Content 1");

            _token1 = _modalControl.Open(content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(() => t1_afterOpen(content1));
        }
Example #5
0
        public void TestModal()
        {
            Assert.IsTrue(_modalControl.IsTargetSet);
            Assert.IsFalse(_modalControl.IsOpen);

            var content1 = GetContent("Content 1");

            _token1 = _modalControl.Open(content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(() => t1_afterOpen(content1));
        }
Example #6
0
        public void Close(IModalToken openToken)
        {
            Contract.Requires(IsOpen);
            Contract.Requires(openToken != null);
            Debug.Assert(!_content.IsEmpty());
            Util.ThrowUnless(openToken == _content.Last());

            Debug.Assert(_content.Count > 0);
            var last = _content.Last();

            last.Close();
            _content.RemoveLast();
            if (_content.IsEmpty())
            {
                updateState();
            }
            else
            {
                Debug.Assert(_content.All(cw => !cw.IsEnabled));
                _content.Last().IsEnabled = true;
            }
        }
Example #7
0
        private void t8_after1stClosed()
        {
            Assert.AreEqual(0, _contentHolder.Children.Count);
            Assert.IsFalse(_modalControl.IsOpen);
            var content1 = GetContent("Content 1");
            _token1 = _modalControl.Open(content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(t9_afterOpen);
        }
Example #8
0
        private void t4_reopen()
        {
            var content1 = GetContent("Content 1");
            _token1 = _modalControl.Open(content1, ModalPosition.Center, null);

            Assert.IsTrue(_modalControl.IsOpen);

            timerDelay(t5_afterOpen);
        }
Example #9
0
        public void Close(IModalToken openToken)
        {
            Contract.Requires(IsOpen);
            Contract.Requires(openToken != null);
            Debug.Assert(!_content.IsEmpty());
            Util.ThrowUnless(openToken == _content.Last());

            Debug.Assert(_content.Count > 0);
            var last = _content.Last();
            last.Close();
            _content.RemoveLast();
            if (_content.IsEmpty())
            {
                updateState();
            }
            else
            {
                Debug.Assert(_content.All(cw => !cw.IsEnabled));
                _content.Last().IsEnabled = true;
            }
        }