Inheritance: System.Web.UI.Page
示例#1
0
 private MessageList GetCurrentUserReadingMessage(UserItem item)
 {
     MessageList mList = new MessageList();
     MessageOperator mo = new MessageOperator();
     mList = mo.GetNoReadMessage4ToUserId(item.Id);
     return mList;
 }
        public ActionResult ListMessages()
        {
            using (var db = new MessageDBContext())
            {
                var records = new MessageList<MessageDBModel>();
                records.Content = db.Messages.OrderBy(x => x.time).ToList();

                return PartialView("ListMessages", records.Content);
            }
        }
示例#3
0
        public void ePrematureEOF_Logged()
        {
          var src = @"";

          var msgs = new MessageList();

          var lxr = new LL(new StringSource(src), msgs);
          lxr.AnalyzeAll();

          Assert.IsNotNull(msgs.FirstOrDefault(m => m.Type == MessageType.Error && m.Code == (int)LaconfigMsgCode.ePrematureEOF));
        }
示例#4
0
        public void ePrematureEOF_CouldLogButThrown()
        {
          var src = @"";

          var msgs = new MessageList();

          var lxr = new JL(new StringSource(src), msgs, throwErrors: true);
          lxr.AnalyzeAll();

          Assert.IsNotNull(msgs.FirstOrDefault(m => m.Type == MessageType.Error && m.Code == (int)JSONMsgCode.ePrematureEOF));
        }
示例#5
0
 public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
 {
     var values = new MessageList();
     int i = 0;
     var valueProviderResult = bindingContext.ValueProvider.GetValue("value" + i);
     while (valueProviderResult!=null)
     {
         i++;
         values.Add(valueProviderResult.AttemptedValue);
         valueProviderResult = bindingContext.ValueProvider.GetValue("value" + i);
     }
     return values;
 }
示例#6
0
    /// <summary>
    /// 组装显示消息内容的HTML字符串 并更新未读消息为已读消息
    /// </summary>
    /// <param name="msgId">需要显示消息的ID</param>
    private void MakeMsgShow(int msgId)
    {
        MessageOperator mo = new MessageOperator();
        MessageItem item = mo.GetMessage(msgId);
        UsersOperator uo=new UsersOperator();
        UserItem fromUser = uo.LoadUser(item.FromUserId);
        UserItem toUser=uo.LoadUser(item.ToUserId);

        this.hidOtherId.Value = fromUser.Id.ToString();
        this.hidOtherName.Value = fromUser.NickName;

        string title = string.Format("时间:{2}— {0}对{1}说:",fromUser.NickName,
                                                    toUser.NickName,item.MessageTime.ToString());

        string msg ="<br/>"+ item.Message;
        this.txtChatPrivateList.InnerText += title;
        this.txtChatPrivateList.InnerHtml += msg;
        MessageList list = new MessageList();
        list.Add(item);
        mo.UpdateMsg2Readed(list);
    }
示例#7
0
 public static void PopulateConversationsList(ObservableCollection<ConversationListItem> conversationListItems)
 {
     unreadMessagesExist = false;
     HashSet<string> seenPeers = new HashSet<string>();
     conversationListItems.Clear();
     if (messages == null)
     {
         messages = new MessageList();
     }
     for (int i = 0; i < CommonData.messages.Length; i++)
     {
         Message message = CommonData.messages[i];
         unreadMessagesExist = unreadMessagesExist || (!message.IsRead);
         string peer;
         if (message.Sender == session.Username) peer = message.Receiver;
         else peer = message.Sender;
         if (seenPeers.Contains(peer)) continue;
         seenPeers.Add(peer);
         conversationListItems.Add(new ConversationListItem(message));
     }
 }
示例#8
0
 public bool Undo(MessageList messages)
 {
     return Undo(messages);
 }
示例#9
0
 public void Create(MessageList messages)
 {
     MessageCache.Create(messages);
 }
 public LJSUnitTranspilationContext(string unitName, IAnalysisContext context = null, MessageList messages = null, bool throwErrors = false)
     : base(context, messages, throwErrors)
 {
     m_UnitName = unitName.IsNullOrWhiteSpace() ? CoreConsts.UNKNOWN : unitName;
 }
