Exemplo n.º 1
0
        public void ResetCurrentAccount()
        {
            var id = _varsService.GetVar(_currentAccountVar);

            if (id == null)
            {
                return;
            }
            _varsService.SetVar(_currentAccountVar, null);
        }
Exemplo n.º 2
0
        public async Task Init()
        {
            await LoadForumsAsync();

            var selectedIDs = FullMsgID.TryParse(_varsService.GetVar(_curSelectionVar));

            if (selectedIDs != null)
            {
                var forum = Forums.SelectMany(fg => fg.Forums).FirstOrDefault(f => f.ID == selectedIDs.ForumID);
                SelectedForum = forum;
                if (selectedIDs.MessageID.HasValue)
                {
                    await LoadTopicsAsync(selectedIDs.ForumID);

                    var topic = Topics.FirstOrDefault(t =>
                                                      t.Message.ID == selectedIDs.TopicID.GetValueOrDefault(selectedIDs.MessageID.Value));
                    if (topic != null)
                    {
                        await LoadRepliesAsync(topic);
                        MessageNode FindMessage(int id, MessageNode m) =>
                        m.Message.ID == id ? m : m.Children.Select(mc => FindMessage(id, mc)).FirstOrDefault(mc => mc != null);

                        Message = FindMessage(selectedIDs.MessageID.Value, topic);
                    }
                }
            }
        }