本文整理汇总了C#中BubbleGroup.LastBubbleSafe方法的典型用法代码示例。如果您正苦于以下问题:C# BubbleGroup.LastBubbleSafe方法的具体用法?C# BubbleGroup.LastBubbleSafe怎么用?C# BubbleGroup.LastBubbleSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BubbleGroup
的用法示例。
在下文中一共展示了BubbleGroup.LastBubbleSafe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Group
internal static BubbleGroup Group(VisualBubble vb, bool resend = false, bool insertAtBottom = false)
{
lock (BubbleGroupDatabase.OperationLock)
{
Utils.DebugPrint("Grouping an " + vb.Direction + " bubble on service " + vb.Service.Information.ServiceName);
var theGroup =
BubbleGroupManager.FindWithAddress(vb.Service, vb.Address);
BubbleGroupFactory.LoadFullyIfNeeded(theGroup);
var duplicate = false;
var newGroup = false;
if (theGroup == null)
{
Utils.DebugPrint(vb.Service.Information.ServiceName + " unable to find suitable group. Creating a new one.");
theGroup = new BubbleGroup(vb, null, false);
newGroup = true;
Utils.DebugPrint("GUID of new group: " + theGroup.ID);
BubbleGroupSettingsManager.SetUnreadIndicatorGuid(theGroup, theGroup.LastBubbleSafe().ID, true);
vb.Service.NewBubbleGroupCreated(theGroup).ContinueWith(x =>
{
// force the UI to refetch the photo
theGroup.IsPhotoSetFromService = false;
SendSubscribe(theGroup, true);
BubbleGroupUpdater.Update(theGroup);
});
BubbleGroupManager.BubbleGroupsAdd(theGroup);
}
else
{
if (resend)
{
if (vb.Status == Bubble.BubbleStatus.Failed)
{
UpdateStatus(vb, Bubble.BubbleStatus.Waiting, theGroup);
}
return theGroup;
}
var visualBubbleServiceId = vb.Service as IVisualBubbleServiceId;
if (visualBubbleServiceId != null &&
visualBubbleServiceId.DisctinctIncomingVisualBubbleIdServices())
{
if (vb.IdService != null)
{
duplicate = theGroup.Bubbles.FirstOrDefault(x => x.GetType() == vb.GetType() && x.IdService == vb.IdService) != null;
}
if (!duplicate && vb.IdService2 != null)
{
duplicate = theGroup.Bubbles.FirstOrDefault(x => x.GetType() == vb.GetType() && x.IdService2 == vb.IdService2) != null;
}
}
if (!duplicate)
{
Utils.DebugPrint(vb.Service.Information.ServiceName + " found a group. Adding.");
if (insertAtBottom)
{
var lastBubble = theGroup.LastBubbleSafe();
if (lastBubble.Time > vb.Time)
{
vb.Time = lastBubble.Time;
}
}
theGroup.InsertByTime(vb);
}
else
{
Utils.DebugPrint("Yuck. It's a duplicate bubble. No need to readd: " + vb.IdService + ", " + vb.IdService2);
}
}
try
{
if (theGroup.IsParty && !string.IsNullOrWhiteSpace(vb.ParticipantAddressNickname))
{
var participantAddressNicknamesArray = theGroup.ParticipantNicknames;
if (participantAddressNicknamesArray == null)
{
participantAddressNicknamesArray = new DisaParticipantNickname[0];
}
var participantAddressNicknames = participantAddressNicknamesArray.ToList();
var changed = false;
var adding = true;
foreach (var participantAddressNickname in participantAddressNicknames)
{
if (theGroup.Service.BubbleGroupComparer(participantAddressNickname.Address, vb.ParticipantAddress))
{
if (participantAddressNickname.Nickname != vb.ParticipantAddressNickname)
{
participantAddressNickname.Nickname = vb.ParticipantAddressNickname;
//.........这里部分代码省略.........
示例2: GetLastMessageIdService
private uint GetLastMessageIdService(BubbleGroup bubbleGroup)
{
var id = bubbleGroup.LastBubbleSafe().IdService;
if (id == null)
{
return 0;
}
return uint.Parse(id);
}
示例3: AddNewInternal
private static BubbleGroup AddNewInternal(VisualBubble newBubble, bool raiseBubbleInserted)
{
var group = new BubbleGroup(newBubble, null, false);
BubbleGroupSettingsManager.SetUnreadIndicatorGuid(group, group.LastBubbleSafe().ID, true);
if (ServiceManager.IsRunning(@group.Service))
{
newBubble.Service.NewBubbleGroupCreated(@group).ContinueWith(x =>
{
// force the UI to refetch the photo
@group.IsPhotoSetFromService = false;
BubbleManager.SendSubscribe(@group, true);
BubbleGroupUpdater.Update(@group);
});
}
BubbleGroupManager.BubbleGroupsAdd(@group);
BubbleGroupDatabase.AddBubble(@group, newBubble);
if (raiseBubbleInserted)
{
try
{
BubbleGroupEvents.RaiseBubbleInserted(newBubble, @group);
}
catch (Exception ex)
{
Utils.DebugPrint(
"Error in notifying the interface that the bubble group has been updated (" +
newBubble.Service.Information.ServiceName + "): " + ex.Message);
}
}
BubbleGroupUpdater.Update(@group);
return @group;
}
示例4: SetUnread
private static void SetUnread(BubbleGroup group, bool unread, bool updateUi = true, bool skipSendReadBubble = false, bool onlySetIfServiceRunning = true)
{
var unifiedGroup = @group as UnifiedBubbleGroup;
if (unifiedGroup != null)
{
foreach (var innerGroup in unifiedGroup.Groups)
{
SetUnread(innerGroup, unread, false, skipSendReadBubble, onlySetIfServiceRunning);
}
}
var currentlyUnread = BubbleGroupSettingsManager.GetUnread(@group);
if (!unread)
{
BubbleGroupSettingsManager.SetUnreadIndicatorGuid(group, group.LastBubbleSafe().ID, false);
}
if ((onlySetIfServiceRunning && ServiceManager.IsRunning(@group.Service)) || !onlySetIfServiceRunning)
{
BubbleGroupSettingsManager.SetUnread(@group, unread);
if (unifiedGroup == null)
{
if (!skipSendReadBubble)
{
if (@group.Service.Information.DoesSupport(typeof(ReadBubble)) && ServiceManager.IsRunning(@group.Service))
{
BubbleManager.Send(new ReadBubble(Time.GetNowUnixTimestamp(), Bubble.BubbleDirection.Outgoing,
@group.Service, @group.Address, null, Time.GetNowUnixTimestamp(), @group.IsParty, currentlyUnread));
}
}
}
if (updateUi)
BubbleGroupEvents.RaiseRefreshed(@group);
}
}
示例5: Add
internal static void Add(BubbleGroup group)
{
lock (_dbLock)
{
if (group is UnifiedBubbleGroup)
return;
Remove(group.ID);
using (var db = new SqlDatabase<Entry>(Location, false))
{
if (!db.Failed)
{
var lastBubble = group.LastBubbleSafe();
var serviceName = group.Service.Information.ServiceName;
db.Add(new Entry
{
Guid = group.ID,
Service = serviceName,
LastBubble = SerializeBubble(lastBubble),
LastBubbleGuid = lastBubble.ID
});
}
}
}
}