示例#11
0
 protected CommonCodeProcessor(IAnalysisContext context, MessageList messages = null, bool throwErrors = false)
 {
       m_Context = context;
       m_Messages = messages ?? (context!=null? context.Messages : null);
       m_ThrowErrors = throwErrors;
 }
示例#12
0
 public override ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
 {
     throw new NotImplementedException(GetType().Name+".MakeLexer()");
 }
示例#13
0
 public LaconfigLexer(ISourceText source, MessageList messages = null, bool throwErrors = false) :
     base(source, messages, throwErrors)
 {
     m_FSM = new FSM(this);
 }
示例#14
0
 protected Transpiler(IAnalysisContext context, TParser parser, MessageList messages = null, bool throwErrors = false)
     : base(context, messages, throwErrors)
 {
     m_Parser = parser;
 }
        void RefreshMessages()
        {
            _container = new EntityModelContainer();
            user       = _container.AdministratorSet.Find(user.UserCode);

            if (NewPatientsMessage.Checked && DeviceMessages.Checked)
            {
                if (AllMessages.Checked)
                {
                    MessageList.DataSource = (from patientMessage in user.Message.AsParallel()
                                              select new
                    {
                        Дата = patientMessage.Date.ToString(),
                        Сообщение = patientMessage.Title,
                        Статус = patientMessage.GetChecked(),
                        Код = patientMessage.Id
                    }).Union(from deviceMessage in user.DeviceMessage.AsParallel()
                             select new
                    {
                        Дата      = deviceMessage.Date.ToString(),
                        Сообщение = deviceMessage.Title,
                        Статус    = deviceMessage.GetChecked(),
                        Код       = deviceMessage.Id
                    }).ToList();

                    MessageList.Update();
                }
                else
                {
                    MessageList.DataSource = (from patientMessage in user.Message.AsParallel()
                                              where patientMessage.Checked == false
                                              select new
                    {
                        Дата = patientMessage.Date.ToString(),
                        Сообщение = patientMessage.Title,
                        Статус = patientMessage.GetChecked(),
                        Код = patientMessage.Id
                    }).Union(from deviceMessage in user.DeviceMessage.AsParallel()
                             where deviceMessage.Checked == false
                             select new
                    {
                        Дата      = deviceMessage.Date.ToString(),
                        Сообщение = deviceMessage.Title,
                        Статус    = deviceMessage.GetChecked(),
                        Код       = deviceMessage.Id
                    }).ToList();

                    MessageList.Update();
                }
            }
            else
            {
                if (NewPatientsMessage.Checked)
                {
                    if (AllMessages.Checked)
                    {
                        MessageList.DataSource = (from patientMessage in user.Message.AsParallel()
                                                  select new
                        {
                            Дата = patientMessage.Date.ToString(),
                            Сообщение = patientMessage.Title,
                            Статус = patientMessage.GetChecked(),
                            Код = patientMessage.Id
                        }).ToList();
                    }
                    else
                    {
                        MessageList.DataSource = (from patientMessage in user.Message.AsParallel()
                                                  where patientMessage.Checked == false
                                                  select new
                        {
                            Дата = patientMessage.Date.ToString(),
                            Сообщение = patientMessage.Title,
                            Статус = patientMessage.GetChecked(),
                            Код = patientMessage.Id
                        }).ToList();
                    }
                }
                else
                {
                    if (DeviceMessages.Checked)
                    {
                        if (AllMessages.Checked)
                        {
                            MessageList.DataSource = (from deviceMessage in user.DeviceMessage.AsParallel()
                                                      select new
                            {
                                Дата = deviceMessage.Date.ToString(),
                                Сообщение = deviceMessage.Title,
                                Статус = deviceMessage.GetChecked(),
                                Код = deviceMessage.Id
                            }).ToList();
                        }
                        else
                        {
                            MessageList.DataSource = (from deviceMessage in user.DeviceMessage.AsParallel()
                                                      where deviceMessage.Checked == false
                                                      select new
                            {
                                Дата = deviceMessage.Date.ToString(),
                                Сообщение = deviceMessage.Title,
                                Статус = deviceMessage.GetChecked(),
                                Код = deviceMessage.Id
                            }).ToList();
                        }
                    }
                    else
                    {
                        MessageList.DataSource = null;
                    }
                }
            }

            MessageList.Update();
        }
