예제 #1
0
 public void Dispose()
 {
     Response.Dispose();
     ContentCollection.Clear();
     AdsCollection.Clear();
     PricesCollection.Clear();
     LocationCollection.Clear();
     PublishingTimeCollection.Clear();
     IndividualAdsUrlsCollection.Clear();
     IndividualAdsNamesCollection.Clear();
 }
예제 #2
0
        private void OnOptionSelectionChange()
        {
            try
            {
                //reset PageIndex=1,when reload is needed.
                _isResetRequired = true;

                ContentCollection.Clear();
                ContentCollection = null;

                ContentCollection = new IncrementalLoadingCollection <Content>((cancellationToken, count)
                                                                               => Task.Run(GetMoreArticleData, cancellationToken));
            }
            catch (Exception)
            {
                //log exception
            }
        }
예제 #3
0
        private void ReadBoardInfo(PTTClient client, LiPttEventArgs e)
        {
            ScreenBuffer screen = client.Screen;

            if (e.State == PttState.BoardInfomation)
            {
                LiPTT.PttEventEchoed -= ReadBoardInfo;

                var action = Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    var Board = CurrentBoard;

                    //看板名稱
                    string str  = screen.ToString(3);
                    Match match = new Regex(LiPTT.bracket_regex).Match(str);
                    if (match.Success)
                    {
                        Board.Name = str.Substring(match.Index + 1, match.Length - 2);
                        Board.Nick = LiPTT.GetBoardNick(Board.Name);
                    }

                    //看板分類 中文敘述
                    Board.Category    = screen.ToString(5, 15, 4);
                    Board.Description = client.Screen.ToString(5, 22, screen.Width - 22).Replace('\0', ' ').Trim();

                    //版主名單
                    str = screen.ToString(6, 15, screen.Width - 15).Replace('\0', ' ').Trim();
                    if (!new Regex(LiPTT.bound_regex).Match(str).Success) //(無)
                    {
                        Board.Leaders = str.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    }

                    if (screen.ToString(7, 25, 4) == "公開")
                    {
                        Board.公開 = true;
                    }

                    if (screen.ToString(8, 12, 4) == "可以")
                    {
                        Board.可進入十大排行榜 = true;
                    }

                    if (screen.ToString(9, 5, 4) == "開放")
                    {
                        Board.開放非看板會員發文 = true;
                    }

                    if (screen.ToString(10, 5, 4) == "開放")
                    {
                        Board.開放回文 = true;
                    }

                    if (screen.ToString(11, 5, 4) == "開放")
                    {
                        Board.開放自刪 = true;
                    }

                    if (screen.ToString(12, 5, 4) == "開放")
                    {
                        Board.開放推文 = true;
                    }

                    if (screen.ToString(13, 5, 4) == "開放")
                    {
                        Board.開放噓文 = true;
                    }

                    if (screen.ToString(14, 5, 4) == "開放")
                    {
                        Board.開放快速連推 = true;
                    }

                    if (screen.ToString(15, 12, 4) == "自動")
                    {
                        Board.IPVisible = true;
                    }

                    if (screen.ToString(16, 12, 4) == "對齊")
                    {
                        Board.自動對齊 = true;
                    }

                    if (screen.ToString(17, 10, 2) == "可")
                    {
                        Board.板主可刪除違規文字 = true;
                    }

                    if (screen.ToString(18, 14, 2) == "會")
                    {
                        Board.轉文自動記錄 = true;
                    }

                    if (screen.ToString(19, 5, 2) == "已")
                    {
                        Board.冷靜模式 = true;
                    }

                    if (screen.ToString(20, 5, 4) == "允許")
                    {
                        Board.允許十八歲進入 = true;
                    }

                    //發文限制 - 登入次數
                    str   = screen.ToString(12);
                    match = new Regex(@"\d+").Match(str);
                    if (match.Success)
                    {
                        try
                        {
                            Board.LimitLogin = Convert.ToInt32(str.Substring(match.Index, match.Length));
                        }
                        catch { Debug.WriteLine(str.Substring(match.Index, match.Length)); }
                    }

                    //發文限制 - 退文篇數
                    str   = screen.ToString(13);
                    match = new Regex(@"\d+").Match(str);
                    if (match.Success)
                    {
                        try
                        {
                            Board.LimitReject = Convert.ToInt32(str.Substring(match.Index, match.Length));
                        }
                        catch { Debug.WriteLine(str.Substring(match.Index, match.Length)); }
                    }

                    if (LiPTT.CacheBoard)
                    {
                        ControlVisible = true;
                        Window.Current.CoreWindow.KeyDown        += CoreWindow_KeyDown;
                        Window.Current.CoreWindow.PointerPressed += Board_PointerPressed;
                    }
                    else
                    {
                        ContentCollection.Clear();
                        LiPTT.PttEventEchoed += InitBoard;
                    }

                    LiPTT.PressAnyKey();
                });
            }
        }