Exemplo n.º 1
0
        //语音信箱转移
        private void MailForward_Click(object sender, RoutedEventArgs e)
        {
            if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null)
            {
                Dialog.Show(StringHelper.FindLanguageResource("NoUCAccount"), StringHelper.FindLanguageResource("SettingUC"));
                return;
            }
            try
            {
                MakeCallBusiness call = new MakeCallBusiness();
                STCallExData     data = new STCallExData();
                int iRet = 0;

                string buttonName = (sender as System.Windows.Controls.Button).Name;

                if (buttonName == "btnVoiceForwardUnCond")
                {
                    //无条件转语音邮箱
                    if ((bool)this.radVoiceForwardUnCondEn.IsChecked)
                    {
                        //data.Num = this.txtVoiceForwardUnCond.Text.Trim();
                        data.Num = "1";
                        if (string.IsNullOrEmpty(data.Num))
                        {
                            Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error"));
                            string str = System.Windows.Forms.Application.StartupPath;
                            lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_2.png");
                            return;
                        }
                        else
                        {
                            iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data);
                            if (iRet == 0)
                            {
                                string str = System.Windows.Forms.Application.StartupPath;
                                lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_3.png");
                                //2015/8/11  一旦设置了无条件前转,则其他前转全部设置为关闭
                                data.Num = string.Empty;
                                call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data);
                                call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data);
                                call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data);
                            }
                        }
                    }
                    else
                    {
                        data.Num = string.Empty;
                        iRet    += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data);
                        if (iRet == 0)
                        {
                            string str = System.Windows.Forms.Application.StartupPath;
                            lync.toolBar.BtnMail.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\sms_2.png");
                        }
                    }
                }
                else if (buttonName == "btnVoiceForwardNoReply")
                {
                    //无应答转语音邮箱
                    this.lync.toolBar.GetMailFrwInfo();
                    if (lync.toolBar.isSetVoiceMailUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radVoiceForwardNoReplyEn.IsChecked)
                        {
                            //data.Num = this.txtVoiceForwardNoReply.Text.Trim();
                            data.Num = "1";
                            if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_NOREPLY, data);
                        }
                    }
                }
                else if (buttonName == "btnVoiceForwardBusy")
                {
                    //遇忙转语音邮箱
                    this.lync.toolBar.GetMailFrwInfo();
                    if (lync.toolBar.isSetVoiceMailUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radVoiceForwardBusyEn.IsChecked)
                        {
                            //data.Num = this.txtVoiceForwardBusy.Text.Trim();
                            data.Num = "1";
                            if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_ONBUSY, data);
                        }
                    }
                }
                else if (buttonName == "btnVoiceForwardOffline")
                {
                    //离线转语音邮箱
                    this.lync.toolBar.GetMailFrwInfo();
                    if (lync.toolBar.isSetVoiceMailUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radVoiceForwardOfflineEn.IsChecked)
                        {
                            //data.Num = this.txtVoiceForwardOffline.Text.Trim();
                            data.Num = "1";
                            if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_OFFLINE, data);
                        }
                    }
                }
                else if (buttonName == "btnVoiceForwardDND")  //DND不做了  2015/8/11
                {
                    //离线呼叫前转
                    if ((bool)this.radVoiceForwardDNDEn.IsChecked)
                    {
                        //data.Num = this.txtVoiceForwardDND.Text.Trim();
                        data.Num = "1";
                        if (string.IsNullOrEmpty(data.Num))
                        {
                            Dialog.Show(StringHelper.FindLanguageResource("MailNumberNullError"), StringHelper.FindLanguageResource("error"));
                            return;
                        }
                        else
                        {
                            iRet += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data);
                        }
                    }
                    else
                    {
                        data.Num = string.Empty;
                        iRet    += call.SetCallExService((int)ForwardServiceType.VOICEMAIL_UNCONDITION, data);
                    }
                }

                if (iRet != (int)UCServiceRetvCode.UC_SDK_Success)
                {
                    LogManager.SystemLog.Error("SetCallExService error");
                    //modify by jinyeqing
                    Dialog.Show(StringHelper.FindLanguageResource("FWDMailFail"), StringHelper.FindLanguageResource("error"));
                }
                else
                {
                    Dialog.Show(StringHelper.FindLanguageResource("FWDMailSuccess"), StringHelper.FindLanguageResource("Success"));
                }
            }
            catch (System.Exception ex)
            {
                LogManager.SystemLog.Error(ex.ToString());
            }
        }
