示例#1
1
        private void SpeSay_Click(object sender, RoutedEventArgs e)
        {
            if (t1 == 0)
            {
                c = new cat(words);
                d = new dog(words);
                p = new pig(words);
            }
            string s = ani.Text;
            if (s != "")
            {
                if (s == "cat")
                {
                    SpeSay = new AnimalSaying(c.saying);
                    SpeSay(this, new myEventArgs(t1++));
                    SpeSay -= new AnimalSaying(c.saying);
                }
                else if (s == "dog")
                {
                    SpeSay = new AnimalSaying(d.saying);
                    SpeSay(this, new myEventArgs(t1++));
                    SpeSay -= new AnimalSaying(d.saying);
                }
                else if (s == "pig")
                {
                    SpeSay = new AnimalSaying(p.saying);
                    SpeSay(this, new myEventArgs(t1++));
                    SpeSay -= new AnimalSaying(p.saying);
                }
                ani.Text = "";
            }

        }
    protected void addCate_Click(object sender, EventArgs e)
    {
        if (ck.checkstringnull(tbCate.Text))
        {
            if (ck.checkstring(tbCate.Text, 50))
            {
                if(rp.checkalcate(tbCate.Text.Trim())){
ca = new cat();
                ca.cat_name = tbCate.Text.Trim();
                rp.AddCate(ca);
                loadCate();
                clearall();
                }
                else{
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('The Category Name Already Exist')", true);
                }
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('The Category Name Too Long')", true);
           
            }
        }
        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Type Category')", true);
           
        }
      
    }
示例#3
1
 static void Main(string[] args)
 {
     dog Dog = new dog();
     cat Cat = new cat();
     string A = Console.ReadLine();
     if (A == "dog")
     {
         Dog.sound();
     }
     else if (A == "cat")
     {
         Cat.sound();
     }
 }
        private void Bt1_Click(object sender, RoutedEventArgs e)
        {
            itsName = Input.Text;
            if (itsName == "cat") {

                c = new cat(words);

                //注册事件
                Say += new AnimalSaying(c.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(c.saying);//注销事件*/
            }

            else if (itsName == "dog")
            {

                d = new dog(words);

                //注册事件
                Say += new AnimalSaying(d.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(d.saying);//注销事件*/
            }

            else if (itsName == "pig")
            {

                p = new pig(words);

                //注册事件
                Say += new AnimalSaying(p.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(p.saying);//注销事件*/
            }

            Input.Text = "";
        }
 private void Button_Click_(object sender, RoutedEventArgs e)
 {
     c = new cat(words);
     d = new dog(words);
     p = new pig(words);
     if (textBox.Text  == "cat" || textBox.Text == "Cat") {
         Say += c.saying;
         Say(this, new myEventArgs(times++));
         Say -= c.saying;
     } else if (textBox.Text == "dog" || textBox.Text == "Dog")
     {
         Say += d.saying;
         Say(this, new myEventArgs(times++));
         Say -= d.saying;
     }
     else if (textBox.Text == "pig" || textBox.Text == "Pig")
     {
         Say += p.saying;
         Say(this, new myEventArgs(times++));
         Say -= p.saying;
     }
     else { }
     textBox.Text = "";
 }
示例#6
1
 private void RanSay_Click(object sender, RoutedEventArgs e)
 {
     if (t2 == 0)
     {
         c = new cat(words);
         d = new dog(words);
         p = new pig(words);
     }
     int n = rdm.Next(3);
     switch(n) 
     {
         case 0:
             RanSay = new AnimalSaying(c.saying);
             break;
         case 1:
             RanSay = new AnimalSaying(d.saying);
             break;
         case 2:
             RanSay = new AnimalSaying(p.saying);
             break;
     }
     RanSay(this, new myEventArgs(t2++));
 }
    public void UpdateCate(cat ca)
    {
        try
        {
            LQDataContext ctxx = new LQDataContext();
            var q = ctxx.cats.Where(d => d.id_cat == ca.id_cat).SingleOrDefault();
            q.cat_name = ca.cat_name;
            ctxx.SubmitChanges();
        }
        catch (Exception ex)
        {

        }
    }
    public bool AddCate(cat catss)
    {

        LQDataContext ctxs = new LQDataContext();
        ctxs.cats.InsertOnSubmit(catss);
        ctxs.SubmitChanges();
        return true;
    }
 protected void Unnamed_Command(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "ghUpdate")
     {
         for (int item = 0; item < repCate.Items.Count; item++)
         {
             Label lb = repCate.Items[item].FindControl("lblidcat") as Label;
             TextBox tb = repCate.Items[item].FindControl("txtCateName") as TextBox;
             if (lb.Text == e.CommandArgument.ToString())
             {
                 ca = rp.getCate(int.Parse(lb.Text));
                 if (ck.checkstringnull(tb.Text))
                 {
                     ca.cat_name = tb.Text;
                     rp.UpdateCate(ca);
                     loadCate();
                 }
                 else
                 {
                     ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Type Your Category')", true);
                 }
             }
         }
     }
 }
 partial void Deletecat(cat instance);
 partial void Updatecat(cat instance);
        private void Bt2_Click_1(object sender, RoutedEventArgs e)
        {
            Random ran = new Random();
            int RandKey = ran.Next(1, 4);

            if (RandKey == 1)
            {

                c = new cat(words);

                //注册事件
                Say += new AnimalSaying(c.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(c.saying);//注销事件*/
            }

            else if (RandKey == 2)
            {

                d = new dog(words);

                //注册事件
                Say += new AnimalSaying(d.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(d.saying);//注销事件*/
            }

            else if (RandKey == 3)
            {
                itsName = "pig";
                p = new pig(words);

                //注册事件
                Say += new AnimalSaying(p.saying);

                //执行事件
                Say(this, new myEventArgs(itsName));//事件中传递参数itsName

                Say -= new AnimalSaying(p.saying);//注销事件*/
            }
        }
 partial void Insertcat(cat instance);
示例#14
1
 assertTrue(cat == registry.lookup(Cat.class));
示例#15
0
 public static void Call(cat c)     //3
 {
     Console.WriteLine("cat is called");
 }
示例#16
0
 public StartingEncryption(string PassDir)//decrypt icin
 {
     rsa      = new cat(PassDir);
     userName = Environment.UserName;
 }
示例#17
0
 // Use this for inq`itialization
 void Start()
 {
     //Score.text = "100";
     d = GameObject.FindGameObjectWithTag("Black Cat").GetComponent <cat>();
 }
示例#18
0
        //format the string and print it out
        public static void log(int type, object str, int lvl, GameObject context)
        {
            //Debug.Log("Debugger settings:"+debuggerActive+", "+debugLevel+", "+importantGO+", "+debugFlags);

            str = str.ToString();

            if (!debuggerActive)
            {                   //using debugger through other than editor
                Debug.Log(type + "> " + str);
                return;
            }

            //are levels set?
            int minLvl = debugLevel;

            if (lvl > minLvl)
            {
                return;
            }

            //get object's name
            string objInfo = " ";

            if (context)
            {
                objInfo += context.transform.root.gameObject.name;
                //if context is _fog_of_war, then it's obviously fog of war
                if (objInfo == " _Fog of war")
                {
                    type = (int)cat.FOGOFWAR;
                }
            }

            //color it
            string myColor = colors[type];

            //mark it as red (if this is important object)
            if (context != null)
            {
                if (context.name == importantGO || context.transform.root.gameObject.name == importantGO)
                {
                    myColor = colors[0];
                }
            }



            //are flags on for this type?
            int layer = 1 << type;

            if ((debugFlags & layer) == 0)
            {
                return;
            }

            //create indentation depending on the debugLevel
            string tabs = "";

            for (int t = 1; t <= lvl; t++)
            {
                tabs += "\t- ";
            }

            tabs += "-{" + lvl + "} ";

            //get category name as string
            cat    typeName       = ((cat)type);
            string typeNameString = typeName.ToString();


            //format
            str = "<color=#" + myColor + ">" +
                  "[" + typeNameString + "] " +
                  tabs +
                  "<b>" + str + "</b>" +
                  "<i>\t\t\t[" + objInfo + "]</i>" +
                  "</color>";

            //print it out
            Debug.Log(str, context);
        }
示例#19
0
 assertTrue(cat == registry.lookup(Cat.class));