本文整理汇总了C#中Presence类的典型用法代码示例。如果您正苦于以下问题:C# Presence类的具体用法?C# Presence怎么用?C# Presence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Presence类属于命名空间,在下文中一共展示了Presence类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Test_Create
public void Test_Create()
{
Presence p = new Presence(doc);
p.Type = PresenceType.available;
p.Status = "foo";
Assert.AreEqual("<presence><status>foo</status></presence>", p.ToString());
}
开发者ID:eNoise,项目名称:cyclops-chat,代码行数:7,代码来源:PresenceTest.cs
示例2: Acceptor
public Acceptor(Presence presence, Uri originatorUri, Uri[] learners) : base(presence)
{
this.originatorUri = originatorUri;
this.learners = learners;
Register<Propose>(OnPropose);
Register<Accept>(OnAccept);
}
开发者ID:calebjenkins,项目名称:Raven.SituationalAwareness,代码行数:7,代码来源:Acceptor.cs
示例3: GetPresenceDisplay
public static string GetPresenceDisplay(Presence presence)
{
if (presence.Type == PresenceType.available) {
if (!String.IsNullOrEmpty(presence.Show)) {
switch (presence.Show) {
case "away":
return "away";
case "chat":
return "free to chat";
case "dnd":
return "do not disturb";
case "xa":
return "extended away";
case "subscribed":
return "subscribed";
default:
return presence.Show;
}
} else {
return "available";
}
} else if (presence.Type == PresenceType.unavailable) {
return "offline";
} else {
throw new ArgumentException("presence type not supported: " + presence.Type);
}
}
开发者ID:jrudolph,项目名称:synapse,代码行数:27,代码来源:Helper.cs
示例4: Main
static void Main(string[] args)
{
var presence = new Presence("clusters/commerce", new Dictionary<string, string>
{
{"RavenDB-Url", new UriBuilder("http", Environment.MachineName, 8080).Uri.ToString()}
}, TimeSpan.FromSeconds(3));
presence.TopologyChanged += (sender, nodeMetadata) =>
{
switch (nodeMetadata.ChangeType)
{
case TopologyChangeType.MasterSelected:
Console.WriteLine("Master selected {0}", nodeMetadata.Uri);
break;
case TopologyChangeType.Discovered:
Console.WriteLine("Found {0}", nodeMetadata.Uri);
break;
case TopologyChangeType.Gone:
Console.WriteLine("Oh no, {0} is gone!", nodeMetadata.Uri);
break;
default:
throw new ArgumentOutOfRangeException();
}
};
presence.Start();
Console.WriteLine(presence.Address);
Console.WriteLine("Waiting...");
Console.ReadLine();
}
开发者ID:calebjenkins,项目名称:Raven.SituationalAwareness,代码行数:28,代码来源:Program.cs
示例5: ContactsNotificationService
static ContactsNotificationService()
{
ContactsNotificationService.OfflinePresence = new Presence()
{
PresenceType = PresenceType.Offline
};
ContactsNotificationService.Contacts = new ConcurrentDictionary<string, ContactsNotificationService.JsFederatedDude>();
}
开发者ID:RevivalCoding,项目名称:Wintermint,代码行数:8,代码来源:ContactsNotificationService.cs
示例6: TestUserHost
public void TestUserHost()
{
PresenceManager pp = new PresenceManager();
Presence pres = new Presence(doc);
JID f = new JID("foo", "bar", null);
pres.From = f;
pp.AddPresence(pres);
Assert.AreEqual("[email protected]", pp[f.Bare].From.ToString());
}
开发者ID:newyorknight,项目名称:jabber.net,代码行数:9,代码来源:PresenceManagerTest.cs
示例7: Pet
public Pet(StatsDK dkstats, DeathKnightTalents t, BossOptions bo, Presence p)
{
m_BO = bo;
m_DKStats = dkstats;
m_Talents = t;
m_Presence = p;
AccumulateStats();
}
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:9,代码来源:Pet.cs
示例8: GetResourceDisplay
public static string GetResourceDisplay(Presence presence)
{
if (presence["ResourceDisplay"] != null && !String.IsNullOrEmpty(presence["ResourceDisplay"].InnerText))
return presence["ResourceDisplay"].InnerText;
else if (!String.IsNullOrEmpty(presence.From.Resource))
return presence.From.Resource;
else
return "Unknown";
}
开发者ID:jrudolph,项目名称:synapse,代码行数:9,代码来源:Helper.cs
示例9: InputArg
internal InputArg(InputArgType type, string name, object defaultValue, Presence presence, string helpString)
{
HasBeenSeen = false;
Type = type;
Name = name;
Value = defaultValue;
Presence = presence;
HelpString = helpString;
HasBeenSeen = false;
}
开发者ID:nathansgreen,项目名称:pserv4,代码行数:10,代码来源:InputArgs.cs
示例10: Proposer
public Proposer(Presence presence, Acceptor myAcceptor, Uri orignatorUri, Uri[] allAcceptors) : base(presence)
{
this.myAcceptor = myAcceptor;
this.orignatorUri = orignatorUri;
this.allAcceptors = allAcceptors;
ballotBase = base.GetHashCode()%25; // effectively a random choice
Register<Promise>(OnPromise);
Register<ProposalSubsumed>(OnProposalSubsumed);
Register<Accepted>(OnAccepted);
}
开发者ID:calebjenkins,项目名称:Raven.SituationalAwareness,代码行数:12,代码来源:Proposer.cs
示例11: Test_Available
public void Test_Available()
{
Presence p = new Presence(doc);
Assert.AreEqual(PresenceType.available, p.Type);
Assert.AreEqual("", p.GetAttribute("type"));
p.Type = PresenceType.unavailable;
Assert.AreEqual(PresenceType.unavailable, p.Type);
Assert.AreEqual("unavailable", p.GetAttribute("type"));
p.Type = PresenceType.available;
Assert.AreEqual(PresenceType.available, p.Type);
Assert.AreEqual("", p.GetAttribute("type"));
}
开发者ID:eNoise,项目名称:cyclops-chat,代码行数:12,代码来源:PresenceTest.cs
示例12: Encoding
public Encoding()
{
_primitiveType = null;
_presence = Presence.Required;
_byteOrder = ByteOrder.LittleEndian;
_minValue = null;
_maxValue = null;
_nullValue = null;
_constValue = null;
_characterEncoding = null;
_epoch = null;
_timeUnit = null;
_semanticType = null;
}
开发者ID:KevinKelley,项目名称:simple-binary-encoding,代码行数:14,代码来源:Encoding.cs
示例13: TestAdd
public void TestAdd()
{
PresenceManager pp = new PresenceManager();
Presence pres = new Presence(doc);
JID f = new JID("foo", "bar", "baz");
pres.From = f;
pp.AddPresence(pres);
Assert.AreEqual("[email protected]/baz", pp[f].From.ToString());
f.Resource = null;
Assert.AreEqual("[email protected]/baz", pp[f].From.ToString());
pres = new Presence(doc);
pres.Status = "wandering";
pres.From = new JID("foo", "bar", "baz");
pp.AddPresence(pres);
Assert.AreEqual("wandering", pp[f].Status);
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:17,代码来源:PresenceManagerTest.cs
示例14: SetOnlineStateFromPresence
/// <summary>
/// Определение статуса юзера.
/// </summary>
/// <param name="pres"></param>
public void SetOnlineStateFromPresence(Presence pres)
{
if (pres.Type == Matrix.Xmpp.PresenceType.unavailable)
StatusOnline = Model.StatusOnline.Offline;
if (pres.Type == Matrix.Xmpp.PresenceType.available)
{
if (pres.Show == Matrix.Xmpp.Show.chat)
StatusOnline = Model.StatusOnline.Chat;
else if (pres.Show == Matrix.Xmpp.Show.away)
StatusOnline = Model.StatusOnline.Away;
else if (pres.Show == Matrix.Xmpp.Show.xa)
StatusOnline = Model.StatusOnline.ExtendedAway;
else if (pres.Show == Matrix.Xmpp.Show.dnd)
StatusOnline = Model.StatusOnline.DoNotDisturb;
else if (pres.Show == Matrix.Xmpp.Show.NONE)
StatusOnline = Model.StatusOnline.Online;
else
StatusOnline = Model.StatusOnline.Online;
}
//определяем в зависимости от статуса, какую иконку статуса отображать
switch (StatusOnline)
{
case StatusOnline.Online:
ImageStatus = @"ContactListSettings/StatusImage/online.png";
break;
case StatusOnline.Offline:
ImageStatus = @"ContactListSettings/StatusImage/offline.png";
break;
case StatusOnline.Away:
ImageStatus = @"ContactListSettings/StatusImage/away.png";
break;
case StatusOnline.ExtendedAway:
ImageStatus = @"ContactListSettings/StatusImage/extendedAway.png";
break;
case StatusOnline.DoNotDisturb:
ImageStatus = @"ContactListSettings/StatusImage/doNotDisturb.png";
break;
case StatusOnline.Chat:
ImageStatus = @"ContactListSettings/StatusImage/chat.png";
break;
}
}
开发者ID:Styort,项目名称:JabberWindowsPhone,代码行数:48,代码来源:Contacts.cs
示例15: GetRosterImageIndex
public static int GetRosterImageIndex(Presence pres)
{
if (pres.Type == PresenceType.Unavailable)
return 0;
switch (pres.Show)
{
case Show.Chat:
return 1;
case Show.Away:
return 2;
case Show.ExtendedAway:
return 2;
case Show.DoNotDisturb:
return 3;
default:
return 1;
}
}
开发者ID:aile54,项目名称:chatclient,代码行数:19,代码来源:Util.cs
示例16: GetRosterImageIndex
public static int GetRosterImageIndex(Presence pres)
{
if (pres.Type == PresenceType.unavailable)
return 0;
switch (pres.Show)
{
case Show.chat:
return 1;
case Show.away:
return 2;
case Show.xa:
return 2;
case Show.dnd:
return 3;
default:
return 1;
}
}
开发者ID:uri247,项目名称:lib,代码行数:19,代码来源:Util.cs
示例17: TestRetrieve
public void TestRetrieve()
{
PresenceManager pp = new PresenceManager();
Presence pres = new Presence(doc);
JID f = new JID("foo", "bar", "baz");
pres.From = f;
pres.Priority = "0";
pp.AddPresence(pres);
Assert.AreEqual("[email protected]/baz", pp[f.Bare].From.ToString());
pres = new Presence(doc);
f = new JID("foo", "bar", "bay");
pres.From = f;
pres.Priority = "1";
pp.AddPresence(pres);
Assert.AreEqual("[email protected]/bay", pp[f.Bare].From.ToString());
pres = new Presence(doc);
pres.From = f;
pres.Type = PresenceType.unavailable;
pp.AddPresence(pres);
Assert.AreEqual("[email protected]/baz", pp[f.Bare].From.ToString());
}
开发者ID:rankida,项目名称:HangoutPhone,代码行数:23,代码来源:PresenceManagerTest.cs
示例18: GetRosterImageIndex
public static int GetRosterImageIndex(Presence pres)
{
if ((pres.get_Type() != 4) && (pres.get_Type() != 6))
{
switch (pres.get_Show())
{
case -1:
return 1;
case 0:
return 2;
case 1:
return 4;
case 2:
return 5;
case 3:
return 3;
}
}
return 0;
}
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:24,代码来源:Util.cs
示例19: Test_Order
public void Test_Order()
{
Presence small = new Presence(doc);
DateTime d = DateTime.Now;
small.IntPriority = 0;
small.Stamp = d;
Presence big = new Presence(doc);
big.IntPriority = 10;
big.Stamp = d.AddSeconds(1);
Assert.IsTrue(small < big);
Assert.IsTrue(big > small);
small.IntPriority = 10;
small.Show = "dnd";
Assert.IsTrue(small < big);
big.Show = "chat";
Assert.IsTrue(small < big);
small.Show = "chat";
Assert.IsTrue(small < big);
}
开发者ID:eNoise,项目名称:cyclops-chat,代码行数:24,代码来源:PresenceTest.cs
示例20: Subscribe
/// <summary>
/// Sends a presence subscription request and updates the roster
/// for a new roster contact.
/// </summary>
/// <param name="to">The JID of the contact (required)</param>
/// <param name="nickname">The nickname to show for the contact.</param>
/// <param name="groups">A list of groups to put the contact in. May be null. Hint: new string[] {"foo", "bar"}</param>
public void Subscribe(JID to, string nickname, string[] groups)
{
Debug.Assert(to != null);
RosterIQ riq = new RosterIQ(Document) {Type = IQType.Set};
Roster r = riq.Instruction;
Item i = r.AddItem();
i.JID = to;
if (nickname != null)
i.Nickname = nickname;
if (groups != null)
{
foreach (string g in groups)
i.AddGroup(g);
}
Write(riq); // don't care about result. we should get a iq/response and a roster push.
Presence pres = new Presence(Document) {To = to, Type = PresenceType.subscribe};
Write(pres);
}
开发者ID:csfmeridian,项目名称:jabber-net,代码行数:27,代码来源:JabberClient.cs
注:本文中的Presence类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论