Esempio n. 1
0
        private void AddNotify_Click()
        {
            if (String.IsNullOrEmpty(SqlText))
            {
                return;
            }
            List <string> arrs = new List <string>(SqlText.Split(' '));

            string sr = "";

            if (arrs.Count == 1)
            {
                sr += "private string _" + arrs[0] + ";public string " + arrs[0]
                      + "{get{return _" + arrs[0] + ";}set{_" + arrs[0] + " = value;NotifyPropertyChanged(\"" + arrs[0] + "\");}";
            }
            else if (arrs.Count == 2)
            {
                sr += "private " + arrs[0] + " _" + arrs[1] + ";public " + arrs[0] + " " + arrs[1]
                      + "{get{return _" + arrs[1] + ";}set{_" + arrs[1] + " = value;NotifyPropertyChanged(\"" + arrs[1] + "\");}";
            }
            else if (arrs.Count > 2)
            {
                sr += "private " + arrs[1] + " _" + arrs[2] + ";"
                      + arrs[0] + " " + arrs[1] + " " + arrs[2]
                      + "{get{return _" + arrs[2] + ";}set{_" + arrs[2] + " = value;NotifyPropertyChanged(\"" + arrs[2] + "\");}";
            }
            sr      = System.Text.RegularExpressions.Regex.Replace(sr, "[\r\n\t]", "");
            SqlText = "/// <summary>\r\n///\r\n/// </summary>\r\n" + Xu.Common.Common.format(sr + '}');
        }