示例#16
0
 private void ScrollToBottom()
 {
     MessageList.UpdateLayout();
     Scroller.UpdateLayout();
     Scroller.ScrollToVerticalOffset(Scroller.ExtentHeight);
 }
示例#17
0
 public JSONData(IAnalysisContext context = null, MessageList messages = null, bool throwErrors = false) :
     base(context, messages ?? new MessageList(), throwErrors)
 {
 }
示例#18
0
        private void Initialize()
        {
            gtalkHelper.RosterUpdated -= Initialize;

            Dispatcher.BeginInvoke(() => {
                string displayName = email;
                string status      = string.Empty;
                if (App.Current.Roster.Contains(to))
                {
                    Contact t   = App.Current.Roster[to];
                    displayName = t.NameOrEmail;
                    status      = t.Status;
                }

                PageTitle.Text = displayName.ToUpper();
                if (status != string.Empty)
                {
                    PageTitle.Text += ", " + char.ToUpper(status[0]) + status.Substring(1);
                }

                TypingStatus.Text = String.Format(AppResources.Chat_NoticeTyping, displayName);

                if (gtalkHelper.IsContactPinned(email))
                {
                    pinButton.IsEnabled = false;
                }

                chatLog = gtalkHelper.ChatLog(to);

                MessageList.Visibility = System.Windows.Visibility.Collapsed;

                MessageList.Children.Clear();

                lock (chatLog) {
                    var otr = false;

                    foreach (var message in chatLog)
                    {
                        UserControl bubble;

                        if (message.OTR != otr)
                        {
                            if (message.OTR)
                            {
                                ShowStartOtr();
                            }
                            else
                            {
                                ShowEndOtr();
                            }

                            otr = message.OTR;
                        }

                        if (message.Body == null)
                        {
                            continue;
                        }

                        if (message.Outbound)
                        {
                            bubble = new SentChatBubble();

                            (bubble as SentChatBubble).Text      = message.Body;
                            (bubble as SentChatBubble).TimeStamp = message.Time;
                        }
                        else
                        {
                            bubble = new ReceivedChatBubble();

                            (bubble as ReceivedChatBubble).Text      = message.Body;
                            (bubble as ReceivedChatBubble).TimeStamp = message.Time;
                        }

                        MessageList.Children.Add(bubble);
                    }
                }

                MessageList.Visibility = System.Windows.Visibility.Visible;
                MessageList.UpdateLayout();
                Scroller.UpdateLayout();
                Scroller.ScrollToVerticalOffset(Scroller.ExtentHeight);

                var unread = settings["unread"] as Dictionary <string, int>;
                lock (unread) {
                    unread[email] = 0;
                }
                if (App.Current.Roster.Contains(email))
                {
                    App.Current.Roster[email].UnreadCount = 0;
                }

                Uri url            = gtalkHelper.GetPinUri(email);
                ShellTile existing = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri == url);

                if (existing != null)
                {
                    existing.Update(
                        new StandardTileData {
                        Count = 0
                    }
                        );
                }

                var contact = App.Current.Roster[email];

                if (contact != null)
                {
                    contact.UnreadCount = 0;
                }

                // Sets to broadcast the first message in a conversation
                to = email;
            });
        }
