Beispiel #1
0
 protected RTQuickPoll(SerializationInfo info, StreamingContext context)
 {
     this.results    = (int[])info.GetValue("results", typeof(int[]));
     this.deckGuid   = new Guid(info.GetString("deckGuid"));
     this.slideIndex = info.GetInt32("slideIndex");
     this.style      = (QuickPollStyle)info.GetInt32("style");
 }
        /// <summary>
        /// Get the heading strings for a QuickPoll Style.
        /// </summary>
        /// <param name="style"></param>
        /// <returns></returns>
        public static List <string> GetVoteStringsFromStyle(QuickPollStyle style)
        {
            List <string> strings = new List <string>();

            switch (style)
            {
            case QuickPollStyle.YesNo:
                strings.Add("Yes");
                strings.Add("No");
                break;

            case QuickPollStyle.YesNoBoth:
                strings.Add("Yes");
                strings.Add("No");
                strings.Add("Both");
                break;

            case QuickPollStyle.YesNoNeither:
                strings.Add("Yes");
                strings.Add("No");
                strings.Add("Neither");
                break;

            case QuickPollStyle.ABC:
                strings.Add("A");
                strings.Add("B");
                strings.Add("C");
                break;

            case QuickPollStyle.ABCD:
                strings.Add("A");
                strings.Add("B");
                strings.Add("C");
                strings.Add("D");
                break;

            case QuickPollStyle.ABCDE:
                strings.Add("A");
                strings.Add("B");
                strings.Add("C");
                strings.Add("D");
                strings.Add("E");
                break;

            case QuickPollStyle.ABCDEF:
                strings.Add("A");
                strings.Add("B");
                strings.Add("C");
                strings.Add("D");
                strings.Add("E");
                strings.Add("F");
                break;

            case QuickPollStyle.Custom:
                // Do Nothing for now
                break;
            }

            return(strings);
        }
Beispiel #3
0
 public RTQuickPoll(QuickPollStyle style, int[] results, Guid deckGuid, int slideIndex)
 {
     this.style      = style;
     this.results    = results;
     this.deckGuid   = deckGuid;
     this.slideIndex = slideIndex;
 }
 /// <summary>
 /// Apply new results to the QuickPoll
 /// </summary>
 /// <param name="results"></param>
 public void Update(int styleAsInt, int[] results)
 {
     lock (this) {
         m_QuickPollStyle = (QuickPollStyle)styleAsInt;
         m_Results        = results;
     }
 }