Exemplo n.º 2
0
        private void ApplyCommandProcess()
        {
            try
            {
                UCUserInfo user = new UCUserInfo();
                user.Camera                = winOptionSetting.comCamera.SelectedIndex.ToString();
                user.Lang                  = winOptionSetting.comLang.SelectedIndex.ToString();
                user.MicPhone              = winOptionSetting.comMicrophone.SelectedIndex.ToString();
                user.Password              = winOptionSetting.txtPassword.Password.ToString();
                user.Port                  = winOptionSetting.txtPort.Text.ToString();
                user.Server                = winOptionSetting.txtServer1.Text.ToString();
                user.Speaker               = winOptionSetting.comSpeaker.SelectedIndex.ToString();
                user.UserID                = winOptionSetting.txtAccount.Text.ToString();
                user.AutoStart             = winOptionSetting.chkStart.IsChecked == true ? "1" : "0";
                user.Available             = (bool)winOptionSetting.chkAvailable.IsChecked;
                user.Unavailable           = (bool)winOptionSetting.chkUnavailable.IsChecked;
                user.Busy                  = (bool)winOptionSetting.chkBusy.IsChecked;
                user.Voicemail             = (bool)winOptionSetting.chkVoicemail.IsChecked;
                user.AvailableCallNumber   = winOptionSetting.txtAvailable.Text;
                user.UnavailableCallNumber = winOptionSetting.txtUnavailable.Text;
                user.BusyCallNumber        = winOptionSetting.txtBusy.Text;
                user.VoicemailCallNumber   = winOptionSetting.txtVoicemail.Text;
                user.SetFWDService         = FrmToolBar.isSetFWDUnCond ? "1" : "0";

                XmlHelper.SetUserConfig(user);

                UserConfigBusiness conf = new UserConfigBusiness();
                conf.SetCurrentMicDev(winOptionSetting.comMicrophone.SelectedIndex);
                conf.SetCurrentVideoDev(winOptionSetting.comCamera.SelectedIndex);
                conf.SetCurrentSpeakerDev(winOptionSetting.comSpeaker.SelectedIndex);

                //modify by jinyeqing 2015/6/1   登陆时某些值为空要设置提示 (要求提示语言国际化)
                if (winOptionSetting.txtPort.Text.ToString() == "" || winOptionSetting.txtPort.Text.ToString() == null)
                {
                    Dialog.Show(StringHelper.FindLanguageResource("Portcannotbenull"), StringHelper.FindLanguageResource("error"));
                    return;
                }
                if (winOptionSetting.txtPassword.Password.ToString() == "" || winOptionSetting.txtPassword.Password.ToString() == null)
                {
                    Dialog.Show(StringHelper.FindLanguageResource("Passwordcannotbenull"), StringHelper.FindLanguageResource("error"));
                    return;
                }
                if (winOptionSetting.txtAccount.Text.ToString() == "" || winOptionSetting.txtAccount.Text.ToString() == null)
                {
                    Dialog.Show(StringHelper.FindLanguageResource("UserIDcannotbenull"), StringHelper.FindLanguageResource("error"));
                    return;
                }
                if (winOptionSetting.txtServer1.Text.ToString() == "" || winOptionSetting.txtServer1.Text.ToString() == null)
                {
                    Dialog.Show(StringHelper.FindLanguageResource("Servercannotbenull"), StringHelper.FindLanguageResource("error"));
                    return;
                }
                if (winOptionSetting.comLang.SelectedIndex.ToString() == "" || winOptionSetting.comLang.SelectedIndex.ToString() == null)
                {
                    Dialog.Show(StringHelper.FindLanguageResource("Languagecannotbenull"), StringHelper.FindLanguageResource("error"));
                    return;
                }
                // end modify

                if (winOptionSetting.chkStart.IsChecked == true)
                {
                    RegistryKey runKey = Registry.LocalMachine.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
                    runKey.SetValue("LyncWpfApp.exe", System.Windows.Forms.Application.StartupPath + "\\LyncWpfApp.exe");
                    //如果Lync插件自启动,那么就算Lync设置了自启动也不能让它运行   modify by 00327190   2015/8/6
                    RegistryKey runKey1 = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    if (null != runKey1 && null != runKey1.GetValue("LyncWpfApp.exe"))
                    {
                        RegistryKey runKey2 = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                        if (null != runKey2 && null != runKey2.GetValue("Lync"))
                        {
                            runKey2.DeleteValue("Lync");
                        }
                    }
                }
                else
                {
                    RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    runKey.DeleteValue("LyncWpfApp.exe");
                }
            }
            catch
            {
                LogManager.SystemLog.Info("DeleteSubKey");
            }
        }
