Friday, September 24, 2010

C # event mechanism of induction (B)


Connected to one: C # event mechanism for induction (I)

3. C # in the pre-defined event handling

Learning event, I think the most difficult to understand is that C # in the predefined event, so I began to study events at a loss. In search of more information, finally got a number of, as follows:

EventArgs that contains event data of the type of the base class for the transfer of the incident.

EventHandler is a delegate declared as follows (in. Net class library in the following statement)

public delegate void EventHandler (object sender, EventArgs e)

Therefore, all of the form:

Lou void letter name (object parameter name, EventArgs parameter name); the function can be used as the Click event to respond to Control class methods. Defined as an event the following response method:

private void button1_Click (object sender, System.EventArgs e)

Parameter object sender object that triggered the event, (in fact there is a reference to the object passed, if the sender button1's click event is button1) System.EventArgs e on behalf of the corresponding event information, such as the mouse's x, y values and so on.

Now we look to see which events Button class declaration to Click Event.

public event EventHandler Click;

Here defines a type of event EventHandler Click

private void button1_Click (object sender, System.EventArgs e)
(
...
)

This is what we and the corresponding method button1_click events. Note that the parameters meet the commission in the method signature (parameters both list). Then how do we put this method and events linked to it, see the following code.
this.button1.Click + = new System.EventHandler (this.button1_Click); (actually button1.Click System.EventHandler delegate to an instance of the event. and appoint the commission assigned to a particular instance of the method is very similar)
The this.button1_Click method bound to this.button1.Click event.

4. The use of the parameters of the incident.

using System;

class Class1

(
static void Main ()
(
Student s1 = new Student ();

s1.Name = "Student1";

Student s2 = new Student ();

s2.Name = "Student2";

s1.RegisterOK + = new Student.DelegateRegisterOkEvent (Student_RegisterOK);

s2.RegisterOK + = new Student.DelegateRegisterOkEvent (Student_RegisterOK);

/ / When the Register method of an execution, the event triggered RegisterOK

/ / RegisterOK event of a trigger, then perform Student_RegisterOK method

s1.Register ();

s2.Register ();

Console.ReadLine ();
)
static void Student_RegisterOK (RegisterOkArgs e)
(
Console.WriteLine (e.EventInfo);
)
)
class Student

(

public delegate void DelegateRegisterOkEvent (RegisterOkArgs e);

public event DelegateRegisterOkEvent RegisterOK;

public string Name;

public void Register ()

(
Console.WriteLine ("Register Method");
RegisterOK (new RegisterOkArgs ("Student Name:" + Name));
)
)

class RegisterOkArgs: EventArgs

(
public string EventInfo;

public RegisterOkArgs (string eventInfo): base ()
(
this.EventInfo = eventInfo;
)
)






Recommended links:



C # in the DELEGATE and event



WMV To QT



Dealers Sustained Growth Quartet



"China Computer Business 500" award, awarded the two winning BenQ chase THE deer



Simple Flash Tools



COMMENT Launchers And Task Managers



SCO UNIX Learning Collection



MPEG To 3GPP



Simple Business



Compilation of the stack of parameters passed and amended



Programming books from the ENTER_FRAME ActionScript3 Speaking



Deep Antivirus Guide (1)



AVI to MOV



Png files



IP And MAC Binding Of Crack



Charles Zhang said Sohu Sogou do NOT intend to use the input method earnings



Tuesday, September 14, 2010

I am a third category


Across from the city to go in, I do not know how many people's dream to become a neon blink of an eye? However, I believe, is not easy to stop as long as the vision of reality will eventually surrender ... ...

One time chatting with a friend, accidentally mention that they have resigned. A friend on the phone over there immediately fixing authorities merely to ask, are you mad? You have done in the unit and hard about the treatment is also very good, where to find such a good job?

I do not have to explain to him more, do not expect to be supported ... ... Anyway, this is their thing.

Graduated from university, I found a job, to live a leisurely life. However, the novelty is over, I can not find a job in the fun and passion, can not find worthy of nostalgia for development. It only makes me feel tired. Is life too short sometimes only two days, one day is born, the day of death, which obscure the long trip, just to prove the existence of time. I was young, life should be like the surging of the magma!

Remember that time at the dinner table, I tell my colleagues that have nothing to do with their land in the unit cost of life, such as to sweep the street does not sweep too clean, people looked comfortable, she also did some practical things; staff immediately scoffed, Xie Nizhao eyes looking at me: "Then you go to sweep the street, ah, that would be so glorious, and thus earn less than we!" I quickly put that glass, Oh said, a bite to drink! Colleagues in this unit for three years, unwittingly used to and dependent on the state of this life, all day to look forward to the day of paychecks.

In my eyes, and her job is simply divided into such human categories: the first group is the canary, value treatment, as long as there is delicious good living, the loss of what he can endure; the second category are Collie, value outsiders (my colleagues and leaders, especially the latter) the degree of attention to him, as long as attention, he would remain faithful; The third category is the wild, not farmed for quiet, he likes the thrill of the wind-Benz, like the way in distance vision, like some kind of Road unknown sense of accomplishment. Of course, does not rule out the fourth category of people, can the first three features are combined, but that very few people. I considered the third category of people, right?

Is really drunk, why with the canary of wild horses live? Hot wine importers, but their hearts are sad and dreary. I fear that I stay, will be drained away Mustang's long mane, running hard hooves, become weak and numb.

Then just another thing happened: colleagues outside the department, suddenly quit well-paid work, went to a very poor rural Guangxi, with one of his German friends, stay there when the primary obligation of teachers. I heard there is very backward, very remote, and even cell phone signals are not, the Internet to 15 kilometers away! Unit was talking about, we think that's incredible. I understand why he did not understand, because we have been accustomed to content with life, the ideal has gradually faded. I have also become increasingly clear that they need to fear. Treatment unit does well, the leadership also has high regard, but not what I want the most. Dissipated when the passion, I can only resolutely choose to vote with their feet - than to leave.

After the resignation of a long period of time (in fact, not long, and today the whole month), I did not find suitable work, every day loitering. Living with my friend and asked: to regret, right? I did not regret it, you let me go back now, I do not want, hate cautiously, and apathy of the day.

The worst situation in life is often not poverty, nor is it bad luck, but the spirit and mind in a state of asleep. When everything moved over you can not move you, when attracted you can not appeal to you all, and even anger all over your anger you can not, then you need to start again to find another place to inspire your passion place.

U.S. "Happiness" magazine, in "for the answer column" in the subject, published through this one: If you re-select, what do you do? A military dignitaries want to go to the countryside to open a grocery store; a woman minister is going to run a small seaside hotel; a mayor's desire is diverted when the photographer. Several businessmen answer the most bizarre: a woman want to be enchanting, one would like to become a dog. During the general population are also answers to the President wants to do, want to diplomats, wants baker, and everything ... ... more than good, regardless of the abilities of the ideal, ideals, that is, happy people.

Across from the city to go in, I do not know how many people's dream to become a neon blink of an eye? However, they do not stop looking forward, I believe that reality will eventually surrender to the dream ... ...






Recommended links:



Firewall And Proxy Servers evaluation



Convert Mod To Mpg



Mts Converter



TV Shopping Busy To Make A Fuss In The Credibility Of The



Three anti-monopoly law enforcement DEPARTMENTS, year introduced several new deal soon



Jinshan Jinshan Nu Pi typing through repeated fake "Li Gui," poisonous pit Users



PRD employment "upward", "Labor Shortage" moved to the Mainland



TD commercial trial on April 1 the minimum consumption of 118 yuan a complete experience



BLACKBERRY format



Articles about Text Or Document Editors



Do not heat to high speed fully Raiders SUMMER Thunder



Convert m4a to wma



How to avoid the Trap of price competition?



For Kaspersky and Rising court



For you Audio Presentation Tools



Guide Audio Rippers And Converters