public MakingCallViewModel() : base() { socket = SocketAPI.GetInstance().GetSocket(); currentRoom = new RoomModel(); callingModel = CallingModel.GetInstace(); HangupCommand = new DelegateCommand(Hangup); HandleSocket(); }
private void HandleSocket() { socket.On("end_call", () => { Application.Current.Dispatcher.Invoke(delegate { Exit(); CallingModel.GetInstace().State = CallingState.FREE; }); }); }
public CallingViewModel() { socket = SocketAPI.GetInstance().GetSocket(); currentRoom = new RoomModel(); callingModel = CallingModel.GetInstace(currentRoom); RoomChangeCommand = new DelegateCommand <RoomModel>(OnRoomChange); LoadCommand = new DelegateCommand(OnLoad); ShowVoiceCallCommand = new DelegateCommand(ShowVoiceCall); HandleSocket(); }
private void Exit() { CallingModel.GetInstace().State = CallingState.FREE; foreach (Window window in Application.Current.Windows) { if (window.Title == "ReceiveCallWindow") { window.Close(); } } }
private void AcceptCall() { Application.Current.Dispatcher.Invoke(delegate { // emit to server accept call var data = new JObject(); data.Add("room_id", currentRoom.ID); data.Add("user", JObject.FromObject(UserInfo.GetInstance())); socket.Emit("accept_call", data); CallingModel.GetInstace().State = CallingState.BUSY; navigate.Invoke("OnGoingCallViewModel", new object[] { currentRoom }); }); }
public OnGoingCallViewModel(Action <object, object[]> navigate, params object[] parameters) : this() { this.navigate = navigate; currentRoom = (RoomModel)parameters[0]; callingModel = CallingModel.GetInstace(currentRoom); }