WPF腾讯视频通话开发

一、IntPtr、Handle
C#中的IntPtr类型称为“平台特定的整数类型”,它们用于本机资源,如窗口句柄。

1、WPF窗口句柄
IntPtr wnip = new System.Windows.Interop.WindowInteropHelper(this).Handle;

2、WPF控件句柄
System.Windows.Interop.HwndSource hs = (System.Windows.Interop.HwndSource)PresentationSource.FromDependencyObject(panel_local);
IntPtr fdip = hs.Handle;

WinForm Handle
IntPtr h = label1.Handle;
((Label)Control.FromHandle(h)).Text = "00";

二、导入dll
copy /Y "$(ProjectDir)SDK\liteav\*.dll" "$(ProjectDir)bin\$(ConfigurationName)"
copy /Y "$(ProjectDir)SDK\IM\*.dll" "$(ProjectDir)bin\$(ConfigurationName)"

三、加载视频
ManageLiteAV.TXLivePusher pusher = new ManageLiteAV.TXLivePusher();
pusher.startPreview(ManageLiteAV.TXEVideoCaptureSrcType.TXE_VIDEO_SRC_SDK_CAMERA, handle, 0, 0, (int)panel_local.Width, (int)panel_local.Height, ManageLiteAV.TXEVideoUserDataFormat.TXE_USER_DATA_FORMAT_UNDEFINED);
四、WPF嵌入WinForm控件
如何在WPF中引用Windows.System.Forms.Integration
解决方法如下:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\WindowsFormsIntegration.dll

参考网址:
https://blog.csdn.net/lianchangshuai/article/details/6415241
https://www.cnblogs.com/sinozhang1988/archive/2012/11/28/2792804.html

五、C# 接口(Interface)
1、接口只包含了成员(属性、方法、事件)的声明。
2、接口提供了派生类应遵循的标准结构。
3、所有接口成员的默认访问类型都是public。
4、接口使得实现接口的类或结构在形式上保持一致。

定义接口:IInterface.cs
interface IInterface
{
    void MethodToImplement();
}

定义派生类:InterfaceImplementer.cs
class InterfaceImplementer : IMyInterface
{
    //实现接口成员
    public void MethodToImplement()
    {
    }
}
接口注意的几点:
    接口方法不能用public abstract等修饰。接口内不能有字段变量,构造函数。
    接口内可以定义属性(有get和set的方法)。如string color { get ; set ; }这种。
    实现接口时,必须和接口的格式一致。
    必须实现接口的所有方法。

猜你喜欢

转载自www.cnblogs.com/sntetwt/p/9217505.html
今日推荐