示例#19
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            if (MessageText.Text.Length == 0)
            {
                return;
            }

            ShowProgressBar(AppResources.Chat_ProgressSendingMessage);

            sendButton.IsEnabled = false;

            try {
                gtalk.SendMessage(to, MessageText.Text, data => Dispatcher.BeginInvoke(() => {
                    HideProgressBar();

                    var bubble       = new SentChatBubble();
                    bubble.Text      = MessageText.Text;
                    bubble.TimeStamp = DateTime.Now;

                    App.Current.GtalkHelper.AddRecentContact(currentContact);

                    MessageList.Children.Add(bubble);

                    sendButton.IsEnabled = true;

                    MessageList.UpdateLayout();
                    Scroller.UpdateLayout();
                    Scroller.ScrollToVerticalOffset(Scroller.ExtentHeight);

                    lock (chatLog) {
                        while (chatLog.Count >= GoogleTalkHelper.MaximumChatLogSize)
                        {
                            chatLog.RemoveAt(0);
                        }
                        chatLog.Add(new Message {
                            Body     = MessageText.Text,
                            Outbound = true,
                            Time     = DateTime.Now,
                            OTR      = otr
                        });
                    }

                    MessageText.Text = "";

                    FlurryWP7SDK.Api.LogEvent("Chat - Chat sent");
                }), error => {
                    HideProgressBar();
                    if (error.StartsWith("403"))
                    {
                        settings.Remove("token");
                        settings.Remove("rootUrl");
                        gtalkHelper.LoginIfNeeded();
                    }
                    else
                    {
                        Dispatcher.BeginInvoke(
                            () => {
                            sendButton.IsEnabled = true;
                            gtalkHelper.ShowToast(AppResources.Chat_ErrorMessageNotSent);
                        }
                            );
                    }
                });
            } catch (InvalidOperationException) {
                Dispatcher.BeginInvoke(
                    () => {
                    HideProgressBar();
                    MessageBox.Show(
                        AppResources.Chat_ErrorAuthExpiredBody,
                        AppResources.Chat_ErrorAuthExpiredTitle,
                        MessageBoxButton.OK
                        );
                    App.Current.RootFrame.Navigate(new Uri("/Pages/Login.xaml", UriKind.Relative));
                }
                    );
            }
        }
示例#20
0
 public LaconfigLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false) :
     base(context, srcRef, source, messages, throwErrors)
 {
     m_FSM = new FSM(this);
 }
示例#21
0
 public MessageListViewModel()
 {
     MessageList             = Repository.Get(typeof(MessageList)) as MessageList;
     SelectedMessage         = Repository.Get(typeof(SelectedMessage)) as SelectedMessage;
     SelectedMessage.message = MessageList.First();
 }
示例#22
0
 public static extern void IVR_GetDeviceStatus(ref MessageList msg);
示例#23
0
 public JSONParser(JSONData context, JSONLexer input, MessageList messages = null, bool throwErrors = false, bool caseSensitiveMaps = true) :
     base(context, new JSONLexer[] { input }, messages, throwErrors)
 {
     m_Lexer             = Input.First();
     m_CaseSensitiveMaps = caseSensitiveMaps;
 }