Beispiel #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="slideId"></param>
 /// <param name="style"></param>
 public QuickPollModel(Guid id, Guid slideId, QuickPollStyle style)
 {
     this.m_Id = id;
     this.m_OriginalSlideId  = slideId;
     this.m_QuickPollStyle   = style;
     this.m_QuickPollResults = new QuickPollResultCollection(this, "QuickPollResults");
     this.m_Changed          = false;
     this.m_Choices          = new string[0];
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="slideId"></param>
 /// <param name="style"></param>
 public QuickPollModel( Guid id, Guid slideId, QuickPollStyle style )
 {
     this.m_Id = id;
     this.m_OriginalSlideId = slideId;
     this.m_QuickPollStyle = style;
     this.m_QuickPollResults = new QuickPollResultCollection( this, "QuickPollResults");
     this.m_Changed = false;
     this.m_Choices = new string[0];
 }
        /// <summary>
        /// Constructor
        /// </summary>
        public QuickPollModel( Guid id, QuickPollModel m )
        {
            using( Synchronizer.Lock( m.SyncRoot ) ) {
                this.m_Id = id;
                this.m_OriginalSlideId = m.OriginalSlideId;
                this.m_QuickPollStyle = m.PollStyle;
                this.m_QuickPollResults = new QuickPollResultCollection( this, "QuickPollResults" );
                this.m_Changed = false;
                this.m_Choices = (string[])m.m_Choices.Clone();

                // Update the results
                foreach( QuickPollResultModel res in m.QuickPollResults ) {
                    this.AddResult( res );
                }
            }
        }
 public QuickPollModel( SerializedPacket p )
 {
     SerializedPacket.VerifyPacket( p, this.GetClassId() );
     this.m_Id = SerializedPacket.DeserializeGuid( p.GetNextPart() );
     this.m_OriginalSlideId = SerializedPacket.DeserializeGuid( p.GetNextPart() );
     this.m_QuickPollStyle = (QuickPollStyle)SerializedPacket.DeserializeInt( p.GetNextPart() );
     this.m_Changed = SerializedPacket.DeserializeBool( p.GetNextPart() );
     this.m_Choices = new string[SerializedPacket.DeserializeInt( p.GetNextPart() )];
     for( int i = 0; i < this.m_Choices.Length; i++ ) {
         this.m_Choices[i] = SerializedPacket.DeserializeString( p.GetNextPart() );
     }
     int cnt = SerializedPacket.DeserializeInt( p.GetNextPart() );
     this.m_QuickPollResults = new QuickPollResultCollection( this, "QuickPollResults" );
     for( int j = 0; j < cnt; j++ ) {
         this.AddResult( new QuickPollResultModel( p.GetNextPart() ) );
     }
 }
Beispiel #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        public QuickPollModel(Guid id, QuickPollModel m)
        {
            using (Synchronizer.Lock(m.SyncRoot)) {
                this.m_Id = id;
                this.m_OriginalSlideId  = m.OriginalSlideId;
                this.m_QuickPollStyle   = m.PollStyle;
                this.m_QuickPollResults = new QuickPollResultCollection(this, "QuickPollResults");
                this.m_Changed          = false;
                this.m_Choices          = (string[])m.m_Choices.Clone();

                // Update the results
                foreach (QuickPollResultModel res in m.QuickPollResults)
                {
                    this.AddResult(res);
                }
            }
        }
Beispiel #10
0
        public QuickPollModel(SerializedPacket p)
        {
            SerializedPacket.VerifyPacket(p, this.GetClassId());
            this.m_Id = SerializedPacket.DeserializeGuid(p.GetNextPart());
            this.m_OriginalSlideId = SerializedPacket.DeserializeGuid(p.GetNextPart());
            this.m_QuickPollStyle  = (QuickPollStyle)SerializedPacket.DeserializeInt(p.GetNextPart());
            this.m_Changed         = SerializedPacket.DeserializeBool(p.GetNextPart());
            this.m_Choices         = new string[SerializedPacket.DeserializeInt(p.GetNextPart())];
            for (int i = 0; i < this.m_Choices.Length; i++)
            {
                this.m_Choices[i] = SerializedPacket.DeserializeString(p.GetNextPart());
            }
            int cnt = SerializedPacket.DeserializeInt(p.GetNextPart());

            this.m_QuickPollResults = new QuickPollResultCollection(this, "QuickPollResults");
            for (int j = 0; j < cnt; j++)
            {
                this.AddResult(new QuickPollResultModel(p.GetNextPart()));
            }
        }
 public QuickPoll()
 {
     m_Enabled        = false;
     m_Results        = new int[0];
     m_QuickPollStyle = QuickPollStyle.ABCD;
 }
        public static ArrayList GetVoteStringsFromStyle( QuickPollStyle style )
        {
            ArrayList strings = new ArrayList();
            switch( style )
            {
                case QuickPollStyle.YesNo:
                    strings.Add( "Yes" );
                    strings.Add( "No" );
                    break;
                case QuickPollStyle.YesNoBoth:
                    strings.Add( "Yes" );
                    strings.Add( "No" );
                    strings.Add( "Both" );
                    break;
                case QuickPollStyle.YesNoNeither:
                    strings.Add( "Yes" );
                    strings.Add( "No" );
                    strings.Add( "Neither" );
                    break;
                case QuickPollStyle.ABC:
                    strings.Add( "A" );
                    strings.Add( "B" );
                    strings.Add( "C" );
                    break;
                case QuickPollStyle.ABCD:
                    strings.Add( "A" );
                    strings.Add( "B" );
                    strings.Add( "C" );
                    strings.Add( "D" );
                    break;
                case QuickPollStyle.ABCDE:
                    strings.Add( "A" );
                    strings.Add( "B" );
                    strings.Add( "C" );
                    strings.Add( "D" );
                    strings.Add( "E" );
                    break;
                case QuickPollStyle.ABCDEF:
                    strings.Add( "A" );
                    strings.Add( "B" );
                    strings.Add( "C" );
                    strings.Add( "D" );
                    strings.Add( "E" );
                    strings.Add( "F" );
                    break;
                case QuickPollStyle.Custom:
                    // Do Nothing for now
                    break;
            }

            return strings;
        }