Example #1
0
        /// <summary>
        /// Creates a <c>SocialGroupThread</c>
        /// </summary>
        /// <param name="session"> Session that is used for sending the request </param>
        /// <param name="socialGroup"> SocialGroup where to create the <c>SocialGroupThread</c></param>
        /// <param name="startPost"> Represents the content and title of the <c>SocialGroupThread</c> </param>
        /// <param name="settings"> Additional options that can be set </param>
        /// <returns> Freshly created <c>SocialGroupThread</c></returns>
        public static SocialGroupThread Create <TUser>(AuthenticatedSession <TUser> session, SocialGroup socialGroup, SocialGroupPost startPost,
                                                       Message.Settings settings = Message.Settings.ParseUrl)
            where TUser : User
        {
            session.ThrowIfInvalid();

            session.Post("http://www.elitepvpers.com/forum/group.php?do=message",
                         new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("subject", startPost.Title),
                new KeyValuePair <string, string>("message", startPost.Content.ToString()),
                new KeyValuePair <string, string>("wysiwyg", "0"),
                new KeyValuePair <string, string>("s", String.Empty),
                new KeyValuePair <string, string>("securitytoken", session.SecurityToken),
                new KeyValuePair <string, string>("do", "message"),
                new KeyValuePair <string, string>("gmid", String.Empty),
                new KeyValuePair <string, string>("posthash", String.Empty),
                new KeyValuePair <string, string>("loggedinuser", session.User.ID.ToString()),
                new KeyValuePair <string, string>("groupid", socialGroup.ID.ToString()),
                new KeyValuePair <string, string>("discussionid", String.Empty),
                new KeyValuePair <string, string>("sbutton", "Nachricht+speichern"),
                new KeyValuePair <string, string>("parseurl", settings.HasFlag(Message.Settings.ParseUrl) ? "1" : "0"),
                new KeyValuePair <string, string>("parseame", "1"),
            });

            var socialGroupThread = new SocialGroupThread(0, socialGroup)
            {
                Creator = session.User, Deleted = false
            };

            socialGroupThread.Posts.Insert(0, startPost);
            return(socialGroupThread);
        }
Example #2
0
 public SocialGroupThread(int id, SocialGroup socialGroup)
     : base(id)
 {
     SocialGroup = socialGroup;
     Posts       = new List <SocialGroupPost>();
 }