Inheritance: INotificationId
        protected override NotificationViewModel Init(Notification dto)
        {
            base.Init(dto);

            Board = ((CloseBoardNotification) dto).Data.Board;

            return this;
        }
        protected override NotificationViewModel Init(Notification dto)
        {
            base.Init(dto);

            var realDto = (AddedToBoardNotification) dto;

            Board = realDto.Data.Board;

            return this;
        }
        protected override NotificationViewModel Init(Notification dto)
        {
            base.Init(dto);

            var x = (ChangeCardNotification) dto;
            Card = x.Data.Card;
            Board = x.Data.Board;

            return this;
        }
        protected override NotificationViewModel Init(Notification dto)
        {
            base.Init(dto);

            var x = (CommentCardNotification) dto;
            Card = x.Data.Card;
            Board = x.Data.Board;
            Text = x.Data.Text;

            return this;
        }
示例#5
0
        protected virtual NotificationViewModel Init(Notification dto)
        {
            Id = dto.Id;
            IdMemberCreator = dto.IdMemberCreator;
            MemberCreator = dto.MemberCreator.FullName;
            MemberCreatorAvatarUrl = dto.MemberCreator.AvatarHash.ToAvatarUrl();
            Date = dto.Date;
            Unread = dto.Unread;

            return this;
        }
        protected override NotificationViewModel Init(Notification dto)
        {
            base.Init(dto);

            var x = (CardMovedNotification)dto;
            Card = x.Data.Card;
            Board = x.Data.Board;
            FromList = x.Data.ListBefore;
            ToList = x.Data.ListAfter;

            return this;
        }
示例#7
0
        public static May<NotificationViewModel> Create(Notification dto)
        {
            // Factory method... use convention '{NotifictionName}' + 'ViewModel'
            var dtoType = dto.GetType();
            var vmName = "trello.ViewModels.Notifications." + dtoType.Name + "ViewModel";
            var type = Assembly.GetExecutingAssembly().GetType(vmName, false);
            if (type == null || type == typeof(NotificationViewModel)) // abstract type
                return May<NotificationViewModel>.NoValue;

            // Try to use the container
            var instance = IoC.GetInstance(type, null) as NotificationViewModel;
            if (instance == null)
                return May<NotificationViewModel>.NoValue;

            return instance.Init(dto);
        }