示例#1
0
        private void Button_SendSms_Click(object sender, RoutedEventArgs e)
        {
            ChannelFactory <IContractMessage> channelFactory =
                new ChannelFactory <IContractMessage>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8000/Service"));

            IContractMessage proxy = channelFactory.CreateChannel();

            proxy.SendMessage(tb_number.Text, tb_message.Text);
        }
示例#2
0
        public void GetCode(string number)
        {
            ChannelFactory <IContractMessage> channelFactory =
                new ChannelFactory <IContractMessage>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:8000/Service"));

            IContractMessage proxy = channelFactory.CreateChannel();

            Random rand = new Random();

            code = rand.Next(1000, 9999);

            proxy.SendMessage(number, code.ToString());
        }