本文整理汇总了C#中BoxSocial.Internals.ItemKey.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ItemKey.GetType方法的具体用法?C# ItemKey.GetType怎么用?C# ItemKey.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BoxSocial.Internals.ItemKey
的用法示例。
在下文中一共展示了ItemKey.GetType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestItem
public void RequestItem(ItemKey itemKey)
{
if (itemKey.TypeId == 0)
{
return;
}
if (!typesAccessed.ContainsKey(itemKey.TypeId))
{
// We need to make sure that the application is loaded
if (itemKey.GetType(core).ApplicationId > 0)
{
core.ItemCache.RegisterType(typeof(ApplicationEntry));
ItemKey applicationKey = new ItemKey(itemKey.GetType(core).ApplicationId, ItemType.GetTypeId(core, typeof(ApplicationEntry)));
core.ItemCache.RequestItem(applicationKey);
ApplicationEntry ae = (ApplicationEntry)core.ItemCache[applicationKey];
typesAccessed.Add(itemKey.TypeId, ae.Assembly.GetType(itemKey.GetType(core).TypeNamespace));
}
else
{
try
{
typesAccessed.Add(itemKey.TypeId, Type.GetType(itemKey.GetType(core).TypeNamespace));
}
catch
{
HttpContext.Current.Response.Write(itemKey.ToString());
HttpContext.Current.Response.End();
}
}
}
NumberedItemId loadedId = new NumberedItemId(itemKey.Id, itemKey.TypeId);
if (!(batchedItemIds.Contains(loadedId) || itemsCached.ContainsKey(loadedId)))
{
batchedItemIds.Add(loadedId);
}
}
示例2: AdjustCommentCount
public void AdjustCommentCount(ItemKey itemKey, int adjustment)
{
ItemInfo ii = null;
if (itemKey.GetType(this).Commentable)
{
try
{
ii = new ItemInfo(this, itemKey);
}
catch (InvalidIteminfoException)
{
ii = ItemInfo.Create(this, itemKey);
}
ii.AdjustComments(adjustment);
ii.Update();
}
else
{
throw new InvalidItemException();
}
}
示例3: Reflect
public static NumberedItem Reflect(Core core, ItemKey ik)
{
if (ik.GetType(core) != null)
{
if (ik.GetType(core).IsPrimitive)
{
core.PrimitiveCache.LoadPrimitiveProfile(ik);
return core.PrimitiveCache[ik];
}
}
if (core.ItemCache.ContainsItem(ik))
{
return core.ItemCache[ik];
}
if (core == null)
{
throw new NullCoreException();
}
Type tType = null;
if (ik.GetType(core).ApplicationId > 0)
{
core.ItemCache.RegisterType(typeof(ApplicationEntry));
ItemKey applicationKey = new ItemKey(ik.GetType(core).ApplicationId, ItemKey.GetTypeId(core, typeof(ApplicationEntry)));
core.ItemCache.RequestItem(applicationKey);
ApplicationEntry ae = (ApplicationEntry)core.ItemCache[applicationKey];
tType = ae.Assembly.GetType(ik.GetType(core).TypeNamespace);
}
else
{
tType = Type.GetType(ik.GetType(core).TypeNamespace);
}
return (Activator.CreateInstance(tType, new object[] { core, ik.Id }) as NumberedItem);
}
示例4: ItemUnsubscribed
public void ItemUnsubscribed(ItemKey itemKey, User subscriber)
{
if (unsubscribeHandles.ContainsKey(itemKey.TypeId))
{
unsubscribeHandles[itemKey.TypeId](new ItemUnsubscribedEventArgs(subscriber, itemKey));
}
else
{
if (!itemKey.GetType(this).Subscribeable)
{
throw new InvalidItemException();
}
}
}
示例5: SendNotification
public void SendNotification(Core core, User actionBy, User receiver, ItemKey itemOwnerKey, ItemKey itemKey, string verb, string url, string action)
{
if (canNotify(core, receiver))
{
Notification notification = Notification.Create(core, this, actionBy, receiver, itemOwnerKey, itemKey, verb, url, action);
if (receiver.UserInfo.EmailNotifications)
{
// Header so we can use the same emailBody for multiple subscribers
Template emailTemplate = new Template(core.TemplateEmailPath, "notification.html");
emailTemplate.Parse("SITE_TITLE", core.Settings.SiteTitle);
emailTemplate.Parse("U_SITE", core.Hyperlink.StripSid(core.Hyperlink.AppendAbsoluteSid(core.Hyperlink.BuildHomeUri())));
emailTemplate.Parse("TO_NAME", receiver.DisplayName);
core.Display.ParseBbcode(emailTemplate, "NOTIFICATION_MESSAGE", notification.NotificationString, receiver, false, string.Empty, string.Empty, true);
// TODO parse action links
if (itemKey.GetType(core).Notifiable)
{
Dictionary<string, string> actions = notification.NotifiedItem.GetNotificationActions(action);
foreach (string a in actions.Keys)
{
VariableCollection actionsVariableCollection = emailTemplate.CreateChild("actions_list");
actionsVariableCollection.Parse("ACTION", actions[a]);
actionsVariableCollection.Parse("U_ACTION", core.Hyperlink.AppendAbsoluteSid(core.Hyperlink.AppendNvid(notification.NotifiedItem.GetNotificationActionUrl(a), notification.VerificationString)));
}
}
core.Email.SendEmail(receiver.UserInfo.PrimaryEmail, HttpUtility.HtmlDecode(core.Bbcode.Flatten(HttpUtility.HtmlEncode(notification.NotificationString))), emailTemplate);
}
}
}