Esempio n. 1
0
        public ForumListPage(Api.Client client)
        {
            Client = client;

            InitializeComponent();

            forumList.RefreshCommand = new Command(Fetch);

            FetchBegin();
        }
        public ThreadListPage(Api.Client client, string forumId)
        {
            Client         = client;
            currentForumId = forumId;
            currentPage    = 0;

            InitializeComponent();
            threadList.RefreshCommand = new Command(PullToRefresh);

            FetchBegin();
        }
Esempio n. 3
0
        public PostListPage(Api.Client client, Api.Thread info)
        {
            Client     = client;
            threadInfo = info;

            InitializeComponent();

            scrollView.Scrolled += OnScrolled;
            content.Children.Add(new Label()
            {
                Text           = threadInfo.Title,
                FontAttributes = FontAttributes.Bold
            });

            Fetch();
        }
Esempio n. 4
0
        private void OnItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            var item = e.SelectedItem as MasterPageItem;

            if (item != null)
            {
                var client = new Api.Client(item.Name, item.Config);
                if (client.IsAuthed())
                {
                    (Application.Current as App).ShowForumListPage(client);
                }
                else
                {
                    (Application.Current as App).ShowAccountPage(client);
                }

                masterPage.ListView.SelectedItem = null;
                IsPresented = false;
            }
        }
Esempio n. 5
0
 public void ShowPostListPage(Api.Client client, Api.Thread tinfo)
 {
     (mainPage.Detail as NavigationPage).PushAsync(new PostListPage(client, tinfo));
 }
Esempio n. 6
0
 public void ShowThreadListPage(Api.Client client, string fid)
 {
     (mainPage.Detail as NavigationPage).PushAsync(new ThreadListPage(client, fid));
 }
Esempio n. 7
0
 public void ShowForumListPage(Api.Client client)
 {
     mainPage.Detail = new NavigationPage(new ForumListPage(client));
 }
Esempio n. 8
0
 public void ShowAccountPage(Api.Client client)
 {
     mainPage.Detail = new NavigationPage(new AccountPage(client));
 }
Esempio n. 9
0
        public static async void Run(System.Threading.Semaphore sem, string[] args)
        {
            try
            {
                if (args.Length >= 2)
                {
                    var config = Api.Config.LoadConfig(args[0]);
                    var client = new Api.Client(args[0], config);
                    if (args[1] == "forum")
                    {
                        var list = await client.GetForumList();

                        if (list != null)
                        {
                            foreach (var item in list)
                            {
                                Console.WriteLine("Forum {0} {1}", item.Id, item.Name);
                            }
                        }
                    }
                    else if (args[1] == "thread")
                    {
                        if (args.Length >= 4)
                        {
                            var list = await client.GetForum(args[2], int.Parse(args[3]));

                            if (list != null)
                            {
                                foreach (var item in list)
                                {
                                    Console.WriteLine("Thread {0} {1} {2}", item.Id, item.PostAuthor, item.Title);
                                }
                            }
                        }
                    }
                    else if (args[1] == "post")
                    {
                        if (args.Length >= 4)
                        {
                            var list = await client.GetThread(args[2], int.Parse(args[3]));

                            if (list != null)
                            {
                                foreach (var item in list)
                                {
                                    Console.WriteLine("Post {0} {1}", item.PostAuthor, item.PostTime);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (args.Length >= 3)
                        {
                            var doc = await client.GetHtmlDocument(args[1], false);

                            if (doc != null)
                            {
                                var nodes = doc.DocumentNode.SelectNodes(args[2]);
                                if (nodes == null)
                                {
                                    Console.WriteLine("no match node");
                                }
                                else
                                {
                                    foreach (var node in nodes)
                                    {
                                        Console.WriteLine("== START [{0}]", node.XPath);
                                        new Api.NodeParser().PrintNode(node);
                                        Console.WriteLine("== END   [{0}]", node.XPath);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception  : {0}", e.Message);
                Console.WriteLine("StackTrace : {0}", e.StackTrace);
            }
            sem.Release(1);
        }
Esempio n. 10
0
 public AccountPage(Api.Client client)
 {
     Client = client;
     InitializeComponent();
     UsernameEntry.Keyboard = Keyboard.Create(0);
 }