private void RaiseVideoMessageHasBeenReadEvent(leaveword videoMessage) { if (VideoMessageHasBeenReadEvent != null) { VideoMessageHasBeenReadEvent(this, EventArgs.Empty); } }
public void ShowPlayVideoMessageDialog(leaveword videoMessage) { if (videoMessage == null) { return; } new DialogPlayVideoMessage(videoMessage).ShowDialog(); }
private bool FilterByReadState(object obj) { leaveword videoMsg = obj as leaveword; if (videoMsg != null) { bool readState = videoMsg.readflag.HasValue && videoMsg.readflag.Value != 0; return(ReadStateFilterValue == readState); } return(false); }
private bool FilterByBeginDate(object obj) { leaveword message = obj as leaveword; if (message != null) { DateTime dateTime; if (DateTime.TryParse(message.time, out dateTime)) { if (dateTime.Date >= BeginDateFilterValue.Value.Date) { return(true); } } } return(false); }
private void DllCallBackFunc(ref sIteDataParam param) { //bool isVideoMessage = d.lwstatus; //CallBackValue.XValue = d.msgtype; DebugLog.TraceMessage(string.Format("msgType: {0}", param.msgtype)); switch (param.msgtype) { case (int)VideoTalkOperation.emMEET_REQUEST: // received a phone call request try { string ip = param.ip; var device = this._deviceDataService.Select((d) => d.ip == ip).FirstOrDefault(); if (device != null) { // TODO: 跳出來電提示 switch (device.type) { case (int)DeviceType.Door_Camera: case (int)DeviceType.Lobby_Phone_Unit: case (int)DeviceType.Lobby_Phone_Building: case (int)DeviceType.Lobby_Phone_Area: if (Config.Instance.IsMulticastEnabled && !string.IsNullOrEmpty(device.group)) { NativeMethods.Dll_ConfigMulticastIP(new StringBuilder(device.group)); } break; } OpenCameraByDeviceType(device.type); this.RaiseReceivedIncomingCallEvent(device); } } catch (Exception) { return; } break; case (int)VideoTalkOperation.emMEET_ACCEPT: // accept a phone call this.RaiseAcceptedIncomingCallEvent(); break; case (int)VideoTalkOperation.emMEET_REFUSE: // 拒接 (還不知道什麼時機會收到這訊息) case (int)VideoTalkOperation.emMEET_STOP: try { NativeMethods.Dll_CloseCamera(); this.RaiseReceivedHangUpEvent(); } catch (Exception) { return; } break; case (int)VideoTalkOperation.emMEET_TIMEOVER: // 對方超時未接/對方裝置未開機時 this.RaiseReceivedOutgoingCallTimeoutEvent(); break; case (int)VideoTalkOperation.emPHONERECORDS_TO: try { string ip = param.ip; var device = this._deviceDataService.Select((d) => d.ip == ip).FirstOrDefault(); if (device != null) { OpenCameraByDeviceType(device.type); } } catch (Exception) { return; } break; case (int)VideoTalkOperation.emLW_REQUEST: { string targetDeviceAddress = (string)param.lParam; string sourceDeviceIP = (string)param.ip; string filePath = (string)param.wParam; leaveword videoMessage = new leaveword(); videoMessage.filenames = filePath; videoMessage.dst_addr = targetDeviceAddress; videoMessage.time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); videoMessage.readflag = 0; try { var srcDevice = this._deviceDataService.Select((d) => d.ip == sourceDeviceIP).FirstOrDefault(); if (srcDevice != null) { videoMessage.src_addr = srcDevice.roomid; this._videoMessageDataService.Insert(videoMessage); // TODO: move the job to a standalone service SendVideoMessageCountChangedNotification(targetDeviceAddress); RaiseReceivedNewVideoMessageEvent(); } else { VideoMessageDataService.DeleteVideoMessageFiles(filePath); } } catch (Exception) { } } break; case (int)VideoTalkOperation.emLW_DOWNLOAD_REQUEST: try { int videoMessageId = int.Parse(param.lParam); var videoMessage = this._videoMessageDataService.Select((msg) => msg.id == videoMessageId).FirstOrDefault(); if (videoMessage != null) { param.filepath = videoMessage.filenames; if (videoMessage.readflag != 1) { videoMessage.readflag = 1; this._videoMessageDataService.Update(videoMessage); SendVideoMessageCountChangedNotification(videoMessage.dst_addr); RaiseVideoMessageHasBeenReadEvent(videoMessage); } } } catch (Exception) { } break; } }
//VAL状态改变时处理 private void Method(object sender, ValueChangedEventArgs e) { ICMDBContext db = new ICMDBContext(); switch (e.NewValue) { case (int)VideoTalkOperation.emMEET_REQUEST: OnCall = true; string showAddr = ""; //将控件移到 Z 顺序的前面==显示控件。 this.BringToFront(); var Device = (from a in db.Devices where a.ip == IP select a).FirstOrDefault(); if (Device != null) { showAddr = DevicesAddressConverter.RoToChStr(Device.roomid); if (1 <= Device.type && Device.type <= 4) { if (Config.Instance.IsMulticastEnabled && !string.IsNullOrEmpty(Device.group)) { StringBuilder MultiIP = new StringBuilder(); MultiIP.Append(Device.group); NativeMethods.Dll_ConfigMulticastIP(MultiIP); } } if ((4 <= Device.type && Device.type <= 7) || Device.type == 2) { NativeMethods.Dll_OpenCamera(); } // Timer start CallingTimerStart(); // Timer start PicBoxSwitch("bmp4.bmp", true); labelCallingInfo.Text = "From:" + showAddr; } break; case (int)VideoTalkOperation.emMEET_ACCEPT: OnCall = true; var queryType = (from a in db.Devices where a.ip == IP select a).FirstOrDefault(); if (queryType.type >= 2 && queryType.type <= 4) { break; } NativeMethods.Dll_OpenCamera(); PicBoxSwitch("bmp2.bmp", true); TimeOutInterval = -1; PickUp = true; break; case (int)VideoTalkOperation.emMEET_STOP: if (OnCall) { PicBoxSwitch("bmp5.bmp", true); labelCallingInfo.Text = ""; NativeMethods.Dll_CloseCamera(); CurIpAddr = ""; CurAddress = ""; //将控件移到Z顺序后面 //this.SendToBack(); System.Threading.Thread.Sleep(1000); PicBoxSwitch("bmp1.bmp", true); OnCall = false; } break; case (int)VideoTalkOperation.emWATCH_REQUEST: NativeMethods.Dll_OpenCamera(); OnCall = true; OnWatch = true; PicBoxSwitch("bmp2.bmp", true); labelCallingInfo.Text = "From:" + ADDR; break; case (int)VideoTalkOperation.emWATCH_STOP: NativeMethods.Dll_CloseCamera(); break; case (int)VideoTalkOperation.emLW_REQUEST: string sIndoorAddress = lParam; leaveword lw = new leaveword { filenames = wParam, readflag = 0 }; try { var query = from a in db.Devices where a.ip == IP select a; foreach (var dev in query) { lw.src_addr = dev.roomid; } } catch { lw.src_addr = "Unknow"; } lw.dst_addr = sIndoorAddress; lw.time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //tm.ToString(); db.Leavewords.Add(lw); db.SaveChanges(); break; case (int)VideoTalkOperation.emLW_DOWNLOAD_REQUEST: // Query Video msgs file path from database int id = int.Parse(lParam); try { var query = from a in db.Leavewords where a.id == id select a; foreach (var msgs in query) { filepath = msgs.filenames; msgs.readflag = 1; } db.SaveChanges(); } catch { filepath = ""; } break; // Query Video msgs file path from database case (int)VideoTalkOperation.emPHONERECORDS_FROM: if (OnCall) { break; } CurIpAddr = IP; CurAddress = ADDR; break; case (int)VideoTalkOperation.emPHONERECORDS_TO: PicBoxSwitch("bmp3.bmp", true); // Timer start CallingTimerStart(); // Timer start break; default: break; } }
public DialogPlayVideoMessage(leaveword videoMsg) { InitializeComponent(); this._videoMsg = videoMsg; }