示例#1
0
        public bool SaveAnswer(PollUserAnswer answer)
        {
            bool ret = false;

            QuestionWorker worker = new QuestionWorker();
            ret = worker.SaveAnswer(answer);

            return ret;
        }
示例#2
0
        public bool SaveAnswer(PollUserAnswer answer)
        {
            bool ret = false;

            string pubnubChannel = answer.QuestionID;
            mrePublish.AddOrUpdate(pubnubChannel, new ManualResetEvent(false), (key, oldState) => new ManualResetEvent(false));
            messagePublished[pubnubChannel] = false;

            pubnub.Publish<string>(pubnubChannel, answer.UserAnswer, PollUserAnswerPublishRegularCallback, PollUserAnswerPublishErrorCallback);
            mrePublish[pubnubChannel].WaitOne(TimeSpan.FromSeconds(10));

            if (messagePublished[pubnubChannel])
            {
                ret = true;
            }

            return ret;
        }