Exemplo n.º 1
0
        public MEventDef Create(EventDef newEvent)
        {
            if (FindAny(newEvent) != null)
            {
                throw new ApplicationException("Can't add an event when it's already been added");
            }

            var eventDef = new MEventDef(newEvent, this, events.Count);

            Add(eventDef);
            TypeDef.Events.Add(newEvent);
            return(eventDef);
        }
Exemplo n.º 2
0
 public void Add(MEventDef e)
 {
     events.Add(e);
 }
Exemplo n.º 3
0
		public EventInfo Event(MEventDef evt) {
			return memberInfos.Event(evt);
		}
Exemplo n.º 4
0
		void CreateEvent(MEventDef eventDef, MMethodDef methodDef, EventMethodType methodType, string overridePrefix) {
			if (!methodDef.Owner.HasModule)
				return;

			var newEventName = overridePrefix + eventDef.EventDef.Name;
			switch (methodType) {
			case EventMethodType.Adder:
				CreateEventAdder(newEventName, methodDef);
				break;
			case EventMethodType.Remover:
				CreateEventRemover(newEventName, methodDef);
				break;
			}
		}
Exemplo n.º 5
0
		public EventInfo(MEventDef eventDef)
			: base(eventDef) {
		}
Exemplo n.º 6
0
		void PrepareRenameEvent(MEventDef eventDef) {
			if (eventDef.IsVirtual())
				throw new ApplicationException("Can't rename virtual events here");
			var eventInfo = Event(eventDef);
			if (eventInfo.renamed)
				return;

			string eventName = eventInfo.oldName;
			if (!NameChecker.IsValidEventName(eventName))
				eventName = eventInfo.suggestedName;
			if (!NameChecker.IsValidEventName(eventName))
				eventName = variableNameState.GetNewEventName(eventDef.EventDef);
			variableNameState.AddEventName(eventName);
			eventInfo.Rename(eventName);

			RenameSpecialMethod(eventDef.AddMethod, "add_" + eventName);
			RenameSpecialMethod(eventDef.RemoveMethod, "remove_" + eventName);
			RenameSpecialMethod(eventDef.RaiseMethod, "raise_" + eventName);
		}
Exemplo n.º 7
0
		public EventInfo Event(MEventDef evt) {
			return allEventInfos[evt];
		}
Exemplo n.º 8
0
		public void Add(MEventDef evt) {
			allEventInfos[evt] = new EventInfo(evt);
		}
Exemplo n.º 9
0
		public bool TryGetEvent(MEventDef e, out EventInfo info) {
			return allEventInfos.TryGetValue(e, out info);
		}
Exemplo n.º 10
0
 public void add(MEventDef e)
 {
     events.add(e);
 }
Exemplo n.º 11
0
		public MEventDef Create(EventDef newEvent) {
			if (FindAny(newEvent) != null)
				throw new ApplicationException("Can't add an event when it's already been added");

			var eventDef = new MEventDef(newEvent, this, events.Count);
			Add(eventDef);
			TypeDef.Events.Add(newEvent);
			return eventDef;
		}
Exemplo n.º 12
0
		public void Add(MEventDef e) {
			events.Add(e);
		}
Exemplo n.º 13
0
 public void add(MEventDef e)
 {
     events.add(e);
 }