示例#24
0
        /// <summary>
        /// Add message to ListView
        /// </summary>
        /// <param name="position">Position relative to current objects</param>
        /// <param name="scroll">Ture if it shold be scrolled to</param>
        /// <param name="messages">List of messages to add</param>
        /// <param name="showNewMessageIndicator">True if the New Message Indicator should be displayed</param>
        public void AddMessages(Position position, bool scroll, List <MessageContainer> messages,
                                bool showNewMessageIndicator)
        {
            // Debug assist
            Stopwatch sw = new Stopwatch();

            sw.Start();

            // Clear overlay indicators (for now)
            ReturnToPresentIndicator.Visibility = Visibility.Collapsed;
            MoreNewMessageIndicator.Visibility  = Visibility.Collapsed;

            if (messages != null && messages.Count > 0 && messages[0].Message.ChannelId == ChannelId)
            {
                // The Message to scroll to once loaded
                MessageContainer scrollTo = null;

                if (showNewMessageIndicator)
                {
                    // (MAYBE) SHOW NEW MESSAGE INDICATOR
                    DateTimeOffset firstMessageTime = Common.SnowflakeToTime(messages.First().Message.Id);
                    DateTimeOffset lastMessageTime  = Common.SnowflakeToTime(messages.Last().Message.Id);
                    DateTimeOffset lastReadTime     = Common.SnowflakeToTime(App.LastReadMsgId);

                    if (firstMessageTime < lastReadTime)
                    {
                        // The last read message is after the first one in the list
                        if (lastMessageTime > lastReadTime)
                        {
                            _outofboundsNewMessage = false;
                            // The last read message is before the last one in the list
                            bool canBeLastRead = true;
                            for (int i = 0; i < messages.Count(); i++)
                            {
                                if (canBeLastRead)
                                {
                                    // The first one with a larger timestamp gets the "NEW MESSAGES" header
                                    DateTimeOffset currentMessageTime = Common.SnowflakeToTime(messages[i].Message.Id);
                                    if (currentMessageTime > lastReadTime)
                                    {
                                        messages[i].LastRead = true;
                                        scrollTo             = messages[i];
                                        canBeLastRead        = false;
                                    }
                                }

                                if (position == Position.After)
                                {
                                    MessageList.Items.Add(messages[i]);
                                }
                                else if (position == Position.Before)
                                {
                                    MessageList.Items.Insert(i, messages[i]);
                                }
                            }
                        }
                        else
                        {
                            // The last read message is after the span of currently displayed messages
                            _outofboundsNewMessage = true;
                            for (int i = 0; i < messages.Count(); i++)
                            {
                                if (position == Position.After)
                                {
                                    MessageList.Items.Add(messages[i]);
                                }
                                else if (position == Position.Before)
                                {
                                    MessageList.Items.Insert(i, messages[i]);
                                }
                            }
                        }
                    }
                    else
                    {
                        // The last read message is before the first one in the list
                        _outofboundsNewMessage = true;
                        for (int i = 0; i < messages.Count(); i++)
                        {
                            if (position == Position.After)
                            {
                                MessageList.Items.Add(messages[i]);
                            }
                            else if (position == Position.Before)
                            {
                                MessageList.Items.Insert(i, messages[i]);
                            }
                        }
                        scrollTo = messages.First();
                        MoreNewMessageIndicator.Opacity    = 0;
                        MoreNewMessageIndicator.Visibility = Visibility.Visible;
                        MoreNewMessageIndicator.Fade(1, 300).Start();
                    }
                }
                else
                {
                    // DO NOT SHOW NEW MESSAGE INDICATOR. Just add everything before or after
                    for (int i = 0; i < messages.Count(); i++)
                    {
                        if (position == Position.After)
                        {
                            MessageList.Items.Add(messages[i]);
                        }
                        else if (position == Position.Before)
                        {
                            MessageList.Items.Insert(i, messages[i]);
                        }
                    }
                }

                if (scroll && scrollTo != null)
                {
                    MessageList.ScrollIntoView(scrollTo, ScrollIntoViewAlignment.Leading);
                }
            }

            // Determine visibility of overlay indicators
            Message last = MessageList.Items.Count > 0 ? (MessageList.Items.Last() as MessageContainer).Message : null;

            if (last != null && CurrentGuildId != null && ChannelId != null && LocalState.CurrentGuild.channels.ContainsKey(ChannelId) && LocalState.CurrentGuild.channels[ChannelId].raw.LastMessageId != null && Convert.ToInt64(last.Id) >
                Convert.ToInt64(LocalState.CurrentGuild.channels[ChannelId].raw.LastMessageId))
            {
                ReturnToPresentIndicator.Opacity    = 1;
                ReturnToPresentIndicator.Visibility = Visibility.Visible;
                ReturnToPresentIndicator.Fade(1, 300).Start();
            }
            else
            {
                ReturnToPresentIndicator.Visibility = Visibility.Collapsed;
            }

            // Debug assit
            sw.Stop();
            Debug.WriteLine("Messages took " + sw.ElapsedMilliseconds + "ms to load");
        }
