DetachSubredditMessage() публичный Метод

public DetachSubredditMessage ( ) : void
Результат void
Пример #1
0
        private void ChangeSubreddit(SelectSubredditMessage message, bool fireSubredditsChanged = true)
        {
            int  indexToPosition;
            bool foundExisting = FindSubredditMessageIndex(message, out indexToPosition);

            if (!foundExisting)
            {
                var newReddit = new RedditViewModel(_baconProvider);
                newReddit.DetachSubredditMessage();
                newReddit.AssignSubreddit(message);
                if (PivotItems.Count > 0)
                {
                    PivotItems.Insert(PivotItems.Count - 1, newReddit);
                }
                else
                {
                    PivotItems.Add(newReddit);
                }
                _subreddits.Add(message.Subreddit);
                RaisePropertyChanged("PivotItems");
                indexToPosition = PivotItems.Count - 2;
            }

            if (fireSubredditsChanged)
            {
                RaisePropertyChanged("Subreddits");

                Messenger.Default.Send <SelectIndexMessage>(
                    new SelectIndexMessage
                {
                    TypeContext = typeof(MainPageViewModel),
                    Index       = indexToPosition
                }
                    );
            }
        }
Пример #2
0
        private void ChangeSubreddit(SelectSubredditMessage message, bool fireSubredditsChanged = true)
        {
            int indexToPosition;
            bool foundExisting = FindSubredditMessageIndex(message, out indexToPosition);

            if (!foundExisting)
            {
                var newReddit = new RedditViewModel(_baconProvider);
                newReddit.DetachSubredditMessage();
                newReddit.AssignSubreddit(message);
                
                if (PivotItems.Count > 0)
                    PivotItems.Insert(PivotItems.Count, newReddit);
                else
                    PivotItems.Add(newReddit);
                _subreddits.Add(message.Subreddit);
                indexToPosition = PivotItems.Count - 1;
            }

            if (fireSubredditsChanged)
            {
                Messenger.Default.Send<SelectIndexMessage>(
                    new SelectIndexMessage
                    {
                        TypeContext = typeof(MainPageViewModel),
                        Index = indexToPosition
                    }
                );
            }
        }