Esempio n. 1
0
        private void OnIsbnRequest(IsbnMsg msg)
        {
            if (null == msg.Book || string.IsNullOrEmpty(msg.Book.ISBN))
            {
                return;
            }

            _queue.Enqueue(msg.Book);
        }
Esempio n. 2
0
        private void OnIsbnReply(IsbnMsg msg)
        {
            var book   = msg.Book;
            var target = Books.FirstOrDefault(e => e.Id == book.Id);

            if (null == target)
            {
                return;
            }

            target.Name      = book.Name;
            target.Price     = book.Price;
            target.Author    = book.Author;
            target.Publisher = book.Publisher;
            target.Pinyin    = PinyinHelper.GetFirstPYLetter(target.Name);
            Application.Current.Dispatcher.BeginInvoke((Action <Book>)Save, target);
        }