示例#25
0
 public override ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
 {
     throw new NotImplementedException(GetType().Name + ".MakeLexer()");
 }
示例#26
0
 private void ScrollViewDown()
 {
     // Scroll to last message
     MessageList.ScrollIntoView(MessageList.Items[MessageList.Items.Count - 1]);
 }
示例#27
0
 public async static Task LoadStoredMessagesAsync()
 {
     messages = MessageList.FromJSON(await DataStorage.GetStoredMessagesAsync(session.Username));
 }
示例#28
0
 /// <summary>
 /// Makes lexer capable of this language analysis
 /// </summary>
 public abstract ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false);
示例#29
0
        public bool Undo(MessageList messages)
        {
            bool messageFound = false;

            foreach (MessageContainer message in messages) {
                messageFound = Undo(message);
                if (!messageFound) break;
            }

            return messageFound;
        }
示例#30
0
 private void CleanOldMessage(NotifyCollectionChangedEventArgs eventArgs)
 {
     MessageEditText.Text = "";
     MessageList.ScrollToRow(NSIndexPath.FromItemSection(ViewModel.MessageList.Count - 1, 0),
                             UITableViewScrollPosition.Top, true);
 }
示例#31
0
        private MessageList Wrap(IEnumerable<MessageContainer> msgs)
        {
            MessageList wrapper = new MessageList();

            foreach (MessageContainer msg in msgs) {
                //TODO Trace list
                //msg.TraceList.Add(new TraceContainer { SourceId=msg.SourceId, Received=DateTime.Now } )
                msg.Status = enmMessageStatus.Retrieved;
                wrapper.Add(msg);
            }

            return wrapper;
        }
示例#32
0
 public void Create(MessageList messages)
 {
     foreach (MessageContainer message in messages) {
         _messageList.Add(message);
     }
 }
