示例#1
0
        public void Execute_Selector_FindSingleElement()
        {
            // Arrange
            var webDriver = Substitute.For <IWebDriver>();

            // Act
            IgnoreExceptions.Run(() => _defaultCommand.Execute(webDriver));

            // Assert
            webDriver.ReceivedWithAnyArgs().FindElement(null);
        }
        protected override void OnKeyUp(string text, char key, int caret, KeyEventArgs e)
        {
            Items?.Clear();

            var word       = GetCaretWord(text, caret).ToLower();
            var snipetKeys = GetSnipetKeys(word);

            bool isCursor = e.Key == Key.Left || e.Key == Key.Right;
            bool isBlock  = ScriptIndentAnalyze(text, caret).isScriptBlock;

            if (isBlock && !isCursor)
            {
                var blocks = CsTxt.Block.BlockFactory.Parse(text);
                var usings = blocks.OfType <UsingBlock>().Select(x => x.GetNamespace()).ToArray();
                foreach (var name in DotNet.GetTypes(usings, word))
                {
                    Items?.Add(name);
                }
            }

            foreach (var snipetKey in snipetKeys)
            {
                if (!string.IsNullOrWhiteSpace(snipetKey))
                {
                    Items?.Add(snipetKey);
                }
            }

            if (e.Key == Key.Down || e.Key == Key.Up || e.Key == Key.Left || e.Key == Key.Right)
            {
                if (0 < (Items?.Count ?? 0))
                {
                    FocusCommand?.Execute(null);
                }
            }
        }
 private void DatePicker_Unfocused(object sender, FocusEventArgs e)
 {
     FocusCommand?.Execute(datePicker.IsFocused);
     Unfocused?.Invoke(this, e);
 }
 private void DatePicker_Focused(object sender, FocusEventArgs e)
 {
     _wasFocused = true;
     FocusCommand?.Execute(datePicker.IsFocused);
     Focused?.Invoke(this, e);
 }