/// <summary> /// 建立投票所View Model. /// <para>當投票所使用完畢後需要呼叫VotingCenterVM.Close成員方法進行關閉,才能建立新的投票所</para> /// </summary> /// <returns>回傳新的投票所,若投票所尚未關閉則回傳NULL</returns> public VotingCenterVM CreateVotingCenter() { if (_votingCenterVM == null || _votingCenterVM.IsClosed) { _votingCenterVM = new VotingCenterVM(); return(_votingCenterVM); } return(null); }
public MainWindowVM() { _cmtLoader = new CommentLoader(); _commentColle = new ObservableCollection <CommentVM>(); this.CommentColle = CollectionViewSource.GetDefaultView(_commentColle); BindingOperations.EnableCollectionSynchronization(_commentColle, _lockCommentColleObj); _votingCenterVM = null; _puzzleCenterVM = null; _authorTable = new Dictionary <string, string>(); _isStopped = true; _cmtLoader.OnStatusChanged += On_CommetLoader_StatusChanged; _cmtLoader.OnError += On_CommentLoader_Error; _cmtLoader.OnCommentsReceive += On_CommentLoader_CommentsReceive; this.StatusText = "已停止"; }