Ejemplo n.º 1
0
        private void tbSpeakerVolume_ValueChanged(object sender, EventArgs e)
        {
            var volume = tbSpeakerVolume.Value;

            try
            {
                MFWCore.SetSpeakerVolume(volume);
                if (0 == volume)
                {
                    MFWCore.MuteSpeaker(true);
                    this.btnSpeaker.Image = Properties.Resources.speaker_mute;
                }
                else
                {
                    MFWCore.MuteSpeaker(false);
                    this.btnSpeaker.Image = Properties.Resources.speaker;
                }
            }
            catch (Exception ex)
            {
                if (MessageBox.Show(this, ex.Message, "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
                {
                    volume = MFWCore.GetSpeakerVolume();
                    this.tbSpeakerVolume.Value = volume;
                }
            }
        }
Ejemplo n.º 2
0
 private void btnCamera_Click(object sender, EventArgs e)
 {
     if (true == MuteCamera)
     {
         try
         {
             MFWCore.StartCamera();
             MuteCamera = false;
         }
         catch (Exception ex)
         {
             UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             MFWCore.StopCamera();
             MuteCamera = true;
         }
         catch (Exception ex)
         {
             UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error);
         }
     }
 }
Ejemplo n.º 3
0
        private void tbMicVolume_ValueChanged(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var volume = tbMicVolume.Value;

            try
            {
                MFWCore.SetMicVolume(volume);
                if (0 == volume)
                {
                    MFWCore.MuteMic(true);
                    this.btnMic.Image = Properties.Resources.mic_mute;
                }
                else
                {
                    MFWCore.MuteMic(false);
                    this.btnMic.Image = Properties.Resources.mic;
                }
            }
            catch (Exception ex)
            {
                Action okAction = () =>
                {
                    volume = MFWCore.GetMicVolume();
                    this.tbMicVolume.Value = volume;
                };
                UXMessageMask.ShowMessage(ownerPnl, false, ex.Message, MessageBoxButtonsType.OK, MessageBoxIcon.Error
                                          , okAction);
            }
        }
Ejemplo n.º 4
0
        private void SignalPanel_Load(object sender, EventArgs e)
        {
            grdMediaStatistics.AutoGenerateColumns = false;

            MFWCore.GetMediaStatistics(BindSignals);

            this.txtCallRate.Text = "SIP";
            this.txtCallRate.Text = propertyManager.GetProperty(PropertyKey.PLCM_MFW_KVLIST_KEY_CallSettings_NetworkCallRate);
        }
Ejemplo n.º 5
0
        private long OnLogin(IntPtr es, IntPtr param)
        {
            var userName = JsValue.Arg(es, 0).ToString(es);
            var pwd      = JsValue.Arg(es, 1).ToString(es);

            UserName = userName;
            userName = "******";
            pwd      = "123456789";
            try
            {
                MFWCore.Register(SipServer, userName, pwd, vpxWindow.pnlContainer);
                return(JsValue.UndefinedValue());
            }
            catch (Exception ex)
            {
                return(JsValue.ThrowException(es, "注册终端失败,ex:" + ex.Message));
            }
        }
Ejemplo n.º 6
0
        private void btnShare_Click(object sender, EventArgs e)
        {
            if (null == _currentCall)
            {
                return;
            }
            var contentSelectWin = new ContentSelectPanel()
            {
                Monitors = deviceManager.GetDevicesByType(DeviceType.MONITOR),
                Apps     = deviceManager.GetDevicesByType(DeviceType.APPLICATIONS),
                OKAction = (type, format, monitor, app) => {
                    try
                    {
                        switch (type)
                        {
                        case "Monitor":
                        {
                            MFWCore.StartShareContent(monitor, app);
                        }
                        break;

                        case "BFCP":
                        {
                            var width  = Screen.PrimaryScreen.Bounds.Width;
                            var height = Screen.PrimaryScreen.Bounds.Height;
                            MFWCore.SetContentBuffer(format, width, height);
                            MFWCore.StartBFCPContent();
                        }
                        break;
                        }
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(this, ex.Message, "消息框", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return(false);
                    }
                },
                OnCancel = () => { }
            };

            UXMessageMask.ShowForm(ownerPnl, contentSelectWin);
        }
Ejemplo n.º 7
0
        private void MainWindow_Load(object sender, EventArgs e)
        {
            webView.SetCspCheckEnable(false);
            webView.CookieEnabled = true;
            webView.NavigationToNewWindowEnable = false;

            webView.OnTitleChange += new EventHandler <TitleChangeEventArgs>(OnWebViewTitleChange);
            //webView.OnURLChange += new EventHandler<UrlChangeEventArgs>(OnWebViewURLChange);
            //webView.OnLoadingFinish += new EventHandler<LoadingFinishEventArgs>(OnWebViewLoadingFinish);
            //webView.OnLoadUrlBegin += new EventHandler<LoadUrlBeginEventArgs>(OnWebViewLoadUrlBegin);
            //webView.OnDocumentReady += new EventHandler<DocumentReadyEventArgs>(OnWebViewDocumentReady);
            //webView.OnDownload += new EventHandler<DownloadEventArgs>(OnWebViewDownload);

            #region BindFunction
            JsValue.BindFunction("OnLogin", new wkeJsNativeFunction(OnLogin), 2);
            JsValue.BindFunction("OnLogout", new wkeJsNativeFunction(OnLogout), 0);
            JsValue.BindGetter("ServerUri", new wkeJsNativeFunction(GetServerUri));
            JsValue.BindGetter("Token", new wkeJsNativeFunction(GetToken));
            JsValue.BindSetter("Token", new wkeJsNativeFunction(SetToken));
            JsValue.BindFunction("Dial", new wkeJsNativeFunction(OnDial), 3);
            #endregion

            //var devToolPath ="file:///" + (Application.StartupPath + @"\front_end\inspector.html").Replace("\\","/");
            var devToolPath = "file:///D:/test/miniblinknet/Demo/bin/Debug/front_end/inspector.html";
            //webView.SetDebugConfig("showDevTools", devToolPath);
            //webView.ShowDevtools(devToolPath, null, IntPtr.Zero);
            //webView.LoadFile(@"Assets\pages\login.html");
            webView.LoadFile(@"Assets\pages\login.html");

            vpxWindow = new VPXWindow();
            toolbar   = new MFWToolBar();
            toolbar.BindPanel(vpxWindow.pnlContainer);
            MFWCore.MFWEvent += MFWEventHandle;

            deviceManager.PropertyChanged += OnPropertyChangedEventHandler;

            var userName = "******";
            var pwd      = "123456789";
            MFWCore.Register(SipServer, userName, pwd, vpxWindow.pnlContainer);
        }
Ejemplo n.º 8
0
        private long OnDial(IntPtr es, IntPtr param)
        {
            var caller   = JsValue.Arg(es, 0).ToString(es);
            var isVideo  = JsValue.Arg(es, 1).ToBoolean(es);
            var dispName = JsValue.Arg(es, 2).ToString(es);

            if (string.IsNullOrWhiteSpace(dispName))
            {
                dispName = UserName;
            }
            try
            {
                MFWCore.SetProperty(PropertyKey.PLCM_MFW_KVLIST_KEY_DisplayName, dispName);
                MFWCore.Dial(caller, isVideo ? CallMode.AUDIOVIDEO_CALL : CallMode.AUDIO_CALL);
                vpxWindow.Show();
                vpxWindow.BringToFront();
                vpxWindow.Focus();
                return(JsValue.UndefinedValue());
            }
            catch (Exception ex)
            {
                return(JsValue.ThrowException(es, "呼叫失败,ex:" + ex.Message));
            }
        }
Ejemplo n.º 9
0
        public void onWFWEventHandle(Event evt)
        {
            this.Invoke(new Action(() => {
                switch (evt.EventType)
                {
                case EventType.SIP_REGISTER_SUCCESS:
                    {
                        MFWCore.Dial("2164334", CallMode.AUDIOVIDEO_CALL);
                    }
                    break;

                case EventType.SIP_REGISTER_FAILURE:
                    {
                        throw new Exception("Failure");
                    } break;

                case EventType.SIP_REGISTER_UNREGISTERED:
                    {
                        throw new Exception("SIP_REGISTER_UNREGISTERED");
                    }
                    break;
                }
            }));
        }
Ejemplo n.º 10
0
 private void menuItemCP_Click(object sender, EventArgs e)
 {
     MFWCore.SetLayout(LayoutType.ContinuousPresence);
 }
Ejemplo n.º 11
0
 private void menuItemVAS_Click(object sender, EventArgs e)
 {
     MFWCore.SetLayout(LayoutType.VAS);
 }
Ejemplo n.º 12
0
 private void menuItemP_Click(object sender, EventArgs e)
 {
     MFWCore.SetLayout(LayoutType.Presentation);
 }
Ejemplo n.º 13
0
        private void bindDeviceStatus()
        {
            #region Device Init
            if (null != deviceManager.CurrentAudioInputDevice)
            {
                this.btnMic.Enabled = true;
                this.btnMic.Image   = Properties.Resources.mic;
                var volume = MFWCore.GetMicVolume();
                this.tbMicVolume.Value      = volume;
                this.tbMicVolume.LostFocus += (obj, args) => { this.tbMicVolume.Hide(); };
            }
            else
            {
                this.btnMic.Enabled    = false;
                this.btnMic.Image      = Properties.Resources.mic_mute;
                this.tbMicVolume.Value = 0;
            }
            if (null != deviceManager.CurrentAudioOutputDevice)
            {
                this.btnSpeaker.Enabled = true;
                this.btnSpeaker.Image   = Properties.Resources.speaker;
                var volume = MFWCore.GetSpeakerVolume();
                this.tbSpeakerVolume.Value      = volume;
                this.tbSpeakerVolume.LostFocus += (obj, args) => { this.tbSpeakerVolume.Hide(); };
            }
            else
            {
                this.btnSpeaker.Enabled    = false;
                this.btnSpeaker.Image      = Properties.Resources.speaker_mute;
                this.tbSpeakerVolume.Value = 0;
            }
            if (null != deviceManager.CurrentVideoInputDevice && null != callManager.CurrentCall)
            {
                this.btnCamera.Enabled = true;
                switch (callManager.CurrentCall.CallMode)
                {
                case CallMode.AUDIOVIDEO_CALL:
                {
                    this.btnCamera.Image = Properties.Resources.camera;
                    if (callManager.CurrentCall.IsContentSupported)
                    {
                        this.btnShare.Enabled = true;
                        this.btnShare.Image   = Properties.Resources.share;
                    }
                    else
                    {
                        this.btnShare.Enabled = false;
                        this.btnShare.Image   = Properties.Resources.share_mute;
                    }
                }
                break;

                case CallMode.AUDIO_CALL:
                {
                    this.btnCamera.Image  = Properties.Resources.camera_mute;
                    this.btnShare.Enabled = false;
                    this.btnShare.Image   = Properties.Resources.share_mute;
                }
                break;
                }
            }
            else
            {
                this.btnCamera.Enabled = false;
                this.btnCamera.Image   = Properties.Resources.camera_mute;
                this.btnShare.Enabled  = false;
                this.btnShare.Image    = Properties.Resources.share_mute;
            }
            #endregion
        }
Ejemplo n.º 14
0
 private void MainWindow_FormClosed(object sender, FormClosedEventArgs e)
 {
     MFWCore.Unregister();
     vpxWindow.Dispose();
     webView.Dispose();
 }
Ejemplo n.º 15
0
 private long OnLogout(IntPtr es, IntPtr param)
 {
     MFWCore.Unregister();
     return(JsValue.UndefinedValue());
 }
Ejemplo n.º 16
0
 private void MFWWindow_Load(object sender, EventArgs e)
 {
     MFWCore.Register("58.218.201.171", "polycomtest4@ch", "123456789", this.mfwContainer);
 }