Exemple #1
0
        /// <summary>
        /// 建立猜謎View Model.
        /// <para>當猜謎使用完畢後需要呼叫PuzzleCenterVM.Close成員方法進行關閉,才能建立新的猜謎</para>
        /// </summary>
        /// <returns>回傳新的猜謎,若猜謎尚未關閉則回傳NULL</returns>
        public PuzzleCenterVM CreatePuzzleCenter()
        {
            if (_puzzleCenterVM == null ||
                _puzzleCenterVM.IsClosed)
            {
                _puzzleCenterVM = new PuzzleCenterVM();
                return(_puzzleCenterVM);
            }

            return(null);
        }
Exemple #2
0
        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 = "已停止";
        }