示例#33
0
 public override ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
 {
     throw new NotSupportedException("UnspecifiedLanguage.MakeLexer()");
 }
        /// <summary>
        /// Returns the service status of a particular MWS API section. The operation
        /// takes no input.
        ///
        /// </summary>
        /// <param name="service">Instance of MarketplaceWebServiceOrders service</param>
        /// <param name="request">GetServiceStatusRequest request</param>
        public static void InvokeGetServiceStatus(MarketplaceWebServiceOrders service, GetServiceStatusRequest request)
        {
            try
            {
                GetServiceStatusResponse response = service.GetServiceStatus(request);


                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        GetServiceStatusResponse");
                if (response.IsSetGetServiceStatusResult())
                {
                    Console.WriteLine("            GetServiceStatusResult");
                    GetServiceStatusResult getServiceStatusResult = response.GetServiceStatusResult;
                    if (getServiceStatusResult.IsSetStatus())
                    {
                        Console.WriteLine("                Status");
                        Console.WriteLine("                    {0}", getServiceStatusResult.Status);
                    }
                    if (getServiceStatusResult.IsSetTimestamp())
                    {
                        Console.WriteLine("                Timestamp");
                        Console.WriteLine("                    {0}", getServiceStatusResult.Timestamp);
                    }
                    if (getServiceStatusResult.IsSetMessageId())
                    {
                        Console.WriteLine("                MessageId");
                        Console.WriteLine("                    {0}", getServiceStatusResult.MessageId);
                    }
                    if (getServiceStatusResult.IsSetMessages())
                    {
                        Console.WriteLine("                Messages");
                        MessageList    messages    = getServiceStatusResult.Messages;
                        List <Message> messageList = messages.Message;
                        foreach (Message message in messageList)
                        {
                            Console.WriteLine("                    Message");
                            if (message.IsSetLocale())
                            {
                                Console.WriteLine("                        Locale");
                                Console.WriteLine("                            {0}", message.Locale);
                            }
                            if (message.IsSetText())
                            {
                                Console.WriteLine("                        Text");
                                Console.WriteLine("                            {0}", message.Text);
                            }
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
                Console.WriteLine("            ResponseHeaderMetadata");
                Console.WriteLine("                RequestId");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.RequestId);
                Console.WriteLine("                ResponseContext");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.ResponseContext);
                Console.WriteLine("                Timestamp");
                Console.WriteLine("                    " + response.ResponseHeaderMetadata.Timestamp);
                Console.WriteLine();
            }
            catch (MarketplaceWebServiceOrdersException ex)
            {
                Console.WriteLine("Caught Exception: " + ex.Message);
                Console.WriteLine("Response Status Code: " + ex.StatusCode);
                Console.WriteLine("Error Code: " + ex.ErrorCode);
                Console.WriteLine("Error Type: " + ex.ErrorType);
                Console.WriteLine("Request ID: " + ex.RequestId);
                Console.WriteLine("XML: " + ex.XML);
                Console.WriteLine("ResponseHeaderMetadata: " + ex.ResponseHeaderMetadata);
            }
        }
示例#35
0
 protected SourceRefCommonCodeProcessor(IAnalysisContext context, SourceCodeRef srcRef, MessageList messages = null, bool throwErrors = false) :
     base(context, messages, throwErrors)
 {
     m_SourceCodeReference = srcRef;
 }
        public void GetMessageListTest()
        {
            try
            {
                MessagesRequester requester = new MessagesRequester("AC736ca2078721a9a41fb47f07bf40d9e21cb304da", "8e3d1c1c519fc761856f8cc825bcfea94d8c58b5", "AC736ca2078721a9a41fb47f07bf40d9e21cb304da");

                Type      type      = typeof(APIRequester);
                FieldInfo fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(requester, "http://GetMessageListTest:3000");
                }

                string to   = "+18475978014";
                string from = "+12248806205";
                string text = "Hello World";

                WebRequest.RegisterPrefix("http://GetMessageListTest:3000", new TestWebRequestCreate());

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":0,\"end\":1,\"page\":0,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":\"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages&cursor=492dc883a811bd0204204ea9047122f93a2788a2\", \"messages\" : [{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892924\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"inbound\", \"status\" : \"received\"}, {\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892925\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892925\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"inbound\", \"status\" : \"received\"}]}");


                MessageList msgList = requester.get();

                Assert.IsNotNull(msgList);

                Assert.AreEqual(msgList.getLocalSize, 2);
                Assert.AreEqual((msgList.export()).Count, 2);

                Message msg = msgList.get(0) as Message;

                Assert.IsNotNull(msg);
                Assert.AreEqual(msg.getMessageId, "MM16ac1bcbd6f4895c89a798571e89e1e715892924");

                type      = typeof(APIRequester);
                fieldInfo = type.GetField("freeClimbUrl", BindingFlags.NonPublic | BindingFlags.Instance);
                if (fieldInfo != null)
                {
                    fieldInfo.SetValue(msgList, "http://GetMessageListTest:3000");
                }

                TestWebRequestCreate.MockHttpWebRequestWithGivenResponseCode(HttpStatusCode.OK,
                                                                             "{\"total\":3,\"start\":2,\"end\":2,\"page\":1,\"numPages\":2,\"pageSize\":2,\"nextPageUri\":null, \"messages\" : [{\"uri\" : \"/Accounts/AC736ca2078721a9a41fb47f07bf40d9e21cb304da/Messages/MM16ac1bcbd6f4895c89a798571e89e1e715892926\", \"revision\" : 1, \"dateCreated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"dateUpdated\" : \"Thu, 23 Jun 2016 17:30:06 GMT\", \"messageId\" : \"MM16ac1bcbd6f4895c89a798571e89e1e715892926\", \"accountId\" : \"AC736ca2078721a9a41fb47f07bf40d9e21cb304da\", \"from\" : \"" + from + "\", \"to\" : \"" + to + "\", \"text\" : \"" + text + "\", \"direction\" : \"inbound\", \"status\" : \"received\"}]}");

                msgList.loadNextPage();

                Assert.IsNotNull(msgList);

                Assert.AreEqual(msgList.getLocalSize, 3);
                Assert.AreEqual((msgList.export()).Count, 3);

                msg = msgList.get(2) as Message;
                Assert.IsNotNull(msg);
                Assert.AreEqual(msg.getMessageId, "MM16ac1bcbd6f4895c89a798571e89e1e715892926");
            }
            catch (FreeClimbException pe)
            {
                Assert.Fail(pe.Message);
            }
        }
    private void getMessageList(string accTok, string endP, string filters)
    {
        try
        {
            string contextURL = string.Empty;
            contextURL = string.Empty + endP + "/myMessages/v2/messages?" + filters + "limit=5&offset=1";

            HttpWebRequest getMessageListWebRequest = (HttpWebRequest)WebRequest.Create(contextURL);
            getMessageListWebRequest.Headers.Add("Authorization", "Bearer " + accTok);
            getMessageListWebRequest.Method = "GET";
            getMessageListWebRequest.KeepAlive = true;
            WebResponse getMessageListWebResponse = getMessageListWebRequest.GetResponse();
            using (var stream = getMessageListWebResponse.GetResponseStream())
            {
                StreamReader sr = new StreamReader(stream);
                string csGetMessageListDetailsData = sr.ReadToEnd();

                JavaScriptSerializer deserializeJsonObject = new JavaScriptSerializer();
                csGetMessageListDetails deserializedJsonObj = (csGetMessageListDetails)deserializeJsonObject.Deserialize(csGetMessageListDetailsData, typeof(csGetMessageListDetails));

                if (null != deserializedJsonObj)
                {
                    getMessageListSuccessResponse = "Success";
                    csGetMessageListDetailsResponse = deserializedJsonObj.messageList;
                }
                else
                {
                    getMessageListErrorResponse = "No response from server";
                }

                sr.Close();

            }
        }
        catch (WebException we)
        {
            string errorResponse = string.Empty;
            try
            {
                using (StreamReader sr2 = new StreamReader(we.Response.GetResponseStream()))
                {
                    errorResponse = sr2.ReadToEnd();
                    sr2.Close();
                }
                getMessageListErrorResponse = errorResponse;
            }
            catch
            {
                errorResponse = "Unable to get response";
                getMessageListErrorResponse = errorResponse;
            }
        }
        catch (Exception ex)
        {
            getMessageListErrorResponse = ex.Message;
            return;
        }
    }
