public ReplyForumTopicViewController(long topicId, string title)
 {
     initialModel = new AddForumTopicModel();
     initialModel.ForumId = SettingsMobile.Instance.CurrentForumId;
     initialModel.TopicId = topicId;
     initialModel.TopicTitle = title;
 }
 public AddForumTopicViewController(long groupId, Guid forumId, string groupName)
 {
     initialModel = new AddForumTopicModel();
     initialModel.GroupId = groupId;
     initialModel.ForumId = forumId;
     GroupName = groupName;
 }
Пример #3
0
 public static AddForumTopicModel ReplyToForumTopic(AddForumTopicModel topic)
 {
     var response = Network.SendPackage(Network.ConvertObjectToStream(topic), MobileConfig.LEAGUE_FORUM_REPLY_TOPIC_URL);
     var stream = response.GetResponseStream();
     StreamReader read = new StreamReader(stream);
     string json = read.ReadToEnd();
     return Json.DeserializeObject<AddForumTopicModel>(json);
 }
Пример #4
0
 public static bool ToggleWatchingForumTopic(AddForumTopicModel topic)
 {
     Random random = new Random();
     var response = Network.SendPackage(Network.ConvertObjectToStream(topic), MobileConfig.LEAGUE_FORUM_WATCH_TOPIC_URL+ "fid=" + topic.ForumId + "&tid=" + topic.TopicId + "&mid=" + topic.MemberId + "&uid=" + topic.UserId + "&r=" + random.Next());
     var stream = response.GetResponseStream();
     StreamReader read = new StreamReader(stream);
     string json = read.ReadToEnd();
     return json.Contains("true");
 }
Пример #5
0
        public static bool AddNewTopic(AddForumTopicModel topic)
        {

            var status = Reachability.IsHostReachable(Reachability.HostName);
            if (status)
            {
                try
                {
                    return ForumMobile.AddNewForumTopic(topic).IsSuccessful;

                }
                catch (Exception ex)
                {
                    ErrorHandler.Save(ex, MobileTypeEnum.iPhone);
                }
            }
            return false;

        }
 private void SendPost_Click(object sender, EventArgs e)
 {
     progressIndicator.IsVisible = true;
     try
     {
         AddForumTopicModel model = new AddForumTopicModel();
         model.BroadcastMessage = Broadcast.IsChecked.GetValueOrDefault();
         model.ForumId = forumModel.ForumId;
         model.MemberId = SettingsMobile.Instance.User.MemberId.ToString();
         model.UserId = SettingsMobile.Instance.User.LoginId.ToString();
         model.TopicId = forumModel.TopicId;
         model.Text = MessageInput.Text;
         model.CategoryId = forumModel.CategoryId;
         Task.Run(new Action(() =>
         {
             try
             {
                 var m = ForumMobile.ReplyToForumTopic(model);
                 (App.Current as App).SecondPageObject = new ForumModel() { ForumId = model.ForumId, CategoryId = model.CategoryId };
                 
                 Dispatcher.BeginInvoke(delegate
                                         {
                                             ToastPrompt t = new ToastPrompt
                                             {
                                                 Title = "Message Sent",
                                                 TextOrientation = System.Windows.Controls.Orientation.Vertical
                                             };
                                             progressIndicator.IsVisible = false;
                                             t.Show();
                                             NavigationService.Navigate(new Uri("/View/MyLeague/ForumMain.xaml", UriKind.RelativeOrAbsolute));
                                         });
             }
             catch (Exception exception)
             {
                 ErrorHandler.Save(exception, MobileTypeEnum.WP8);
             }
         }));
     }
     catch (Exception exception)
     {
         ErrorHandler.Save(exception, MobileTypeEnum.WP8);
     }
 }
        private void WatchPostBar_Click(object sender, EventArgs e)
        {
            progressIndicator.IsVisible = true;
            progressIndicator.Text = "Watching...";
            try
            {
                AddForumTopicModel model = new AddForumTopicModel();
                model.ForumId = topic.ForumId;
                model.MemberId = SettingsMobile.Instance.User.MemberId.ToString();
                model.UserId = SettingsMobile.Instance.User.LoginId.ToString();
                model.TopicId = topic.TopicId;
                Task.Run(new Action(() =>
                {
                    try
                    {
                        var m = ForumMobile.ToggleWatchingForumTopic(model);
                        if (m)
                            topic.IsWatching = !topic.IsWatching;

                        Dispatcher.BeginInvoke(delegate
                        {
                            ApplicationBarIconButton b = (ApplicationBarIconButton)ApplicationBar.Buttons[1];

                            if (topic.IsWatching)
                                b.Text = "UnWatch";
                            else
                                b.Text = "Watch";
                            Watching.Text = topic.IsWatching.ToString();
                            progressIndicator.IsVisible = false;
                        });
                    }
                    catch (Exception exception)
                    {
                        ErrorHandler.Save(exception, MobileTypeEnum.WP8);
                    }
                }));
            }
            catch (Exception exception)
            {
                ErrorHandler.Save(exception, MobileTypeEnum.WP8);
            }

        }