Document directory
- 1. Add reference
- 2. initialize the multimedia Manager
- 3. implement various windows for displaying OMCS Functions
- 4. Add an unmanaged dynamic library
1. Provide support for WPF
The default dynamic library provided by OMCS can be used directly in the WinForm client program. If the client is developed using WPF, You need to reference another dynamic library: OMCS. WPF. dll. OMCS. WPF. dll is a WPF control library that overrides various connector components/controls in OMCS. dll and provides APIs identical to the original components/controls.
When we add OMCS. WPF. dll to the WPF toolbox, we can see controls such as CameraConnector, desktopconne, and whiteboardconne, and drag them directly to our WPF form. If you want to use dynamic connector components, such as OMCS. WPF. microphoneConnector, OMCS. WPF. dynamicCameraConnector, OMCS. WPF. dynamicdesktopconne, etc. We can create their instances directly in the Code and call its SetViewer to set the control surface to be drawn.
In the Demo described in the OMCS demo-video, audio, whiteboard, and remote desktop functions (with source code), we developed a WinForm client to display various OMCS functions. The demo in this article adds a WPF client based on the previous demo to implement the same functions as the WinFrom client.
First, the server can directly use the previous demo without any modifications. Next, we will focus on the implementation of the WPF client of the Demo. This process is actually exactly the same as that of the WinFrom client of the previous demo.
II. Implementation of the Demo WPF client 1. Add reference
In the solution, create the WPF Application Project OMCS. demos. simplest. WPFClient, and then add reference to dynamic libraries such as OMCS: OMCS. dll, OMCS. WPF. dll, PaintFramework. dll, ESBasic. dll.
In the toolbox, add various built-in controls of OMCS. WPF. dll.
2. initialize the multimedia Manager
In the MainWindow constructor, we still directly use the static method GetSingleton of MultimediaManagerFactory to obtain a single-piece multimedia manager instance and initialize it:
// Initialize the multimedia manager this. multimediaManager = MultimediaManagerFactory. getSingleton (); this. multimediaManager. cameraDeviceIndex = 0; this. multimediaManager. microphoneDeviceIndex = 0; this. multimediaManager. p2PChannelEnabled = true; this. multimediaManager. initialize (this. userID, "", "127.0.0.1", 9900); // 192.168.0.98 // this indicates that the connection to the OMCS server is closed or reconnected successfully. multimediaManager. connectionInterrupted + = new CbGeneric (multimediaManager_ConnectionInterrupted); this. multimediaManager. connectionRebuildSucceed + = new CbGeneric (multimediaManager_ConnectionRebuildSucceed); this. label_userID.Content = string. format ("Current Logon: {0}", this. userID); this. label_state.Content = "connection status: normal ";
3. implement various windows for displaying OMCS Functions
Add ChatWindow, shorttopwindow, and WhiteBoardWindow respectively, and implement them using code similar to that of the WinFrom client.
4. Add an unmanaged dynamic library
After completing OMCS. Demos. Simplest. WPFClient compilation, copy the unmanaged dynamic library to its running directory. The unmanaged dynamic libraries to be copied include AudioEngineCore. dll, VideoEngine. dll, and VideoEngineCore. dll. In this way, the WPF-based client can run.
Iii. Download
Demo source code: OMCS.Demos.WPF.rar
After the demo in this article is implemented, the WPF client and the WinFrom client can share the same OMCS service end and connect to each other's multimedia devices.
Read more articles in the OMCS development manual.
Certificate -----------------------------------------------------------------------------------------------------------------------------------------------
Download the free version of OMCS and demo source code
For any questions about OMCS, please contact us:
Tel: 027-87638960
Q: 168757008
Mail: master@oraycn.com