public void Call(ulong acceptor) { if (CheckOperator()) { Console.WriteLine("Called {0} from {1}", acceptor, Number); OnCall?.Invoke(this, new MobileAccountEventArgs(acceptor)); } }
private int Calculate(int allCount, int chosenCount) { OnCall?.Invoke(allCount, chosenCount); if (allCount == chosenCount || chosenCount == 0) { return(1); } return(Calculate(allCount - 1, chosenCount) + Calculate(allCount - 1, chosenCount - 1)); }
public void Update() { if (Input.GetKeyDown(KeyCode.O)) { OnCallSound?.Invoke(); } if (Input.GetKeyDown(KeyCode.P)) { OnCall?.Invoke(1, 1f); } }
public void Call(int number) { if (Monay >= MobileOperator.CallCost) { Console.WriteLine("Call to {0}", number); OnCall?.Invoke(number, _number); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("You have not enought money to make call"); Console.ResetColor(); } }
private int Calculate(int allCount, int chosenCount) { if (chosenCount == 0 || allCount == chosenCount) { return(1); } var savedValue = _cache[allCount, chosenCount]; if (savedValue > -1) { OnCache?.Invoke(allCount, chosenCount); return(savedValue); } OnCall?.Invoke(allCount, chosenCount); return(_cache[allCount, chosenCount] = Calculate(allCount - 1, chosenCount) + Calculate(allCount - 1, chosenCount - 1)); }
public void Call(object acceptor) { if (!CheckOperator()) { return; } var phoneBookContact = acceptor as MobileAccount; foreach (var contact in phonebook) { if (contact == phoneBookContact) { Console.WriteLine("Called {0} from {1}", phoneBookContact.Name, Number); OnCall?.Invoke(this, new MobileAccountEventArgs(phoneBookContact.Number)); return; } } Console.WriteLine("contact is not in phone book"); }
public void Call(MobileAccount phoneBookContact) { if (CheckOperator()) { bool isFound = false; foreach (var contact in phonebook) { if (contact.Value == phoneBookContact) { Console.WriteLine("Called {0} from {1}", phoneBookContact.name, number); OnCall?.Invoke(this, new MobileAccountEventArgs(phoneBookContact.number)); isFound = true; } } if (!isFound) { Console.WriteLine("contact is not in phone book"); } } }
private int Calculate(int allCount, int chosenCount) { for (int i = 0; i <= allCount; i++) { for (int k = 0; k <= chosenCount && k <= i; k++) { if (k == 0) { _cache[i, k] = 1; } else { _cache[i, k] = _cache[i - 1, k] + _cache[i - 1, k - 1]; } OnCall?.Invoke(i, k); } } return(_cache[allCount, chosenCount]); }
public void Call(int number) { Console.WriteLine("Call to {0}", number); OnCall?.Invoke(number, _number); }
private void ThreadEventDispatch() { while (false == EventStop.Wait(1)) { string json = ""; bool pop_ok = EventJsonQueue.TryDequeue(out json); if (!pop_ok || json == null || json == "") { continue; } OnEventRawString?.Invoke(this, json); JObject jdata = null; EVENT_TYPE type = ParseEventType(json, out jdata); //因為必須在conference裡面中轉各個customized header,不得已只好自己維護live channel的資料... //收到CHANNEL_CREATE事件時就收錄channel資訊 //留在Conference Create時撈出來看 variable_sip_h_X-* 變數.... switch (type) { case EVENT_TYPE.CALL_TO_SWITCH: OnCall?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.SWITCH_CALL_USER: OnCall?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.ANSWER: OnAnswer?.Invoke(this, new CAnswerEvent(jdata)); break; case EVENT_TYPE.HANGUP: OnHangUp?.Invoke(this, new CHangUpEvent(jdata)); break; case EVENT_TYPE.DESTROY_CALL: OnCallDestroy?.Invoke(this, new CCallEvent(jdata)); break; case EVENT_TYPE.CONFERENCE_CREATE: OnRoomCreate?.Invoke(this, new CConferenceCreateEvent(jdata)); break; case EVENT_TYPE.CONFERENCE_DELETE: OnRoomDelete?.Invoke(this, new CConferenceDeleteEvent(jdata)); break; case EVENT_TYPE.JOIN_CONFERENCE: OnJoinRoom?.Invoke(this, new CJoinConferenceEvent(jdata)); break; case EVENT_TYPE.LEAVE_CONFERENCE: OnLeaveRoom?.Invoke(this, new CLeaveConferenceEvent(jdata)); break; case EVENT_TYPE.REGISTER: OnSipRegister?.Invoke(this, new CSipRegister(jdata)); break; default: Log.Warn($"Unsupported event type {type.ToString()}, skip it..."); break; } } //Queue沒有Clear(),只能用這種蠢方法清除 while (EventJsonQueue.Count > 0) { string msg = ""; EventJsonQueue.TryDequeue(out msg); } }
public void Coll(int targerPhoneNumber) { CurrentCallInfo = new CallInfo(PhoneNumber, targerPhoneNumber); State = PortState.Busy; OnCall?.Invoke(CurrentCallInfo); }
public virtual void Call() { OnCall?.Invoke(); }