本文整理汇总了C#中BubbleGroup类的典型用法代码示例。如果您正苦于以下问题:C# BubbleGroup类的具体用法?C# BubbleGroup怎么用?C# BubbleGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BubbleGroup类属于命名空间,在下文中一共展示了BubbleGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPartyBlockedParticipants
public Task GetPartyBlockedParticipants(BubbleGroup group, Action<DisaParticipant[]> result)
{
return Task.Factory.StartNew(() =>
{
var returnList = new List<DisaParticipant>();
var fullChat = FetchFullChat(group.Address, group.IsExtendedParty);
var iChatFull = fullChat.FullChat;
var channelFull = iChatFull as ChannelFull;
if (channelFull != null)
{
var kickedParticipants = GetChannelParticipants(channelFull, new ChannelParticipantsKicked());
foreach (var participant in kickedParticipants)
{
if (participant is ChannelParticipantKicked)
{
var id = TelegramUtils.GetUserIdFromChannelParticipant(participant);
if (id != null)
{
var user = _dialogs.GetUser(uint.Parse(id));
var name = TelegramUtils.GetUserName(user);
returnList.Add(new DisaParticipant(name, id));
}
}
}
}
result(returnList.ToArray());
});
}
示例2: UpdateGroupLegibleID
internal static void UpdateGroupLegibleID(BubbleGroup bubbleGroup, Action finished = null)
{
var service = bubbleGroup.Service;
if (!ServiceManager.IsRunning(service)) return;
try
{
service.GetBubbleGroupLegibleId(bubbleGroup, legibleID =>
{
bubbleGroup.LegibleId = legibleID;
if (finished == null)
{
BubbleGroupEvents.RaiseRefreshed(bubbleGroup);
}
else
{
finished();
}
});
}
catch (Exception ex)
{
Utils.DebugPrint("Error updating bubble group legible ID: " + service.Information.ServiceName + ": " +
ex.Message);
if (finished != null)
{
finished();
}
}
}
示例3: UnblockPartyParticipant
public Task UnblockPartyParticipant(BubbleGroup group, DisaParticipant participant, Action<bool> result)
{
return Task.Factory.StartNew(() =>
{
using (var client = new FullClientDisposable(this))
{
try
{
var response = TelegramUtils.RunSynchronously(client.Client.Methods.ChannelsKickFromChannelAsync(new ChannelsKickFromChannelArgs
{
Channel = new InputChannel
{
ChannelId = uint.Parse(group.Address),
AccessHash = TelegramUtils.GetChannelAccessHash(_dialogs.GetChat(uint.Parse(group.Address)))
},
Kicked = false,
UserId = new InputUser
{
UserId = uint.Parse(participant.Address),
AccessHash = GetUserAccessHashIfForeign(participant.Address)
}
}));
result(true);
}
catch (Exception e)
{
DebugPrint("#### Exception " + e);
result(false);
}
}
});
}
示例4: CanAddPartyParticipant
public Task CanAddPartyParticipant(BubbleGroup group, Action<bool> result)
{
return Task.Factory.StartNew(() =>
{
var fullChat = FetchFullChat(group.Address, group.IsExtendedParty);
var partyParticipants = GetPartyParticipants(fullChat);
if (!IsPartOfParty(partyParticipants))
{
result(false);
return;
}
if (ChatAdminsEnabled(group.Address))
{
if (group.IsExtendedParty && IsDemocracyEnabled(group))
{
//if democracy is enabled in a spergroup anyone can add members
result(true);
return;
}
if (!IsAdmin(group.Address, group.IsExtendedParty))
{
result(false);
return;
}
}
result(true);
});
}
示例5: Find
public BubbleGroupFinderResult Find()
{
var groups = new List<BubbleGroup>();
// If a group is still valid for this grid, we don't need to search for it again
// Turns out this is a bad optimisation - needs profiling
//groups.AddRange(_parentGroups.Where(x => x.IsValidFor(_grid)));
for (int y = 0; y < _grid.Height; y++)
{
for (int x = 0; x < _grid.Width; x++)
{
if(!_stats.ContainsKey(_grid[x,y])) _stats.Add(_grid[x,y], 1);
else _stats[_grid[x, y]]++;
if (!groups.Any(group => group.Locations.Contains(new Point(x, y))))
{
_currentGroup = new BubbleGroup();
FindBubbleGroup(x, y);
if (_currentGroup.Locations.Count > 1 && _currentGroup.Colour != Bubble.None)
{
groups.Add(_currentGroup);
}
}
}
}
return new BubbleGroupFinderResult(groups, _stats);
}
示例6: InsertDefaultIfNull
private static void InsertDefaultIfNull(BubbleGroup group)
{
lock (_lock)
{
if (group.Settings == null)
{
using (var db = new SqlDatabase<BubbleGroupSettings>(GetPath()))
{
var settings = new BubbleGroupSettings
{
Mute = false,
Unread = true,
Guid = group.ID,
LastUnreadSetTime = 0,
ReadTimes = null,
ParticipantNicknames = null,
NotificationLed = DefaultNotificationLedColor,
VibrateOption = null,
VibrateOptionCustomPattern = null,
Ringtone = null,
};
db.Add(settings);
group.Settings = settings;
}
}
}
}
示例7: CreateUnified
public static UnifiedBubbleGroup CreateUnified(List<BubbleGroup> groups, BubbleGroup primaryGroup)
{
lock (BubbleGroupDatabase.OperationLock)
{
var unifiedGroupsToKill = new HashSet<UnifiedBubbleGroup>();
foreach (var group in groups)
{
if (group.IsUnified)
{
unifiedGroupsToKill.Add(group.Unified);
@group.DeregisterUnified();
}
}
foreach (var unifiedGroup in unifiedGroupsToKill)
{
BubbleGroupManager.BubbleGroupsRemove(unifiedGroup);
}
UnifiedBubbleGroupsDatabase.Remove(unifiedGroupsToKill);
var unified = CreateUnifiedInternal(groups, primaryGroup);
UnifiedBubbleGroupsDatabase.Add(unified,
new DisaUnifiedBubbleGroupEntry(unified.ID,
unified.Groups.Select(innerGroup => innerGroup.ID)
.ToArray(), primaryGroup.ID, primaryGroup.ID));
BubbleGroupManager.BubbleGroupsAdd(unified);
return unified;
}
}
示例8: Delete
public static void Delete(BubbleGroup group)
{
lock (BubbleGroupDatabase.OperationLock)
{
var unifiedGroup = @group as UnifiedBubbleGroup;
if (unifiedGroup != null)
{
DeleteUnified(unifiedGroup);
return;
}
var file = BubbleGroupDatabase.GetLocation(@group);
if (File.Exists(file))
{
File.Delete(file);
}
BubbleGroupSync.RemoveFromSync(@group);
BubbleGroupSync.DeleteBubbleGroupIfHasAgent(@group);
BubbleGroupManager.BubbleGroupsRemove(@group);
}
}
示例9: GetPartyBlockedParticipantPicture
public Task GetPartyBlockedParticipantPicture(BubbleGroup group, string address, Action<DisaThumbnail> result)
{
return Task.Factory.StartNew(() =>
{
result(GetThumbnail(address, false, true));
});
}
示例10: CreateUnified
public static UnifiedBubbleGroup CreateUnified(List<BubbleGroup> groups, BubbleGroup primaryGroup)
{
lock (BubbleGroupDatabase.OperationLock)
{
var unifiedGroupsToKill = new HashSet<UnifiedBubbleGroup>();
foreach (var group in groups)
{
if (group.IsUnified)
{
unifiedGroupsToKill.Add(group.Unified);
@group.DeregisterUnified();
}
}
foreach (var unifiedGroup in unifiedGroupsToKill)
{
BubbleGroupManager.BubbleGroupsRemove(unifiedGroup);
}
BubbleGroupIndex.RemoveUnified(unifiedGroupsToKill.Select(x => x.ID).ToArray());
var unified = CreateUnifiedInternal(groups, primaryGroup);
BubbleGroupIndex.AddUnified(unified);
BubbleGroupManager.BubbleGroupsAdd(unified);
return unified;
}
}
示例11: LoadBubbles
public Task<List<VisualBubble>> LoadBubbles(BubbleGroup @group, long fromTime, int max = 100)
{
return Task<List<VisualBubble>>.Factory.StartNew(() =>
{
return LoadBubblesForBubbleGroup(group, fromTime, max);
});
}
示例12: LoadBubblesForBubbleGroup
private List<VisualBubble> LoadBubblesForBubbleGroup(BubbleGroup @group, long fromTime, int max)
{
var response = GetMessageHistory(group, fromTime, max);
var messages = response as MessagesMessages;
var messagesSlice = response as MessagesMessagesSlice;
var messagesChannels = response as MessagesChannelMessages;
if (messages != null)
{
_dialogs.AddChats(messages.Chats);
_dialogs.AddUsers(messages.Users);
//DebugPrint("Messages are as follows " + ObjectDumper.Dump(messages.Messages));
messages.Messages.Reverse();
return ConvertMessageToBubbles(messages.Messages);
}
if (messagesSlice != null)
{
_dialogs.AddChats(messagesSlice.Chats);
_dialogs.AddUsers(messagesSlice.Users);
//DebugPrint("Messages are as follows " + ObjectDumper.Dump(messagesSlice.Messages));
messagesSlice.Messages.Reverse();
return ConvertMessageToBubbles(messagesSlice.Messages);
}
if (messagesChannels != null)
{
_dialogs.AddChats(messagesChannels.Chats);
_dialogs.AddUsers(messagesChannels.Users);
messagesChannels.Messages.Reverse();
var bubbles = ConvertMessageToBubbles(messagesChannels.Messages);
SetExtendedFlag(bubbles);
return bubbles;
}
return new List<VisualBubble>();
}
示例13: UpdateName
internal static void UpdateName(BubbleGroup bubbleGroup, Action finished = null)
{
var service = bubbleGroup.Service;
if (!ServiceManager.IsRunning(service)) return;
try
{
service.GetBubbleGroupName(bubbleGroup, title =>
{
bubbleGroup.IsTitleSetFromService = true;
bubbleGroup.Title = title;
if (finished == null)
{
BubbleGroupEvents.RaiseRefreshed(bubbleGroup);
BubbleGroupEvents.RaiseInformationUpdated(bubbleGroup);
}
else
{
finished();
}
});
}
catch (Exception ex)
{
Utils.DebugPrint("Error updating bubble group name: " + service.Information.ServiceName + ": " +
ex.Message);
if (finished != null)
{
finished();
}
}
}
示例14: RaiseSyncReset
internal static void RaiseSyncReset(BubbleGroup group)
{
if (_syncReset != null)
{
_syncReset(group);
}
}
示例15: GetLocation
public static string GetLocation(BubbleGroup theGroup)
{
var tableLocation = GetServiceLocation(theGroup.Service.Information);
var groupLocation = Path.Combine(tableLocation,
theGroup.Service.Information.ServiceName + "^" + theGroup.ID + ".group");
return groupLocation;
}