상속: GraphItemViewModel
예제 #1
0
 private void GetColor(TokenViewModel value)
 {
     if (value.Text == "\"")
     {
         value.Color = Color.green;
         return;
     }
     if (Keywords.Contains(value.Text))
     {
         value.Color    = Color.blue;
         value.Bold     = true;
         lastWasKeyword = true;
         return;
     }
     if (lastWasKeyword && !value.Text.Any(char.IsWhiteSpace))
     {
         value.Color    = Color.grey;
         lastWasKeyword = false;
         return;
     }
     if (Literals.Contains(value.Text))
     {
         value.Color = Color.gray;
         value.Bold  = true;
     }
     value.Color = Color.black;
 }
예제 #2
0
 private LineViewModel ParseLine(string line)
 {
     var lineViewModel = new LineViewModel(this);
     var matchList = Regex.Matches(line, CSHARP_TOKENS + @"|.|\s+",RegexOptions.None);
     foreach (Match match in matchList)
     {
         var token = new TokenViewModel(lineViewModel, match.Value, Color.gray);
         GetColor(token);
         lineViewModel.Tokens.AddLast(token);
     }
     return lineViewModel;
 }
예제 #3
0
        private LineViewModel ParseLine(string line)
        {
            var lineViewModel = new LineViewModel(this);
            var matchList     = Regex.Matches(line, CSHARP_TOKENS + @"|.|\s+", RegexOptions.None);

            foreach (Match match in matchList)
            {
                var token = new TokenViewModel(lineViewModel, match.Value, Color.gray);
                GetColor(token);
                lineViewModel.Tokens.AddLast(token);
            }
            return(lineViewModel);
        }
예제 #4
0
        private void GetColor(TokenViewModel value)
        {
       
            if (value.Text == "\"")
            {
                value.Color = Color.green;
                return;
            }
            if (Keywords.Contains(value.Text))
            {
                value.Color = Color.blue;
                value.Bold = true;
                lastWasKeyword = true;
                return;
            }
            if (lastWasKeyword && !value.Text.Any(char.IsWhiteSpace))
            {
                value.Color = Color.grey;
                lastWasKeyword = false;
                return;
            }
            if (Literals.Contains(value.Text))
            {
                value.Color = Color.gray;
                value.Bold = true;

            }
            value.Color = Color.black;
        }