private void ShowInfomation(string live, string comu, string user) { InfomationType type = NiconicoManager.Instance.GetInfomationType(comu); if (type == InfomationType.None) { return; } string result = null; System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { InfoWindow window = _ownerWindow.NewInfomation(5000, "http://live.nicovideo.jp/watch/lv" + live); window.Show(); Task.Factory.StartNew(() => { result = Utils.GetResponse(string.Format(GetLiveInfoUrl, live)); XmlDocument doc = new XmlDocument(); doc.LoadXml(result); XmlNodeList infos = doc.DocumentElement.GetElementsByTagName("streaminfo"); window.Dispatcher.BeginInvoke(new Action(() => { window.InfomationTitle = infos[0].ChildNodes[0].InnerText; window.InfomationDescription = infos[0].ChildNodes[1].InnerText; window.Title = infos[0].ChildNodes[2].InnerText + " - " + doc.DocumentElement.GetElementsByTagName("communityinfo")[0].ChildNodes[0].InnerText; BitmapImage imageSource = new BitmapImage(new Uri(doc.DocumentElement.GetElementsByTagName("communityinfo")[0].ChildNodes[1].InnerText)); window.InfomationImage = imageSource; })); }); })); }
public static Message InformationHandler(InfomationType type, string name) { if (type == InfomationType.ConnectedUsers) { Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); m.SetContent(clients.Count.ToString() + " Connected Clients"); return(m); } else if (type == InfomationType.ConnectTime) { TimeSpan connectedTime = DateTime.UtcNow - clients[name].ConnectTime; Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); m.SetContent("You have been connected for " + connectedTime.ToString()); return(m); } else if (type == InfomationType.MessagesSent) { Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); m.SetContent(TotalMessagesSent.ToString() + " Messages Sent"); return(m); } else if (type == InfomationType.ServerUptime) { TimeSpan connectedTime = DateTime.UtcNow - startup; Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); m.SetContent("The server has been online for " + connectedTime.ToString()); return(m); } else if (type == InfomationType.Rooms) { Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); string content = "\n"; foreach (KeyValuePair <string, Room> room in Rooms) { content += $"{room.Value.Name} ({room.Value.ID})\n"; } m.SetContent(content + "use the /changeroom followed by an id or a name to change room"); return(m); } else { Message m = new Message("Server", MessageType.Infomation); m.SetColor(ColorToNColor(Color.Aquamarine)); m.SetContent("Unknown"); return(m); } }
public void CreateInformation(InfomationType infomationType) { m = new Message(Name, MessageType.Infomation); m.SetInformationType(infomationType); if (AutoSend) { if (IsSecure) { MessageHelpers.SetMessage(SStream, m); } else { MessageHelpers.SetMessage(Stream, m); } m = null; } }
public void SetInformationType(InfomationType infomationType) => InfomationType = infomationType;