コード例 #1
0
        public BaseQandAPageVM(string dbcontextName) : base(dbcontextName)
        {
            //Commands
            SaveFormCmd      = new SaveCmd(this);
            DeleteCmd        = new DeleteCmd(this);
            UploadImageCmd   = new UploadImageCmd(this);
            ToggleMarkQCmd   = new ToggleMarkQCmd(this);
            ToggleMarkACmd   = new ToggleMarkACmd(this);
            CancelCmd        = new CancelCmd(this);
            NewModeCmd       = new NewModeCmd(this);
            PostCmd          = new PostCmd(this);
            DeleteCommentCmd = new DeleteCommentCmd(this);
            EditCommentCmd   = new EditCommentCmd(this);

            //setup
            QVisConDTO            = new QuestionStateConverterDTO();
            AVisConDTO            = new AnswerStateConverterDTO();
            AnswerSearchTxt       = "";
            QuestionSearchTxt     = "";
            rowLimit              = 20;
            openFileDialog        = new OpenFileDialog();
            openFileDialog.Title  = "Select a picture";
            openFileDialog.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                                    "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                                    "Portable Network Graphic (*.png)|*.png";

            Mediator.Register(MediatorChannels.PoolingUpdate.ToString(), PoolingUpdate);
        }
コード例 #2
0
        public object Convert(object obj, Type targetType, object parameter, CultureInfo culture)
        {
            AnswerStateConverterDTO dto = (AnswerStateConverterDTO)obj;

            if (dto.Answer == null || dto.User == null)
            {
                return(false);
            }
            if (dto.Answer.AnsweredBy == null)
            {
                return(false);
            }
            //if roles match required make the item visible
            if (dto.User.Id == dto.Answer.AnsweredBy.Id)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }