static void Main(string[] args)
        {
            mydelegate delegem = new mydelegate(Topla);

            delegem += Carp;
            delegem.Invoke(2, 3);
        }
        public delegate void mydelegate(string a);//delegate creation

        static void Main(string[] args)
        {
            mydelegate obj1 = new mydelegate(Display);// creating instance a delegate(or create object of delegate)

            obj1("Hello");
            Console.Read();
        }
Exemple #3
0
 public RcaRow(DataRow dr, mydelegate my)
 {
     RepRcaID = Convert.ToInt32(dr["RepRcaID"]);
     try
     {
         sNr = new String('.', Convert.ToInt32(dr["RcaDepth"]) - 1) + dr["RcaOrdinal"].ToString();
     }
     catch
     {
         sNr = dr["RcaOrdinal"].ToString();
     }
     sLevel      = dr["fRcaSection"].ToString();
     sCauseRCA   = dr["RcaCaption"].ToString();
     LCID_RCA    = dr["LCID_RCA"].ToString();
     sCauseRCA_L = dr["RcaCaptionL"].ToString();
     sCauseRC    = dr["mCauseText"].ToString(); /* I-1410-7725 */
     if (String.IsNullOrWhiteSpace(sCauseRC))
     {
         sCauseRC = dr["sCauseText"].ToString();
     }
     LCID_RC    = dr["LCID_RC"].ToString();
     sCauseRC_L = dr["mCauseTextL"].ToString(); /* [dlatikay 20160421] had been looking for a "CauseTextL", which never existed */
     if (String.IsNullOrWhiteSpace(sCauseRC_L))
     {
         sCauseRC_L = dr["sCauseTextL"].ToString();
     }
     sVerified = dr["fVerified"].ToString();
     sMeasures = dr["fMeasures"].ToString();
 }
    void test()
    {
        //mydelegate myde = null;
        //if (myde != null)
        //    myde ( "xuosng" );

        mydelegate myde = new mydelegate(func);

        Debug.Log(myde.ToString());
        mydelegate myde2     = new mydelegate(func2);
        mydelegate anonymous = delegate(string name)
        {
            Debug.Log("excellent" + name);
        };
        mydelegate all;

        all = myde + myde2 + anonymous;
        all("xusong");

        //mydelegate2 lambda = i => i+20;

        //Debug.Log ( lambda(2) );

        //Debug.Log ( 123 .ToString()[0] );
        //Debug.Log (Vector3.Dot(Vector3.zero, Vector3.forward));
        //Debug.Log ( Vector3.Project ( new Vector3 ( 12, 12 ), Vector3.zero ) );//vector3.zero
        //Debug.Log ( Vector3.Project (new Vector3(12,12),Vector3.down) );
    }
        static void Main(string[] args)
        {
            string str = "hi hello india is great";
            int    i   = CountWords(str);

            Console.WriteLine(" no.of words=" + (i));
            mydelegate md = CountWords;
            int        j  = md(str);

            Console.WriteLine("print no.of words using delegates {0}", j);


            mydelegate md1 = delegate(string str1)
            {
                string[] arr = str1.Split(' ');
                return(arr.Length);
            };
            int k = md1(str);

            Console.WriteLine("print no.of words using anonimous {0}", k);


            mydelegate md2 = (str1) =>
            {
                string[] arr = str1.Split(' ');
                return(arr.Length);
            };
            int l = md2(str);

            Console.WriteLine("print no.of words using lambda expression {0}", l);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            var p = new Person();

            WriteLine((int)FavouriteCar.QiYa);
            WriteLine((int)FavouriteCar.Bmw);
            WriteLine((int)FavouriteCar.Benz);
            WriteLine((int)FavouriteCar.FeryyLi);


            p.CarList = FavouriteCar.Benz | FavouriteCar.FeryyLi;
            // p.CarList = (FavouriteCar)16;
            WriteLine($"p.CarList={p.CarList}");
            WriteLine(p.Children[0].Name);
            WriteLine(p[1].Name);

            var d       = new mydelegate(Mymultiply);
            var answer  = d.Invoke(3);
            var answer2 = d(4);

            WriteLine($"{answer},{answer2}");

            //事件
            p.Shout += P_Shout;
            p.Poke();
            p.Poke();
            p.Poke();
            p.Poke(); p.Poke();
            Read();
        }
Exemple #7
0
        /// <summary>
        /// 建構式
        /// </summary>
        public 傷害特效()
        {
            _SuperMan_Point = new Point(-50, 180);
            特效 = new Bitmap(Properties.Resources.特效, new Size(80, 80));

            特效光影          = new Timer();
            特效光影.Enabled  = true;
            特效光影.Tick    += new EventHandler(淡化效果_Tick);
            特效光影.Interval = 10;



            autoGif_A = new Other_AutoGif(new Bitmap[] {
                MyResource.Get標1("1"), MyResource.Get標1("2"), MyResource.Get標1("3"),
                MyResource.Get標1("4"), MyResource.Get標1("5"), MyResource.Get標1("6"),
                MyResource.Get標1("7"), MyResource.Get標1("8"), MyResource.Get標1("9"),
                MyResource.Get標1("10"), MyResource.Get標1("11"), MyResource.Get標1("12")
            },
                                          new Size(40, 40));
            autoGif_B = new Other_AutoGif(new Bitmap[] {
                MyResource.Get標2("1"), MyResource.Get標2("2"), MyResource.Get標2("3"),
                MyResource.Get標2("4"), MyResource.Get標2("5"), MyResource.Get標2("6"),
                MyResource.Get標2("7"), MyResource.Get標2("8"), MyResource.Get標2("9"),
                MyResource.Get標2("10"), MyResource.Get標2("11"), MyResource.Get標2("12")
            },
                                          new Size(60, 60));


            Delegate_飛鏢 = new mydelegate(autoGif_A.NextBitmap);
        }
Exemple #8
0
        /// <summary>
        /// In the main method instantiating a delegate and invoking delegate
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            mydelegate obj = new mydelegate(Display);

            obj("Hi");
            Console.ReadLine();
        }
Exemple #9
0
        private void AddResult(string txt)
        {
            newstring = txt;
            mydelegate inst = new mydelegate(WriteResult);

            this.Invoke(inst);
        }
Exemple #10
0
    public static void Main(string[] args)
    {
        mydelegate objd = new mydelegate(display);

        usemethod(objd);
        Console.WriteLine();
    }
Exemple #11
0
 public MeaRow(DataRow dr, mydelegate my)
 {
     MeaID          = Convert.ToInt32(dr["MeaID"]);
     sNr            = dr["NrComposite"].ToString();
     sDate          = dr["fEntryTime"].ToString();
     sOrgAbbrev     = dr["OrgAbbrev"].ToString();
     sOrgShortcap   = dr["OrgShortCap"].ToString();
     sOrgLongcap    = dr["OrgLongCap"].ToString();
     LCID_Org       = dr["LCID_Org"].ToString();
     sOrgShortcap_L = dr["OrgShortCapL"].ToString();
     sOrgLongcap_L  = dr["OrgLongCapL"].ToString();
     sCaption       = dr["Caption"].ToString();
     sMeasure       = dr["sMeasure"].ToString();
     if (dr["mMeasure"].Equals(DBNull.Value) == false)
     {
         sMeasure = dr["mMeasure"].ToString();                                               /* added [dlatikay 20130301] MEA-2013-00056 */
     }
     LCID_Measure = dr["LCID_Measure"].ToString();
     sCaption_L   = dr["CaptionL"].ToString();
     sMeasure_L   = dr["sMeasureL"].ToString();
     if (dr["mMeasureL"].Equals(DBNull.Value) == false)
     {
         sMeasure_L = dr["mMeasureL"].ToString();                                                /* added [dlatikay 20130301] MEA-2013-00056 */
     }
     sResponsible = dr["fResponsible"].ToString();
     sPrio        = dr["fPrio"].ToString();
     sDue         = dr["fDue"].ToString();
 }
Exemple #12
0
 public FinRow(DataRow dr, mydelegate my)
 {
     FinID          = Convert.ToInt32(dr["FinID"]);
     sNr            = dr["NrComposite"].ToString();
     sDate          = dr["fEntryTime"].ToString();
     sOrgAbbrev     = dr["OrgAbbrev"].ToString();
     sOrgShortcap   = dr["OrgShortCap"].ToString();
     sOrgLongcap    = dr["OrgLongCap"].ToString();
     LCID_Org       = dr["LCID_Org"].ToString();
     sOrgShortcap_L = dr["OrgShortCapL"].ToString();
     sOrgLongcap_L  = dr["OrgLongCapL"].ToString();
     sCatAbbrev     = dr["CatAbbrev"].ToString();
     sCatCap        = dr["CatCaption"].ToString();
     LCID_Cat       = dr["LCID_Category"].ToString();
     sCatAbbrev_L   = dr["CatAbbrevL"].ToString();
     sCatCap_L      = dr["CatCaptionL"].ToString();
     sCaption       = dr["Caption"].ToString();
     sFinding       = dr["sFinding"].ToString();
     if (dr["mFinding"].Equals(DBNull.Value) == false)
     {
         sFinding = dr["mFinding"].ToString();                                               /* added [dlatikay 20130301] MEA-2013-00056 */
     }
     LCID_Fin   = dr["LCID_Finding"].ToString();
     sCaption_L = dr["CaptionL"].ToString();
     sFinding_L = dr["sFindingL"].ToString();
 }
Exemple #13
0
        delegate void mydelegate(string a); //creation of delegate.actually we r use acces modifier also but this is single class

        static void Main(string[] args)
        {
            mydelegate obj1 = new mydelegate(Display); //object creation and read target value(which value u required)

            obj1("hello");                             //object name and passing values. invoking
            Console.Read();
        }
        delegate void mydelegate(string a); //creating delegate

        static void Main(string[] args)
        {
            mydelegate obj1 = new mydelegate(Dispaly); // create obj to delegate

            obj1("Hello");                             // invoking the delegate
            Console.Read();
        }
        static void Main(string[] args)
        {
            DelegateClass2 obj1 = new DelegateClass2();         // first create the object of function bcz we r using outside of class thats why
            mydelegate     obj2 = new mydelegate(obj1.Display); // then creating object of delegate

            obj2("Hello Bizruntime");                           // providing value
            Console.Read();
        }
        static void Main(string[] args)
        {
            mydelegate  obj1 = new mydelegate(Display);
            ClsDelegate obj  = new ClsDelegate();

            obj1("Hello");
            Console.Read();
        }
Exemple #17
0
        private void AddNewTaskTab()
        {
            TabHeaderText = "Task to Action";

            mydelegate inst = new mydelegate(DrawTaskURLTab);

            this.Invoke(inst);
        }
Exemple #18
0
        static void Main(string[] args)
        {
            mydelegate  obj1 = new mydelegate(Display);
            mydelegate1 obj2 = new mydelegate1(Display);

            obj1("swathi");
            obj2(10, 40);
            Console.Read();
        }
Exemple #19
0
        private void AddNewViewFlowTab(string headertext, int procinst)
        {
            TabHeaderText = headertext;
            TabProcInst   = procinst;

            mydelegate inst = new mydelegate(DrawViewFlowURLTab);

            this.Invoke(inst);
        }
 public void runUpdateText()
 {
     mydelegate md = new mydelegate(updateText);
     while (progress<100)
     {
         Thread.Sleep(1000);
         this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, md);
     }
 }
Exemple #21
0
        public string asyncRun()
        {
            AsyncCallback mycb = new AsyncCallback(ExeCmds);
            mydelegate    md   = new mydelegate(getResult);
            IAsyncResult  ar   = md.BeginInvoke(mycb, null);

            ar.AsyncWaitHandle.WaitOne();
            return(md.EndInvoke(ar));
        }
Exemple #22
0
        static void Main(string[] args)
        {
            rectangle  rect     = new rectangle();
            mydelegate rectdale = new mydelegate(rect.area);

            rectdale += rectdale + new mydelegate(rect.perimeter);
            rectdale.Invoke(6.0, 4.5);
            Console.WriteLine();
            rectdale.Invoke(15.3, 11.4);
        }
Exemple #23
0
    // Use this for initialization
    void Start()
    {
        MyDelegateSub mds = new MyDelegateSub();

        mds.show(111);
        mydelegate md = new mydelegate(mds.show);

        md(222);
        md += new mydelegate(mds.showshow);
        md(333);
    }
        /// <summary>
        /// Main method instantiating and invoking delegate
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            ClsDelegateDemo2 obj  = new ClsDelegateDemo2();
            mydelegate       obj1 = new mydelegate(obj.Add);

            obj1 += obj.Sub;
            obj1 += obj.Mul;
            obj1 += obj.Div;
            obj1(20, 6);
            Console.ReadLine();
        }
    public void delegatetest()
    {
        System.Action <int> f = print;
        funky myfunky;

        myfunky.a = null;
        myfunky.b = f;
        mydelegate a = myfunky.a;

        a(5);
    }
Exemple #26
0
        static void Main(string[] args)
        {
            //Reigistramos y usamos el string
            mydelegate <string> delString = new mydelegate <string>(HandlerString);

            delString("Hello world !!");

            mydelegate <double> delDouble = new mydelegate <double>(HanderDouble);

            delDouble(21.43);
        }
Exemple #27
0
 public void SetExecuteMethod(mydelegate method, DataTable dt)
 {
     this.eventMethod += method;
     if (t != null && t.IsAlive)
     {
         t.Abort(); MessageBox.Show("error");
     }
     t = new Thread(new ParameterizedThreadStart(delegateEventMethod));
     t.IsBackground = true;
     t.Start(dt);
 }
        public void runMyThreadMain()
        {
            mydelegate myd = new mydelegate(ThreadMain);
            for (; progress < 100;++progress )
            {
                Thread.Sleep(1000); //simulate some time-consuming work
                this.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Input, myd);
            }

            //The calling thread cannot access this object because a different thread owns it.
            //mytext.Text += "The work is done~\n";
        }
 public DutRow(DataRow dr, mydelegate my)
 {
     DutyID = Convert.ToInt32(dr["DutyID"]);
     if (!dr["CatID"].Equals(DBNull.Value))
     {
         CatID = Convert.ToInt32(dr["CatID"]);
     }
     Caption         = dr["Caption"].ToString();
     IntervalCap     = dr["fIntervalCap"].ToString();
     OccurrenceNext0 = dr["fOccurrenceNext"].ToString();
     ToleranceLate   = dr["fToleranceLate"].ToString();
 }
Exemple #30
0
 // Start is called before the first frame update
 void Start()
 {
     _dead       = false;
     IsGrounded  = false;
     rigbody     = GetComponent <Rigidbody2D>();
     sprite_rend = GetComponent <SpriteRenderer>();
     anim        = GetComponent <Animator>();
     tempanim    = anim.runtimeAnimatorController;
     Mydelegate  = changesprite;
     box         = GetComponent <BoxCollider2D>();
     scorecount  = 0;
     running     = false;
 }
Exemple #31
0
        static void Main(string[] args)
        {
            rectangle  rect     = new rectangle();
            mydelegate rectdele = new mydelegate(rect.area);

            // alternative
            // mydelegate rectdele = rect.area;
            rectdele += new mydelegate(rect.perimeter);

            rectdele.Invoke(6.0, 4.5);
            Console.WriteLine();
            rectdele.Invoke(15.3, 4.5);
        }
Exemple #32
0
        static void Main(string[] args)
        {
            rectangle  rect      = new rectangle();
            mydelegate Rectangle = new mydelegate(rect.area);

            //Alternative
            //mydelegate Rectangle = rect.area;
            Rectangle += new mydelegate(rect.perimeter);
            //Alternative
            //Rectangle += rect.perimeter;
            Rectangle.Invoke(6.3, 4.5);
            Console.WriteLine();
            Rectangle.Invoke(15.5, 11.6);
        }
 private void AddResult(string txt)
 {
     newstring = txt;
     mydelegate inst = new mydelegate(WriteResult);
     this.Invoke(inst);
 }
        private void AddNewViewFlowTab(string headertext, int procinst)
        {
            TabHeaderText = headertext;
            TabProcInst = procinst;

            mydelegate inst = new mydelegate(DrawViewFlowURLTab);
            this.Invoke(inst);
        }
        private void AddNewTaskTab()
        {
            TabHeaderText = "Task to Action";

            mydelegate inst = new mydelegate(DrawTaskURLTab);
            this.Invoke(inst);
        }