Beispiel #1
0
        public void initForum()
        {
            List <ForumData> list = new List <ForumData>();

            foreach (ForumData data in this.forumArray)
            {
                if ((data.areaID == this.selectedAreaID) && (data.areaType == this.selectedAreaType))
                {
                    list.Add(data);
                }
            }
            list.Sort(this.forumComparer);
            bool flag = false;

            foreach (ForumData data2 in list)
            {
                if (data2.forumID == this.currentlySelectedForum)
                {
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                if (list.Count > 0)
                {
                    this.currentlySelectedForum = list[0].forumID;
                }
                else
                {
                    this.currentlySelectedForum = -1L;
                }
            }
            if (this.currentlySelectedForum >= 0L)
            {
                RemoteServices.Instance.set_GetForumThreadList_UserCallBack(new RemoteServices.GetForumThreadList_UserCallBack(this.forumThreadListCallback));
                if ((this.forumThreadArray[this.currentlySelectedForum] == null) || (((ForumInfoData)this.forumThreadArray[this.currentlySelectedForum]).lastTime.Year < 0x76c))
                {
                    RemoteServices.Instance.GetForumThreadList(this.currentlySelectedForum, DateTime.MinValue, true);
                }
                else
                {
                    TimeSpan span = (TimeSpan)(DateTime.Now - ((ForumInfoData)this.forumThreadArray[this.currentlySelectedForum]).lastTime);
                    if (span.TotalMinutes > 1.0)
                    {
                        ForumInfoData data3 = (ForumInfoData)this.forumThreadArray[this.currentlySelectedForum];
                        RemoteServices.Instance.GetForumThreadList(this.currentlySelectedForum, data3.lastTime, false);
                    }
                }
            }
            this.updateForum();
            this.mainBackgroundImage.invalidate();
        }
Beispiel #2
0
 public void importThreadList(List <ForumThreadInfo> threadData, long forumID)
 {
     if (threadData != null)
     {
         if (this.forumThreadArray[forumID] == null)
         {
             ForumInfoData data = new ForumInfoData {
                 forumID = forumID
             };
             this.forumThreadArray[forumID] = data;
         }
         ForumInfoData data2 = (ForumInfoData)this.forumThreadArray[forumID];
         foreach (ForumThreadInfo info in threadData)
         {
             ForumThreadData item = new ForumThreadData {
                 title    = info.threadTitle,
                 threadID = info.threadID,
                 lastTime = info.lastDate,
                 userName = info.userName,
                 read     = info.threadRead
             };
             if (item.lastTime > data2.lastTime)
             {
                 data2.lastTime = item.lastTime;
             }
             bool flag = false;
             for (int i = 0; i < data2.forumThreads.Count; i++)
             {
                 ForumThreadData data4 = data2.forumThreads[i];
                 if (data4.threadID == item.threadID)
                 {
                     data2.forumThreads[i] = item;
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 data2.forumThreads.Add(item);
             }
         }
         data2.forumThreads.Sort(this.threadComparer);
         this.updateForum();
     }
 }
Beispiel #3
0
 public void deleteForumThreadCallback(DeleteForumThread_ReturnType returnData)
 {
     if (returnData.Success && (returnData.threadID >= 0L))
     {
         ForumInfoData data = (ForumInfoData)this.forumThreadArray[returnData.forumID];
         if (data != null)
         {
             foreach (ForumThreadData data2 in data.forumThreads)
             {
                 if (data2.threadID == returnData.threadID)
                 {
                     data.forumThreads.Remove(data2);
                     this.updateForum();
                     break;
                 }
             }
         }
     }
 }
Beispiel #4
0
        public void updateForum()
        {
            this.wallScrollArea.clearControls();
            int y = 0;

            this.lineList.Clear();
            if (this.currentlySelectedForum >= 0L)
            {
                ForumInfoData data = (ForumInfoData)this.forumThreadArray[this.currentlySelectedForum];
                if ((data != null) && (data.forumThreads != null))
                {
                    int position = 0;
                    foreach (ForumThreadData data2 in data.forumThreads)
                    {
                        ForumThreadLine control = new ForumThreadLine();
                        if (y != 0)
                        {
                            y += 5;
                        }
                        control.Position = new Point(0, y);
                        control.init(data2, position, this);
                        this.wallScrollArea.addControl(control);
                        y += control.Height;
                        this.lineList.Add(control);
                        position++;
                    }
                }
            }
            this.wallScrollArea.Size = new Size(this.wallScrollArea.Width, y);
            if (y < this.wallScrollBar.Height)
            {
                this.wallScrollBar.Visible = false;
            }
            else
            {
                this.wallScrollBar.Visible         = true;
                this.wallScrollBar.NumVisibleLines = this.wallScrollBar.Height;
                this.wallScrollBar.Max             = y - this.wallScrollBar.Height;
            }
            this.mainBackgroundImage.invalidate();
        }