IsPrivate
How do I use Is Private
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
33 | public bool IsPrivate { get; internal protected set; } | 1 |
534 | public bool TryGetChannel(string channelName, bool isPrivate, out ChatChannel channel) | 2 |
710 | channel.IsPrivate = true; | 3 |
File name: ChatClient.cs
Copy
534 public bool TryGetChannel(string channelName, bool isPrivate, out ChatChannel channel)
535 {
536 if (!isPrivate)
537 {
538 return this.PublicChannels.TryGetValue(channelName, out channel);
539 }
540 else
541 {
542 return this.PrivateChannels.TryGetValue(channelName, out channel);
543 }
544 }
File name: ChatClient.cs
Copy
688 private void HandlePrivateMessageEvent(EventData eventData)
689 {
690 //Console.WriteLine(SupportClass.DictionaryToString(eventData.Parameters));
691
692 var message = (object)eventData.Parameters[(byte)ChatParameterCode.Message];
693 var sender = (string)eventData.Parameters[(byte)ChatParameterCode.Sender];
694
695 string channelName;
696 if (this.UserId != null && this.UserId.Equals(sender))
697 {
698 var target = (string)eventData.Parameters[(byte)ChatParameterCode.UserId];
699 channelName = this.GetPrivateChannelNameByUser(target);
700 }
701 else
702 {
703 channelName = this.GetPrivateChannelNameByUser(sender);
704 }
705
706 ChatChannel channel;
707 if (!this.PrivateChannels.TryGetValue(channelName, out channel))
708 {
709 channel = new ChatChannel(channelName);
710 channel.IsPrivate = true;
711 this.PrivateChannels.Add(channel.Name, channel);
712 }
713
714 channel.Add(sender, message);
715 this.listener.OnPrivateMessage(sender, message, channelName);
716 }
IsPrivate 125 lượt xem
Gõ tìm kiếm nhanh...