2 using System.Collections.Generic;
\r
3 using System.Collections.ObjectModel;
\r
8 public class NTHistory
\r
10 NTBoard.DelegateMsgOnNotifyBoardUpdate mOnNotifyBoardUpdate;
\r
12 private static string mStrState = string.Empty;
\r
13 public static string getLastState()
\r
19 mOnNotifyBoardUpdate
\r
20 = new NTBoard.DelegateMsgOnNotifyBoardUpdate(OnNotifyBoardUpdate);
\r
23 private ObservableCollection<NTHistoryThread> mThreadList = new ObservableCollection<NTHistoryThread>();
\r
24 public ObservableCollection<NTHistoryThread> getThreadList()
\r
29 public void onDetach()
\r
31 Dictionary<string, NTBoard> boardDic = new Dictionary<string,NTBoard>();
\r
32 foreach (NTHistoryThread ht in mThreadList)
\r
34 if(boardDic.ContainsKey(ht.BoardName))
\r
36 NTBoard board = NTDataRoot.getBoardByName(ht.BoardName);
\r
39 boardDic.Add(ht.BoardName, board);
\r
41 foreach (NTBoard board in boardDic.Values)
\r
43 if(mOnNotifyBoardUpdate != null)
\r
44 board.OnNotifyBoardUpdate -= mOnNotifyBoardUpdate;
\r
47 mThreadList.Clear();
\r
50 void OnNotifyBoardUpdate(NTBoard board)
\r
52 if (mThreadList == null)
\r
55 foreach (NTHistoryThread ht in mThreadList)
\r
57 if (board.mName.Equals(ht.BoardName))
\r
64 public bool parse(string source)
\r
68 if (source == null || source.Length == 0)
\r
71 string[] lines = NTTextUtiles.splitLine(source);
\r
72 int lineLen = lines.Length;
\r
76 if (!int.TryParse(lines[0], out retVal))
\r
82 mStrState = lines[1];
\r
88 Dictionary<string, NTBoard> boardDic = new Dictionary<string, NTBoard>();
\r
90 for (int i = 2; i < lineLen; i++)
\r
92 string line = lines[i];
\r
93 string[] values = line.Split(NTTextUtiles.COMMA_VALUE);
\r
94 if (values.Length != 3)
\r
99 if (NTUserPreference.AESEnabled)
\r
101 boardName = NTTextUtiles.aesDecodeBase64URL(values[0]);
\r
102 datName = NTTextUtiles.aesDecodeBase64URL(values[1]);
\r
106 boardName = NTTextUtiles.decodeBase64URL(values[0]);
\r
107 datName = NTTextUtiles.decodeBase64URL(values[1]);
\r
109 string dateTimeDescription = values[2];
\r
111 NTHistoryThread ht = new NTHistoryThread(boardName, datName, dateTimeDescription);
\r
113 mThreadList.Add(ht);
\r
115 if (!boardDic.ContainsKey(boardName))
\r
117 NTBoard board = NTDataRoot.getBoardByName(boardName);
\r
119 boardDic.Add(boardName, board);
\r
123 foreach (NTBoard board in boardDic.Values)
\r
125 if (board.mDataInit)
\r
127 OnNotifyBoardUpdate(board);
\r
131 board.Update(mOnNotifyBoardUpdate);
\r