private void btnShowVideoWin_Click(object sender, RoutedEventArgs e) { DialogResult = true; VideoInWindow dialog = new VideoInWindow(_channel.CallId); dialog.Owner = App.Current.MainWindow; dialog.ShowDialog(); return; sua_vid_win_info info = new sua_vid_win_info(); App.SIPUA.GetVidWindowInfo(_channel.CallId, ref info); if (info.show == 1) { App.SIPUA.ShowVideoWindow(_channel.CallId, false); } else { App.SIPUA.ShowVideoWindow(_channel.CallId, true); MainWindow main = App.Current.MainWindow as MainWindow; if (main != null) { int top = ((int)main.Top) + ((int)main.Height) / 2 - info.height / 2; int left = ((int)main.Left) + ((int)main.Width) / 2 - info.width / 2; HwndSource source = (HwndSource)HwndSource.FromVisual(main); IntPtr hWnd = source.Handle; //App.SIPUA.SetVideoWindowPos(_channel.CallId, hWnd, left, top); } } }
private void ResizeVidWindow() { sua_vid_win_info info = new sua_vid_win_info(); App.SIPUA.GetVidWindowInfo(_callId, ref info); Point locationFromWindow = vidPosBorder.TranslatePoint(new Point(0, 0), this); Point screenPt = vidPosBorder.PointToScreen(locationFromWindow); int parentTop = (int)screenPt.Y; int parentLeft = (int)screenPt.X; int left = (int)(parentLeft + (vidPosBorder.ActualWidth - info.width) / 2); int top = (int)(parentTop + (vidPosBorder.ActualHeight - info.height) / 2); App.SIPUA.SetVideoWindowPos(_callId, parentLeft - 8, parentTop - 8, (int)(vidPosBorder.ActualWidth - 2), (int)(vidPosBorder.ActualHeight - 2)); }
public bool GetVidWindowInfo(int callId, ref sua_vid_win_info info) { int wid = GetCallVideoWinId(callId); if (wid == -1) { return(false); } int status = PJSIPInterop.sua_vid_win_get_info(wid, ref info); if (status != PJSIPInterop.OK) { return(false); } return(true); }
public bool SetVideoWindowPos(int callId, int x, int y, int width, int height) { int wid = GetCallVideoWinId(callId); if (wid == -1) { return(false); } sua_vid_win_info info = new sua_vid_win_info(); int status = PJSIPInterop.sua_vid_win_get_info(wid, ref info); if (status != PJSIPInterop.OK) { return(false); } //PJSIPInterop.sua_vid_win_set_pos(wid, x, y); SetWindowPos((IntPtr)info.hwnd, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, x, y, width, height, (int)(0x40)); return(true); }
public bool ShowVideoWindow(int callId, bool show) { int wid = GetCallVideoWinId(callId); if (wid == -1) { return(false); } sua_vid_win_info info = new sua_vid_win_info(); PJSIPInterop.sua_vid_win_get_info(wid, ref info); if (info.show == 1 && show == false) { PJSIPInterop.sua_vid_win_set_show(wid, 0); } else if (info.show == 0 && show == true) { PJSIPInterop.sua_vid_win_set_show(wid, 1); } return(true); }