自動生成ユーティリティー
Example #1
0
        static string MakeGetArgs(bool useText, int[] indices, string[] texts)
        {
            var getArgs = new StringBuilder();

            if (useText)
            {
                foreach (var element in texts)
                {
                    if (0 < getArgs.Length)
                    {
                        getArgs.Append(", ");
                    }
                    getArgs.Append(GenerateUtility.ToLiteral(element));
                }
            }
            else
            {
                foreach (var element in indices)
                {
                    if (0 < getArgs.Length)
                    {
                        getArgs.Append(", ");
                    }
                    getArgs.Append(element);
                }
            }
            return(getArgs.ToString());
        }
Example #2
0
 void SelectionChanged(object sender, EventArgs e)
 {
     if (GenerateUtility.HasFocus(_control) && _control.SelectedIndex != -1)
     {
         AddSentence(new TokenName(), ".EmulateChangeSelectedIndex(" + _control.SelectedIndex, new TokenAsync(CommaType.Before), ");");
     }
 }
Example #3
0
 void Collapsed(object sender, EventArgs e)
 {
     if (!GenerateUtility.HasFocus(_control))
     {
         return;
     }
     AddSentence(new TokenName(), ".EmulateClose(", new TokenAsync(CommaType.Non), ");");
 }
 void TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_control.IsFocused)
     {
         var literal = GenerateUtility.ToLiteral(_control.Text);
         AddSentence(new TokenName(),
                     ".EmulateChangeText(",
                     literal,
                     new TokenAsync(CommaType.Before),
                     ");");
     }
 }
 void PasswordChanged(object sender, System.Windows.RoutedEventArgs e)
 {
     if (_control.IsFocused)
     {
         var literal = GenerateUtility.ToLiteral(_control.Password);
         AddSentence(new TokenName(),
                     ".EmulateChangePassword(",
                     literal,
                     new TokenAsync(CommaType.Before),
                     ");");
     }
 }
        static string MakeGetArgs(string[] texts)
        {
            StringBuilder getArgs = new StringBuilder();

            foreach (var element in texts)
            {
                if (0 < getArgs.Length)
                {
                    getArgs.Append(", ");
                }
                getArgs.Append(GenerateUtility.ToLiteral(element));
            }
            return(getArgs.ToString());
        }
        void Click(MenuItem item, string[] texts)
        {
            if (!string.IsNullOrEmpty(item.Name) || 0 < item.Items.Count)
            {
                return;
            }
            StringBuilder getArgs = new StringBuilder();

            foreach (var element in texts)
            {
                if (0 < getArgs.Length)
                {
                    getArgs.Append(", ");
                }
                getArgs.Append(GenerateUtility.ToLiteral(element));
            }

            AddSentence(new TokenName(), ".GetItem(" + getArgs.ToString() + ").EmulateClick(", new TokenAsync(CommaType.Non), ");");
        }
Example #8
0
 void TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_control.IsFocused)
     {
         var text = RichTextBoxUtility.GetText(_control);
         if (text.IndexOf(_lastText) != 0)
         {
             AddSentence(new TokenName(),
                         ".EmulateClearText(",
                         new TokenAsync(CommaType.Non),
                         ");");
         }
         AddSentence(new TokenName(),
                     ".EmulateAppendText(",
                     GenerateUtility.ToLiteral(text),
                     new TokenAsync(CommaType.Before),
                     ");");
     }
     _lastText = RichTextBoxUtility.GetText(_control);
 }
Example #9
0
        void CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            int col = -1;

            for (int i = 0; i < _control.Columns.Count; i++)
            {
                if (ReferenceEquals(_control.Columns[i], e.Column))
                {
                    col = i;
                    break;
                }
            }

            if (e.EditingElement is TextBox)
            {
                AddSentence(new TokenName(),
                            ".EmulateChangeCellText(", _control.SelectedIndex, ", ", col, ", ",
                            GenerateUtility.ToLiteral(((TextBox)e.EditingElement).Text),
                            new TokenAsync(CommaType.Before), ");");
            }
            else if (e.EditingElement is ComboBox)
            {
                AddSentence(new TokenName(),
                            ".EmulateChangeCellComboSelect(", _control.SelectedIndex, ", ", col + ", ",
                            ((ComboBox)e.EditingElement).SelectedIndex,
                            new TokenAsync(CommaType.Before), ");");
            }
            else if (e.EditingElement is CheckBox)
            {
                bool?  val    = ((CheckBox)e.EditingElement).IsChecked;
                string valStr = val.HasValue && val.Value ? "true" : "false";
                AddSentence(new TokenName(),
                            ".EmulateCellCheck(", _control.SelectedIndex, ", ", col, ", ",
                            valStr,
                            new TokenAsync(CommaType.Before), ");");
            }
        }
 public override void Optimize(List <Sentence> code)
 {
     GenerateUtility.RemoveDuplicationFunction(this, code, "EmulateChangeText");
 }