Exemple #1
0
        //确定按钮
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(ModleName.Text))
            {
                MessageBox.Show("请输入模型名字!");
                return;
            }

            if (string.IsNullOrEmpty(ModleContent.Text))
            {
                MessageBox.Show("请输入模型描述内容!");
                return;
            }

            if (ModleName.Text.Trim().Length > 400)
            {
                MessageBox.Show("输入模型名字字数太长,请重新输入!");
                return;
            }

            if (ModleName.Text.Trim().Length > 3000)
            {
                MessageBox.Show("模型描述内容字数太长,请重新输入!");
                return;
            }


            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);

            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize          = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息
            mc.InsertModelAsync(UserID, PlayType, ModleName.Text.Trim(), strContent, ModleContent.Text.Trim(), TypeName);
            mc.InsertModelCompleted += new EventHandler <InsertModelCompletedEventArgs>(mc_InsertModelCompleted);

            this.DialogResult = true;
        }
        //确定按钮
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(ModleName.Text))
            {
                MessageBox.Show("请输入模型名字!");
                return;
            }

            if (string.IsNullOrEmpty(ModleContent.Text))
            {
                MessageBox.Show("请输入模型描述内容!");
                return;
            }

            if (ModleName.Text.Trim().Length > 400)
            {
                MessageBox.Show("输入模型名字字数太长,请重新输入!");
                return;
            }

            if (ModleName.Text.Trim().Length > 3000)
            {
                MessageBox.Show("模型描述内容字数太长,请重新输入!");
                return;
            }


            BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.MaxBufferSize = int.MaxValue;
            ModelClient mc = new ModelClient(binding, new EndpointAddress(new Uri(Application.Current.Host.Source, "../Silverlight/Model.svc")));

            //通过id获取详细信息
            mc.InsertModelAsync(UserID, PlayType, ModleName.Text.Trim(), strContent, ModleContent.Text.Trim(), TypeName);
            mc.InsertModelCompleted += new EventHandler<InsertModelCompletedEventArgs>(mc_InsertModelCompleted);

            this.DialogResult = true;
        }