Ejemplo n.º 1
0
        void client_GetAciquirer_MessagesCompleted(object sender, GetAciquirer_MessagesCompletedEventArgs e)
        {
            ObservableCollection <AcquirerMessageModel> list = new ObservableCollection <AcquirerMessageModel>();

            foreach (Message message in e.Result)
            {
                //AcquirerMessageModel model = new AcquirerMessageModel();
                //UserTable user = db.Users.Single(c => c.Id == message.FromId);
                //model.FromName = user.UserName;
                //model.Time = message.Time;
                //if (message.IsSee)
                //{
                //    model.ImageUri = "/Image_Recycle/Message/m_open.png";
                //}
                //else
                //{
                //    model.ImageUri = "/Image_Recycle/Message/m_closed.png";
                //}
                //model.Message = message.MessageContent;
                //list.Add(model);
                MSMToAcqurer table = new MSMToAcqurer()
                {
                    FromId  = message.FromId,
                    Message = message.MessageContent,
                    Time    = message.Time,
                    IsSee   = message.IsSee,
                };
                db.MSMToAcqurers.InsertOnSubmit(table);
            }
            db.SubmitChanges();
            foreach (MSMToAcqurer message in db.MSMToAcqurers)
            {
                AcquirerMessageModel model = new AcquirerMessageModel();
                UserTable            user  = db.Users.Single(c => c.Id == message.FromId);
                model.FromName = user.UserName;
                model.Time     = message.Time;
                if (message.IsSee)
                {
                    model.ImageUri = "/Image_Recycle/Message/m_open.png";
                }
                else
                {
                    model.ImageUri = "/Image_Recycle/Message/m_closed.png";
                }
                model.Message = message.Message;
                model.Id      = message.Id;
                model.IsSee   = message.IsSee;
                list.Add(model);
            }
            List_Message = list;
            callback3();
        }
        private void StackPanel_Tap(object sender, GestureEventArgs e)
        {
            StackPanel sp1         = sender as StackPanel;
            StackPanel sp          = (sender as StackPanel).Parent as StackPanel;
            StackPanel tbk_message = sp.Children[1] as StackPanel;

            if (tbk_message.Visibility == Visibility.Collapsed)
            {
                tbk_message.Visibility = Visibility.Visible;
                Image image = (Image)sp1.Children[0];
                image.Source = new BitmapImage(new Uri("/Image_Recycle/Message/m_open.png", UriKind.Relative));
                AcquirerMessageModel model = sp.DataContext as AcquirerMessageModel;
                db.MSMToAcqurers.Single(c => c.Id == model.Id).IsSee = true;
                db.SubmitChanges();
            }
            else
            {
                tbk_message.Visibility = Visibility.Collapsed;
            }
        }