public async static Task Try(Group group, string[] fileNames, bool fromGroup = false, string message = null) { if (!group.CanPost) { Dispatcher.CurrentDispatcher.Invoke(() => { MessageBox.Show(String.Format("У вас не достаточно прав чтобы загрузить фотографии на стену группы {0}", group.Name),"Ошибка доступа"); }); return; } Dispatcher.CurrentDispatcher.Invoke(() => { var res = MessageBox.Show(String.Format("Вы действительно хотите загрузить {0} фото на стену группы {1}?", fileNames.Length, group.Name), "Подтверждение", MessageBoxButton.YesNo); if (res != MessageBoxResult.Yes) return; }); await VKPhotoUploader.UploadImages(group.ScreenName, fileNames, message, fromGroup, VkNet.Enums.VkObjectType.Group, group.Id); }
virtual public bool CheckGroup(VkNet.Model.Group g) { return(false); }
internal static Group FromJson(VkResponse response) { var group = new Group(); group.Id = response["id"] ?? response["gid"]; group.Name = response["name"]; group.ScreenName = response["screen_name"]; group.IsClosed = response["is_closed"]; group.IsAdmin = response["is_admin"]; group.AdminLevel = response["admin_level"]; group.IsMember = response["is_member"]; group.Type = response["type"]; group.PhotoPreviews = response; // опциональные поля group.CityId = response["city"]; group.CountryId = response["country"]; group.Place = response["place"]; group.Description = response["description"]; group.WikiPage = response["wiki_page"]; group.MembersCount = response["members_count"]; group.Counters = response["counters"]; group.StartDate = response["start_date"]; group.EndDate = response["end_date"]; group.CanPost = response["can_post"]; group.CanSeelAllPosts = response["can_see_all_posts"]; group.CanUploadDocuments = response["can_upload_doc"]; group.CanCreateTopic = response["can_create_topic"]; group.Activity = response["activity"]; group.Status = response["status"]; group.Contacts = response["contacts"]; group.Links = response["links"]; group.FixedPostId = response["fixed_post"]; group.IsVerified = response["verified"]; group.Site = response["site"]; group.InvitedBy = response["invited_by"]; return group; }
/// <summary> /// Разобрать из json. /// </summary> /// <param name="response">Ответ сервера.</param> /// <returns></returns> public static Group FromJson(VkResponse response) { var group = new Group { Id = response["group_id"] ?? response["gid"] ?? response["id"], Name = response["name"], ScreenName = response["screen_name"], IsClosed = response["is_closed"], IsAdmin = response["is_admin"], AdminLevel = response["admin_level"], IsMember = response["is_member"], Type = response["type"], PhotoPreviews = response, Deactivated = response["deactivated"], HasPhoto = response["has_photo"], Photo50 = response["photo_50"], Photo100 = response["photo_100"], Photo200 = response["photo_200"], // опциональные поля City = response["city"], Country = response["country"], Place = response["place"], Description = response["description"], WikiPage = response["wiki_page"], MembersCount = response["members_count"], Counters = response["counters"], StartDate = response["start_date"], EndDate = response["finish_date"] ?? response["end_date"], CanPost = response["can_post"], CanSeelAllPosts = response["can_see_all_posts"], CanUploadDocuments = response["can_upload_doc"], CanCreateTopic = response["can_create_topic"], Activity = response["activity"], Status = response["status"], Contacts = response["contacts"], Links = response["links"], FixedPostId = response["fixed_post"], IsVerified = response["verified"], Site = response["site"], InvitedBy = response["invited_by"], IsFavorite = response["is_favorite"], BanInfo = response["ban_info"], CanUploadVideo = response["can_upload_video"], MainAlbumId = response["main_album_id"], IsHiddenFromFeed = response["is_hidden_from_feed"], MainSection = response["main_section"] }; return group; }
internal static Group FromJson(VkResponse response) { var group = new Group(); group.Id = response["id"] ?? response["gid"]; group.Name = response["name"]; group.ScreenName = response["screen_name"]; group.IsClosed = response["is_closed"]; group.IsAdmin = response["is_admin"]; group.AdminLevel = response["admin_level"]; group.IsMember = response["is_member"]; group.Type = response["type"]; group.PhotoPreviews = response; group.photo = response["photo_medium"]; group.photoSmall = response["photo"]; group.photoBig = response["photo_big"]; if (group.photoBig != null) { using (WebClient client = new WebClient()) { group.photoBigSource = client.DownloadData(group.photoBig); } } // опциональные поля //group.CityId = response.ContainsKey("city") ? response["city"]["id"] : null; //group.CountryId = response.ContainsKey("country") ? response["country"]["id"] : null; //group.Place = response["place"]; group.Description = response["description"]; group.WikiPage = response["wiki_page"]; group.MembersCount = response["members_count"]; group.Counters = response["counters"]; group.StartDate = response["start_date"]; group.EndDate = response["end_date"]; group.CanPost = response["can_post"]; group.CanSeelAllPosts = response["can_see_all_posts"]; group.CanUploadDocuments = response["can_upload_doc"]; group.CanCreateTopic = response["can_create_topic"]; group.Activity = response["activity"]; group.Status = response["status"]; group.Contacts = response["contacts"]; group.Links = response["links"]; group.FixedPostId = response["fixed_post"]; group.IsVerified = response["verified"]; group.Site = response["site"]; group.InvitedBy = response["invited_by"]; return group; }
public PostmanHelper(long groupUid) { _group = VkGroupManager.getInstance().getGroupById(groupUid); }