Esempio n. 1
0
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            string GeranRedirect      = "0";
            string arfcn              = String.Empty;
            string UtranRedirect      = "0";
            string uarfcn             = String.Empty;
            string EutranRedirect     = "0";
            string earfcn             = String.Empty;
            string parentFullPathName = txtParentFullPathName.Text;
            string name           = txtSelfName.Text;
            string category       = string.Empty;
            string priority       = string.Empty;
            string RejectMethod   = string.Empty;
            string additionalFreq = txtAdditionalFreq.Text;

            //用户类型
            if ((bool)WhiteName.IsChecked)
            {
                category = "0";
                Parameters.RedirectionParam.Category = WhiteName.Content.ToString();
            }
            else if ((bool)BlackName.IsChecked)
            {
                category = "1";
                Parameters.RedirectionParam.Category = BlackName.Content.ToString();
            }
            else
            {
                category = "2";
                Parameters.RedirectionParam.Category = OtherName.Content.ToString();
            }
            //优选
            if ((bool)rbGeranRedirect.IsChecked)
            {
                priority      = "2";
                GeranRedirect = "1";
                arfcn         = txtOptimization.Text.Trim();
                Parameters.RedirectionParam.Optimization = "2G";
            }
            else if ((bool)rbUtranRedirect.IsChecked)
            {
                priority      = "3";
                UtranRedirect = "1";
                uarfcn        = txtOptimization.Text.Trim();
                Parameters.RedirectionParam.Optimization = "3G";
            }
            else if ((bool)rbEutranRedirect.IsChecked)
            {
                priority       = "4";
                EutranRedirect = "1";
                earfcn         = txtOptimization.Text.Trim();
                Parameters.RedirectionParam.Optimization = "4G";
            }
            else
            {
                priority = "0";
                Parameters.RedirectionParam.Optimization = "无";
            }
            //制式
            if (cmbRejectMethod.SelectedIndex == 0)
            {
                RejectMethod = "1";
            }
            else if (cmbRejectMethod.SelectedIndex == 1)
            {
                RejectMethod = "2";
            }
            else if (cmbRejectMethod.SelectedIndex == 2)
            {
                RejectMethod = "255";
            }
            else
            {
                RejectMethod = System.Convert.ToInt32(cmbRejectMethod.Text, 10).ToString();
            }

            Parameters.RedirectionParam.Priority       = priority;
            Parameters.RedirectionParam.RejectMethod   = cmbRejectMethod.Text;
            Parameters.RedirectionParam.Freq           = txtOptimization.Text;
            Parameters.RedirectionParam.AdditionalFreq = txtAdditionalFreq.Text;


            if (NetWorkClient.ControllerServer.Connected)
            {
                NetWorkClient.ControllerServer.Send(JsonInterFace.Set_redirection_Request(parentFullPathName, name, category, priority,
                                                                                          GeranRedirect, arfcn, UtranRedirect, uarfcn, EutranRedirect, earfcn,
                                                                                          RejectMethod, additionalFreq));
                Thread.Sleep(1000);
                this.Close();
            }
            else
            {
                Parameters.PrintfLogsExtended("向服务器请求设置重定向:", "Connected: Failed!");
            }
        }