コード例 #1
0
        public static void Send(Pager model)
        {
            if (model.To == null || string.IsNullOrWhiteSpace(model.Message)) return;

            using (model.Modifier(x => x.Message))
            {

                Message message = new Message
                {
                    CreatedTime   = DateTime.Now,
                    From          = From,
                    To            = model.To,
                    ContentAsText = model.Message
                };

                model.Message = string.Empty;
                model.History.Add(message)  ;

                m_history.Add(message);

                using (var factory = new ChannelFactory<IMessageHost>(new BasicHttpBinding(), message.To.Uri))
                {
                     factory.Open();
             					 factory.CreateChannel().Send(new Request<Message>(message));
                }

            }
        }
コード例 #2
0
        public static void SelectAddress(Pager owner, Address model)
        {
            using (owner.Modifier(x => x.History).Modifier(x=>x.To))
            {

                owner.To = model;

                 if (model == null)
                {
                    owner.History = new ObservableCollection<Message>(m_history.OrderByDescending(x => x.CreatedTime));
                    return;
                }

                owner.History = new ObservableCollection<Message>(m_history.Where(x => x.To.Name == model.Name || x.From.Name == model.Name).OrderByDescending(x=>x.CreatedTime));
            }
        }