当前位置: 首页>>代码示例>>C#>>正文


C# ItemKey.GetType方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:39,代码来源:NumberedItemsCache.cs

示例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();
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:23,代码来源:Core.cs

示例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);
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:39,代码来源:NumberedItem.cs

示例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();
         }
     }
 }
开发者ID:smithydll,项目名称:boxsocial,代码行数:14,代码来源:Core.cs

示例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);
                }
            }
        }
开发者ID:smithydll,项目名称:boxsocial,代码行数:34,代码来源:ApplicationEntry.cs


注:本文中的BoxSocial.Internals.ItemKey.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。