Exemplo n.º 3
0
        private void CallForward_Click(object sender, RoutedEventArgs e)
        {
            if (SingletonObj.LoginInfo == null || SingletonObj.LoginInfo.UserID == null)
            {
                Dialog.Show(StringHelper.FindLanguageResource("NoUCAccount"), StringHelper.FindLanguageResource("SettingUC"));
                return;
            }
            try
            {
                MakeCallBusiness call = new MakeCallBusiness();
                STCallExData     data = new STCallExData();
                int iRet = 0;

                string buttonName = (sender as System.Windows.Controls.Button).Name;
                if (buttonName == "btnCallForwardUnCond")
                {
                    //无条件呼叫前传
                    if ((bool)this.radCallForwardUnCondEn.IsChecked)
                    {
                        data.Num = this.txtCallForwardUnCond.Text.Trim();
                        if (IsValidPhoneNumber(data.Num) == false)
                        {
                            DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2);
                            return;
                        }
                        else if (string.IsNullOrEmpty(data.Num))
                        {
                            Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"));
                            string str = System.Windows.Forms.Application.StartupPath;
                            lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_2.png");
                            return;
                        }
                        else
                        {
                            iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data);
                            if (iRet == 0)
                            {
                                string str = System.Windows.Forms.Application.StartupPath;
                                lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_3.png");
                                //2015/8/11  一旦设置了无条件前转,则其他前转全部设置为关闭
                                data.Num = string.Empty;
                                call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data);
                                call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data);
                                call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data);
                            }
                        }
                    }
                    else
                    {
                        data.Num = string.Empty;
                        iRet    += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data);
                        if (iRet == 0)
                        {
                            string str = System.Windows.Forms.Application.StartupPath;
                            lync.toolBar.BtnFWD.Image = System.Drawing.Image.FromFile(str.Substring(0, str.IndexOf("bin")) + "\\Image\\MobilePhone_2.png");
                        }
                    }
                }
                else if (buttonName == "btnCallForwardNoReply")
                {
                    //不回复呼叫前转
                    this.lync.toolBar.GetFWDInfo();
                    if (lync.toolBar.isSetFWDUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radCallForwardNoReplyEn.IsChecked)
                        {
                            data.Num = this.txtCallForwardNoReply.Text.Trim();
                            if (IsValidPhoneNumber(data.Num) == false)
                            {
                                DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2);
                                return;
                            }
                            else if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.FORWARD_NOREPLY, data);
                        }
                    }
                }
                else if (buttonName == "btnCallForwardBusy")
                {
                    //遇忙呼叫前转
                    this.lync.toolBar.GetFWDInfo();
                    if (lync.toolBar.isSetFWDUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radCallForwardBusyEn.IsChecked)
                        {
                            data.Num = this.txtCallForwardBusy.Text.Trim();
                            if (IsValidPhoneNumber(data.Num) == false)
                            {
                                DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2);
                                return;
                            }
                            else if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.FORWARD_ONBUSY, data);
                        }
                    }
                }
                else if (buttonName == "btnCallForwardOffline")
                {
                    //离线呼叫前转
                    this.lync.toolBar.GetFWDInfo();
                    if (lync.toolBar.isSetFWDUnCond1 == true)  //如果设置了无条件前转,则不能设置其他前转
                    {
                        Dialog.Show(StringHelper.FindLanguageResource("Cannottransfer"), StringHelper.FindLanguageResource("error"));
                        return;
                    }
                    else
                    {
                        if ((bool)this.radCallForwardOfflineEn.IsChecked)
                        {
                            data.Num = this.txtCallForwardOffline.Text.Trim();
                            if (IsValidPhoneNumber(data.Num) == false)
                            {
                                DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2);
                                return;
                            }
                            else if (string.IsNullOrEmpty(data.Num))
                            {
                                Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"));
                                return;
                            }
                            else
                            {
                                iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data);
                            }
                        }
                        else
                        {
                            data.Num = string.Empty;
                            iRet    += call.SetCallExService((int)ForwardServiceType.FORWARD_OFFLINE, data);
                        }
                    }
                }
                else if (buttonName == "btnCallForwardDND")   //DND取消了  2015/8/11
                {
                    //离线呼叫前转
                    if ((bool)this.radCallForwardDNDEn.IsChecked)
                    {
                        data.Num = this.txtCallForwardDND.Text.Trim();
                        if (IsValidPhoneNumber(data.Num) == false)
                        {
                            DialogShow.Show(StringHelper.FindLanguageResource("Invalidnum"), StringHelper.FindLanguageResource("error"), 2);
                            return;
                        }
                        else if (string.IsNullOrEmpty(data.Num))
                        {
                            Dialog.Show(StringHelper.FindLanguageResource("PhoneNumberNullError"), StringHelper.FindLanguageResource("error"));
                            return;
                        }
                        else
                        {
                            iRet += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data);
                        }
                    }
                    else
                    {
                        data.Num = string.Empty;
                        iRet    += call.SetCallExService((int)ForwardServiceType.FORWARD_UNCONDITION, data);
                    }
                }

                if (iRet != (int)UCServiceRetvCode.UC_SDK_Success)
                {
                    LogManager.SystemLog.Error("SetCallExService error");
                    Dialog.Show(StringHelper.FindLanguageResource("FWDFailed"), StringHelper.FindLanguageResource("error"));
                }
                else
                {
                    Dialog.Show(StringHelper.FindLanguageResource("FWDSuccess"), StringHelper.FindLanguageResource("Success"));
                }
            }
            catch (System.Exception ex)
            {
                LogManager.SystemLog.Error(ex.ToString());
            }
        }