示例#38
0
 public override ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
 {
     return(new JSONLexer(context, srcRef, source, messages, throwErrors));
 }
示例#39
0
 public override ILexer MakeLexer(IAnalysisContext context, SourceCodeRef srcRef, ISourceText source, MessageList messages = null, bool throwErrors = false)
 {
     return new LaconfigLexer(context, srcRef, source, messages, throwErrors);
 }
示例#40
0
文件: OVRDevice.cs 项目: yk3/GJ
 private static extern bool OVR_Update(ref MessageList messageList);
示例#41
0
 public bool Delete(MessageList messages)
 {
     return false;
 }
示例#42
0
 protected void Page_Load(object sender, EventArgs e)
 {
     MessageList.DataSource = null;
     MessageList.DataBind();
 }
示例#43
0
		internal static void LogNodeException(MessageList messages, Node node, Exception ex)
		{
			if (_log.IsErrorEnabled)
			{
				if (ex is SocketException)
				{
					SocketException sex = (SocketException)ex;
					_log.ErrorFormat("Socket error {0} while handling {1} for node {2}", sex.SocketErrorCode, messages, node.ToExtendedString());
				}
				else
				{
					_log.ErrorFormat("Error handling {0} for node {1}: {2}", messages, node.ToExtendedString(), ex.ToString());
				}
			}

		}
示例#44
0
 protected void LoadMessageDisplay(List <string> errormsglist, string cssclass)
 {
     MessageList.CssClass   = cssclass;
     MessageList.DataSource = errormsglist;
     MessageList.DataBind();
 }
示例#45
0
	private static extern bool OVR_Update(ref MessageList messageList);	
示例#46
0
 public void AddMessage(string message)
 {
     MessageList.Add(message);
 }