Пример #1
0
 private void AddMessageBox()
 {
     if (IncludeMessageBox)
     {
         JsonMessageBox messageBox = new JsonMessageBox();
         if (!string.IsNullOrEmpty(MessageBoxCssClass))
         {
             messageBox.BoxCssClass = MessageBoxCssClass;
         }
         if (!string.IsNullOrEmpty(MessageBoxTitleCssClass))
         {
             messageBox.TitleCssClass = MessageBoxTitleCssClass;
         }
         if (!string.IsNullOrEmpty(MessageBoxTextCssClass))
         {
             messageBox.MessageCssClass = MessageBoxTextCssClass;
         }
         if (!string.IsNullOrEmpty(MessageBoxTitle))
         {
             messageBox.Title = MessageBoxTitle;
         }
         Controls.Add(messageBox);
         AddJsonControl(messageBox);
     }
 }
Пример #2
0
        private void SawOutputPrivate(string fname, string contents)
        {
            try
            {
                var tcLinkResponse = JsonConvert.DeserializeObject <TCLinkResponse>(contents);
                contents = JsonConvert.SerializeObject(tcLinkResponse, Formatting.Indented, new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                });
            }
            catch (Exception xcp)
            {
                JsonMessageBox.Show("Error", xcp.Message + "\r\nContents: " + contents);
                contents = JsonHelper.FormatJson(contents);
            }

            TCLinkResponse response = Helper.DeserializeLinkResponse(contents);

            for (int i = _fillers.Count - 1; i >= 0 && i < _fillers.Count; i--)
            {
                string key = _fillers.Keys.ToArray()[i];
                if (key.Equals(response?.MessageID))
                {
                    try
                    {
                        if (_fillers[key] != null)
                        {
                            _fillers[key].Invoke(contents);
                        }
                    }
                    catch (Exception xcp)
                    {
                        JsonMessageBox.Show("Error", xcp.Message);
                    }
                    _fillers.Remove(key);
                    return;
                }
            }

            JsonMessageBox.Show("Unknown Destination for Message", contents);
        }