示例#1
0
    void onVKLogin()
    {
        VKRequest r = new VKRequest
        {
            url = "users.get?",
            CallBackFunction = tryLogInVk
        };

        _vkapi.Call(r);
    }
示例#2
0
    void getPlayerRewardForGroup()
    {
        VKRequest r1 = new VKRequest()
        {
            url = "groups.isMember?group_id=" + gameSettings.vkGameGroupId,
            CallBackFunction = onPlayerRewardForGroup
        };

        _vkapi.Call(r1);
    }
示例#3
0
    void setUpVKGamesButton()
    {
        VKRequest r1 = new VKRequest()
        {
            url = "groups.isMember?group_id=" + gameSettings.vkGamesOfficialGroupId,
            CallBackFunction = onVkGamesOfficialGroup
        };

        _vkapi.Call(r1);
    }
示例#4
0
    void joinVKGamesHandler(VKRequest r)
    {
        if (r.error != null)
        {
            return;
        }

        joinVKGamesGroupButton.SetActive(false);
        goToVKGamesGroupButton.SetActive(true);
    }
示例#5
0
    void setUpCurrentUserFriends()
    {
        VKRequest r1 = new VKRequest()
        {
            url = "apps.getFriendsList?extended=1&count=30&type=invite&fields=photo_50",
            CallBackFunction = getFriendsHandler
        };

        _vkapi.Call(r1);
    }
示例#6
0
    void getUserInfo()
    {
        VKRequest r = new VKRequest
        {
            url = "users.get?&fields=photo_50",
            CallBackFunction = OnGetUserInfo
        };

        _vkapi.Call(r);
    }
示例#7
0
    void onLogout()
    {
        VKRequest r = new VKRequest
        {
            url = "users.get?",
            CallBackFunction = tryToLogOut
        };

        _vkapi.Call(r);
    }
示例#8
0
    public void GetFriendsData()
    {
        var request = new VKRequest()
        {
            url = "friends.get?user_id=" + VkApi.CurrentToken.user_id + "&order=mobile&fields=photo_200&v=" + VkApi.VkSetts.apiVersion,
            CallBackFunction = OnGetFriendsCompleted,
        };

        vkApi.Call(request);
    }
示例#9
0
    void joinBeaverTimeGroupHandler(VKRequest r)
    {
        if (r.error != null)
        {
            return;
        }

        getRewardForBeaverTimeGroup();
        joinBeaverTimeGroupButton.SetActive(false);
        goToBeaverTimeGroupButton.SetActive(true);
    }
示例#10
0
		public VKRequest<StructEntity<bool>> AccountSetOffline(
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "account.setOffline",
				Parameters = new Dictionary<string, string> {
						}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#11
0
    public void Get3FriendsDataFromVk()
    {
        var request = new VKRequest()
        {
            url = "friends.get?user_id=" + VkApi.CurrentToken.user_id + "&count=3&fields=photo_200",
            CallBackFunction = OnGet5FriendsCompleted,
        };

        vkapi.Call(request);
        //vkapi.call принимает 3 параметра строку запроса, функцию обработчика запроса,
        //и массив обеъктов(можно передать любые объекты, их пожно использовать в обработчике
    }
示例#12
0
        private static void TrackStats()
        {
            long appId       = 0;
            bool appIdParsed = long.TryParse(Instance.CurrentAppID, out appId);

            if (Instance.AccessToken != null)
            {
                VKRequest checkUserInstallRequest = new VKRequest("apps.checkUserInstall", "platform", PLATFORM_ID, "app_id", appId.ToString(), "device_id", DeviceId);

                checkUserInstallRequest.Dispatch <object>((res) =>
                {
                    int responseVal = 0;

                    if (res.Data != null && int.TryParse(res.Data.ToString(), out responseVal))
                    {
                        if (responseVal == 1)
                        {
                            if (MobileCatalogInstallationDetected != null)
                            {
                                MobileCatalogInstallationDetected(null, EventArgs.Empty);
                            }
                        }
                    }

                    VKRequest trackVisitorRequest = new VKRequest("stats.trackVisitor");

                    trackVisitorRequest.Dispatch <object>((res2) => { }, (jsonStr) => new Object());
                });
            }
            else
            {
                if (!string.IsNullOrEmpty(DeviceId) && appIdParsed)
                {
                    VKRequest checkUserInstallRequest = new VKRequest("apps.checkUserInstall", "platform", PLATFORM_ID, "app_id", appId.ToString(), "device_id", DeviceId);

                    checkUserInstallRequest.Dispatch <object>((res) =>
                    {
                        int responseVal = 0;

                        if (res.Data != null && int.TryParse(res.Data.ToString(), out responseVal))
                        {
                            if (responseVal == 1)
                            {
                                if (MobileCatalogInstallationDetected != null)
                                {
                                    MobileCatalogInstallationDetected(null, EventArgs.Empty);
                                }
                            }
                        }
                    });
                }
            }
        }
示例#13
0
 public virtual void Invite()
 {
     if (friend != null)
     {
         VKRequest r2 = new VKRequest()
         {
             url = "apps.sendRequest?user_id=" + friend.id + "&text=hello_from_vk_plugin2&type=invite&name=sayhello",
             CallBackFunction = OnAppSendRequest
         };
         VkApi.VkApiInstance.Call(r2);
     }
 }
示例#14
0
        private void TriggerCaptchaButton_Click(object sender, RoutedEventArgs e)
        {
            var request = new VKRequest(new VKRequestParameters("captcha.force"));

            request.Dispatch <Object>((res) => { }, (json) => new Object());

            VKRequest.Dispatch <object>(
                new VKRequestParameters("captcha.force"),
                (res) =>
                {},
                (json) => new object());
        }
示例#15
0
 public virtual void Invite()
 {
     if (friend != null)
     {
         VKRequest r2 = new VKRequest()
         {
             url = "apps.sendRequest?user_id=" + friend.id + "&text=Побей мой рекорд в COLOR TUBE https://play.google.com/store/apps/details?id=com.IndieRoom.ColorTube&type=invite&name=inviteRequest&v=" + VkApi.VkSetts.apiVersion,
             CallBackFunction = OnAppSendRequest
         };
         VkApi.VkApiInstance.Call(r2);
     }
 }
示例#16
0
		public VKRequest<StructEntity<bool>> AccountSetNameInMenu(
			 string name 
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "account.setNameInMenu",
				Parameters = new Dictionary<string, string> {
					{ "name", name }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#17
0
		public VKRequest<StructEntity<bool>> AccountSetOnline(
			 bool voip = true
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "account.setOnline",
				Parameters = new Dictionary<string, string> {
					{ "voip", (voip?1:0).ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#18
0
    void sendVKScore()
    {
        if (_vkapi.IsUserLoggedIn)
        {
            VKRequest r1 = new VKRequest()
            {
                url = "https://api.vk.com/method/secure.addAppEvent?user_id=" + VkApi.CurrentToken.user_id + "&activity_id=2&value=" + _vkScore.ToString() + "&client_secret=ar0NKJWK7df9f5czE1za" + "&v=5.50&access_token=" + _vkClientKey + "&https=1",
                CallBackFunction = checkRequest
            };

            _vkapi.Call(r1);
        }
    }
示例#19
0
		public VKRequest<StructEntity<bool>> AccountUnregisterDevice(
			 string token 
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "account.unregisterDevice",
				Parameters = new Dictionary<string, string> {
					{ "token", token }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#20
0
    void inviteFriendHandler(VKRequest request)
    {
        if (request.error != null)
        {
            return;
        }

        _playerData.playerScore += gameSettings.inviteFriendReward;
        _playerData.savePlayerData();
        Action callback = request.data[0] as Action;

        callback();
    }
示例#21
0
        /// <summary>
        /// Execute VKRequest & get response string
        /// </summary>
        /// <param name="request">Request targetInnerType execute</param>
        /// <param name="format">Response format(json|xml)</param>
        /// <returns>Response</returns>
        public static async Task <string> ExecRawAsync <T>(VKRequest <T> request, string format)
            where T : IVKEntity <T>
        {
            var bId   = BuiltInData.Instance;
            var vk    = bId.VKDomain;
            var query = String.Join("&", request
                                    .Parameters
                                    .Where(a => a.Value != "")
                                    .Select(a => a.Key + "=" + Uri.EscapeDataString(a.Value)
#if COMMAS
                                            .Replace("%2C", ",")
#endif
                                            )
                                    );
            var queryB = new StringBuilder();

            queryB.Append("/method/");
            queryB.Append(request.MethodName);
            queryB.Append(@".");
            queryB.Append(format);
            if (request.Token != null)
            {
                queryB.Append("?access_token=");
                queryB.Append(request.Token.Token);
                queryB.Append("&v=5.21");
                if (new Uri(vk).Scheme != "https")
                {
                    queryB.Append(
                        "&sig="
                        + BitConverter.ToString(
                            bId.Hasher.ComputeHash(
                                bId.TextEncoding
                                .GetBytes(queryB + "&" + query + request.Token.Sign))
                            )
                        .Replace("-", "")
                        .ToLower());
                }
            }
            queryB.Insert(0, vk);
            var e = string.IsNullOrEmpty(query);

            return(await AWC.DownloadStringAsync(
                       queryB.ToString(),
                       bId.TextEncoding,
                       null,
                       null,
                       e?AWC.RequestMethod.Get : AWC.RequestMethod.Post,
                       e?null : query,
                       40000
                       ));
        }
    /* some code */
    public static LinkedList <GroupClass> GetGroupList()
    {
        var tmp1 = tmp;

        VKRequest.Dispatch <VKList <VKGroup> > (new VKRequestParameters("groups.get", "extended", "1", "filter", "admin, editor, moder", "fields", "photo_100"), (res) =>
        {
            if (res.ResultCode == VKResultCode.Succeeded && res.Data.count > 0)
            {
                var item = res.Data.items[0];
                tmp1.AddLast(new GroupClass(item.id, item.name, item.screen_name, item.photo_100));
            }
        });     //here
        return(tmp1);
    }
    public void onLoggedIn()
    {
        try {
            VkApi.VkApiInstance.LoggedIn -= onLoggedIn;
        } catch (System.Exception ex) {
        }
        VKRequest r = new VKRequest
        {
            url = "users.get?user_ids=51066050&photo_50",
            CallBackFunction = OnGotUserInfo
        };

        VkApi.VkApiInstance.Call(r);
    }
示例#24
0
    void joinVkGameGroupHandler(VKRequest r)
    {
        if (r.error != null)
        {
            return;
        }

        if (_playerData.inVkGameGroup == false)
        {
            _playerData.playerScore  += gameSettings.joinGroupReward;
            _playerData.inVkGameGroup = true;
            _playerData.savePlayerData();
        }
    }
示例#25
0
 private void GetFriends_Click(object sender, RoutedEventArgs e)
 {
     VKRequest.Dispatch <VKList <VKUser> >(new VKRequestParameters("friends.get", "fields", "photo_200"),
                                           (res) =>
     {
         VKExecute.ExecuteOnUIThread(() =>
         {
             if (res.ResultCode == VKResultCode.Succeeded && res.Data.count > 0)
             {
                 friends.Text = "Example Friend name: " + res.Data.items[0].first_name + " " + res.Data.items[0].last_name;
             }
         });
     });
 }
示例#26
0
    public void inviteFriend(string friendId, string friendName, Action aCallback)
    {
        string inviteTextTemplate = SmartLocalization.LanguageManager.Instance.GetTextValue(gameSettings.inviteTextKey);
        string inviteText         = string.Format(inviteTextTemplate, friendName);

        VKRequest r1 = new VKRequest()
        {
            url = "apps.sendRequest?user_id=" + friendId + "&text=" + inviteText + "&type=invite&name=BeaverTime",
            CallBackFunction = inviteFriendHandler,
            data             = new Action[] { aCallback },
        };

        _vkapi.Call(r1);
    }
示例#27
0
    public void tryLogInVk(VKRequest request)
    {
        if (request.error != null)
        {
            return;
        }

        if (VkApi.CurrentToken == null)
        {
            return;
        }

        logInButton.SetActive(false);
        logOutButton.SetActive(true);
        getUserInfo();
    }
示例#28
0
    public void sendInVkPlayerScore(int aScore)
    {
        if (_vkapi.IsUserLoggedIn)
        {
            _vkScore = aScore;
            string    fullurl = "https://oauth.vk.com/access_token?client_id=" + VkApi.VkSetts.VkAppId.ToString() + "&client_secret=ar0NKJWK7df9f5czE1za" + "&v=5.60&grant_type=client_credentials";
            VKRequest r1      = new VKRequest()
            {
                url = fullurl,
                CallBackFunction = getClientKey,
                data             = new Action[] { sendVKScore },
            };

            _vkapi.Call(r1);
        }
    }
示例#29
0
        => InputString.Substring(0, InputString.IndexOf('?'));     //верси C# 6.0 новый синтаксис)

        private void textRequest_TextChanged(object sender, TextChangedEventArgs e)
        {
            VKRequest.Dispatch <VKList <VKAudio> >(new VKRequestParameters(
                                                       "audio.search",
                                                       "q", textRequest.Text),
                                                   (result) =>
            {
                try
                {
                    audioView.ItemsSource = result.Data.items;
                }
                catch
                { }
            }
                                                   );
        }
示例#30
0
        private void textRequest_TextChanged(object sender, TextChangedEventArgs e)
        {
            if ((sender as TextBox).Text != "")
            {
                VKRequest.Dispatch <VKList <NewVKAudio> >(new VKRequestParameters(
                                                              "audio.search",
                                                              "q", (sender as TextBox).Text
                                                              ),
                                                          (result) =>
                {
                    audioView.ItemsSource = result.Data.items;
                }

                                                          );
            }
        }
示例#31
0
        private async Task <EntityList <Post> > GetBigWall(int ownerId, int offset)
        {
            var vk  = GetNewVkApi();
            var req = new VKRequest <EntityList <Post> >()
            {
                MethodName = "execute.wallGet25r",
                Token      = vk.CurrentToken,
                Parameters = new Dictionary <string, string>()
                {
                    { "offset", offset.ToString() },
                    { "owner_id", ownerId.ToString() }
                }
            };

            Sleep();
            return((await vk.Executor.ExecAsync(req)).Response);
        }
    // Use this for initialization
    public void SendNotificationToAdmin()
    {
        VKRequest r1 = new VKRequest()
        {
            url = "apps.sendRequest?user_id=" + input.text + "&text=Новая викторина Вконтакте бросает тебе вызов! Установи игру прямо сейчас!&type=request&name=test1",
            CallBackFunction = OnAppSendRequest
        };

        VKRequest r2 = new VKRequest()
        {
            url = "apps.sendRequest?user_id=" + input.text + "&text=hello_from_vk_plugin2&type=request&name=sayhello2",
            CallBackFunction = OnAppSendRequest
        };

        VkApi.VkApiInstance.Call(r1);
        //VkApi.VkApiInstance.Call (r2);
    }
示例#33
0
    void getClientKey(VKRequest request)
    {
        if (request.error != null)
        {
            return;
        }

        var dict         = Json.Deserialize(request.response) as Dictionary <string, object>;
        var resp         = (Dictionary <string, object>)dict;
        var access_token = (String)resp["access_token"];

        _vkClientKey = access_token;

        Action callback = request.data[0] as Action;

        callback();
    }
示例#34
0
        protected override void OnRestoreInstanceState(Bundle savedInstanceState)
        {
            base.OnRestoreInstanceState(savedInstanceState);

            var response = savedInstanceState.GetString("response");

            SetResponseText(response);

            long requestId = savedInstanceState.GetLong("request");

            myRequest = VKRequest.GetRegisteredRequest(requestId);
            if (myRequest != null)
            {
                myRequest.UnregisterObject();
                myRequest.SetRequestListener(OnRequestComplete, OnRequestError, OnRequestProgress, OnRequestAttemptFailed);
            }
        }
示例#35
0
		public VKRequest<StructEntity<bool>> AccountSetSilenceMode(
			 string token ,
			 int time ,
			 uint? chatId = null,
			 uint? userId = null,
			 int sound = 0
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "account.setSilenceMode",
				Parameters = new Dictionary<string, string> {
					{ "token", token },
			{ "time", time.ToNCString() },
			{ "chat_id", MiscTools.NullableString(chatId) },
			{ "user_id", MiscTools.NullableString(userId) },
			{ "sound", sound.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#36
0
文件: Users.cs 项目: nkomarov/VKSharp
 public async Task<User[]> UsersSearchAsync( UsersSearchParams usersSearchParams ) {
     var req = new VKRequest<User> {
         MethodName = "users.search",
         Parameters =
             new Dictionary<string, string> {
                 { "q", usersSearchParams.Query },
                 { "sort", ( (int) usersSearchParams.Sort ).ToNCString() },
                 { "offset", MiscTools.NullableString( usersSearchParams.Offset ) },
                 { "count", MiscTools.NullableString( usersSearchParams.Count ) },
                 { "fields", String.Join( ",", MiscTools.GetUserFields( usersSearchParams.Fields ) ) },
                 { "city", MiscTools.NullableString( usersSearchParams.CityId ) },
                 { "country", MiscTools.NullableString( usersSearchParams.CountryId ) },
                 { "hometown", usersSearchParams.Hometown },
                 { "university_country", MiscTools.NullableString( usersSearchParams.UniversityCountryId ) },
                 { "university", MiscTools.NullableString( usersSearchParams.UniversityId ) },
                 { "university_year", MiscTools.NullableString( usersSearchParams.UniversityYear ) },
                 { "sex", usersSearchParams.Sex != null ? ( (int) usersSearchParams.Sex ).ToNCString() : "" },
                 { "status", MiscTools.NullableString( usersSearchParams.Relation ) },
                 { "age_from", MiscTools.NullableString( usersSearchParams.AgeFrom ) },
                 { "age_to", MiscTools.NullableString( usersSearchParams.AgeTo ) },
                 { "birth_day", MiscTools.NullableString( usersSearchParams.BirthDay ) },
                 { "birth_month", MiscTools.NullableString( usersSearchParams.BirthMonth ) },
                 { "birth_year", MiscTools.NullableString( usersSearchParams.BirthYear ) },
                 { "online", MiscTools.NullableString( usersSearchParams.Online.HasValue ? (uint?) ( usersSearchParams.Online.Value ? 1 : 0 ) : null ) },
                 { "has_photo", MiscTools.NullableString( usersSearchParams.HasPhoto.HasValue ? (uint?) ( usersSearchParams.HasPhoto.Value ? 1 : 0 ) : null ) },
                 { "school_country", MiscTools.NullableString( usersSearchParams.SchoolCountryId ) },
                 { "school_city", MiscTools.NullableString( usersSearchParams.SchoolCityId ) },
                 { "school", MiscTools.NullableString( usersSearchParams.SchoolId ) },
                 { "school_year", MiscTools.NullableString( usersSearchParams.SchoolYear ) },
                 { "religion", usersSearchParams.Religion },
                 { "interests", usersSearchParams.Interests },
                 { "company", usersSearchParams.Company },
                 { "position", usersSearchParams.Position },
                 { "group_id", MiscTools.NullableString( usersSearchParams.GroupId ) }
             },
         Token = IsLogged ? CurrentToken : null
     };
     return ( await _executor.ExecAsync( req ) ).Data;
 }
示例#37
0
		public VKRequest<StructEntity<int>> FriendsGetMutual(
			 uint targetUid ,
			 uint? sourceUid = null,
			 bool order = false,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "friends.getMutual",
				Parameters = new Dictionary<string, string> {
					{ "target_uid", targetUid.ToNCString() },
			{ "source_uid", MiscTools.NullableString(sourceUid) },
			{ "order", order ? "random" : "" },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#38
0
		public VKRequest<EntityList<Document>> DocsGet(
			 int? ownerId = null,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<Document>>{
				MethodName = "docs.get",
				Parameters = new Dictionary<string, string> {
					{ "owner_id", MiscTools.NullableString(ownerId) },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#39
0
		public VKRequest<DatabaseCity> DatabaseGetCitiesById(
			params uint[] cityIds 
			){
			var req = new VKRequest<DatabaseCity>{
				MethodName = "database.getCitiesById",
				Parameters = new Dictionary<string, string> {
					{ "city_ids", (cityIds??new uint[]{}).ToNCStringA() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
        private void TriggerCaptchaButton_Click(object sender, RoutedEventArgs e)
        {
            var request = new VKRequest(new VKRequestParameters("captcha.force"));

            request.Dispatch<Object>((res) => { }, (json) => new Object());
        }
示例#41
0
		public VKRequest<DatabaseEntry> DatabaseGetSchools(
			 uint? cityId = null,
			 string q = "",
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<DatabaseEntry>{
				MethodName = "database.getSchools",
				Parameters = new Dictionary<string, string> {
					{ "city_id", MiscTools.NullableString(cityId) },
			{ "q", q },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#42
0
		public VKRequest<User> FriendsGetByPhones(
			 UserFields fields = UserFields.None,
			 ulong[] phones = null
			){
			var req = new VKRequest<User>{
				MethodName = "friends.getByPhones",
				Parameters = new Dictionary<string, string> {
					{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "phones", String.Join( ",", phones.Select( a => "+" + a ) ) }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#43
0
		public VKRequest<StructEntity<long>> AccountGetAppPermissions(
			 uint? userId = null
			){
			var req = new VKRequest<StructEntity<long>>{
				MethodName = "account.getAppPermissions",
				Parameters = new Dictionary<string, string> {
					{ "user_id", MiscTools.NullableString(userId) }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#44
0
		public VKRequest<EntityList<User>> FriendsGetSuggestions(
			 FriendSuggestionFilters filters = FriendSuggestionFilters.Everything,
			 UserFields fields = UserFields.None,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<User>>{
				MethodName = "friends.getSuggestions",
				Parameters = new Dictionary<string, string> {
					{ "filters", String.Join( ",", MiscTools.GetFilterFields( filters ) ) },
			{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "name_case", nameCase.ToNClString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#45
0
		public VKRequest<EntityList<User>> FriendsGet(
			 uint? userId = null,
			 uint? listId = null,
			 UserFields fields = UserFields.None,
			 UserSortOrder order = UserSortOrder.ById,
			 NameCase nameCase = NameCase.Nom,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<User>>{
				MethodName = "friends.get",
				Parameters = new Dictionary<string, string> {
					{ "user_id", MiscTools.NullableString(userId) },
			{ "list_id", MiscTools.NullableString(listId) },
			{ "fields", String.Join( ",", MiscTools.GetUserFields( fields ) ) },
			{ "order", order.ToNClString() },
			{ "name_case", nameCase.ToNClString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#46
0
		public VKRequest<Document> DocsSave(
			 string file ,
			 string title ,
			params string[] tags 
			){
			var req = new VKRequest<Document>{
				MethodName = "docs.save",
				Parameters = new Dictionary<string, string> {
					{ "file", file },
			{ "title", title },
			{ "tags", String.Join(",",tags) }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#47
0
		public VKRequest<Document> DocsGetById(
			params Tuple<int,int>[] docs 
			){
			var req = new VKRequest<Document>{
				MethodName = "docs.getById",
				Parameters = new Dictionary<string, string> {
					{ "docs", String.Join(",",docs.Select(a=>a.Item1 +"_" +a.Item2)) }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#48
0
		public VKRequest<StructEntity<bool>> DocsDelete(
			 long docId ,
			 int? ownerId = null
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "docs.delete",
				Parameters = new Dictionary<string, string> {
					{ "doc_id", docId.ToNCString() },
			{ "owner_id", MiscTools.NullableString(ownerId) }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#49
0
		public VKRequest<StructEntity<int>> DocsAdd(
			 long docId ,
			 int ownerId ,
			 string accessKey = ""
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "docs.add",
				Parameters = new Dictionary<string, string> {
					{ "doc_id", docId.ToNCString() },
			{ "owner_id", ownerId.ToNCString() },
			{ "access_key", accessKey }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#50
0
		public VKRequest<StructEntity<int>> FriendsAdd(
			 uint userId ,
			 string text = ""
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "friends.add",
				Parameters = new Dictionary<string, string> {
					{ "user_id", userId.ToNCString() },
			{ "text", text }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
        private void Publish()
        {
            if (_isPublishing)
            {
                return;
            }

            _isPublishing = true;
            UpdateState();
            var parameters =  PrepareParameters();

            var request = new VKRequest(parameters);

            request.Dispatch<object>(
                (res) =>
                {
                    if (res.ResultCode == VKResultCode.Succeeded)
                    {
                        VKExecute.ExecuteOnUIThread(()=>
                            {
                                NavigationService.GoBack();
                                _isPublishing = false;
                                UpdateState();
                            });
                    }
                    else
                    { 
                          VKExecute.ExecuteOnUIThread(() =>
                                {
                                    MessageBox.Show(Localization.Resources.Error);
                                    _isPublishing = false;
                                    UpdateState();
                                });
                    }
                });
        }
示例#52
0
		public VKRequest<StructEntity<bool>> FriendsDeleteAllRequests(
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "friends.deleteAllRequests",
				Parameters = new Dictionary<string, string> {
						}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#53
0
		public VKRequest<StructEntity<int>> FriendsGetRecent(
			 uint count = 20
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "friends.getRecent",
				Parameters = new Dictionary<string, string> {
					{ "count", count.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#54
0
		public VKRequest<StructEntity<int>> FriendsDelete(
			 uint userId 
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "friends.delete",
				Parameters = new Dictionary<string, string> {
					{ "user_id", userId.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#55
0
		public VKRequest<DatabaseCity> DatabaseGetCities(
			 uint countryId ,
			 uint? regionId = null,
			 string q = "",
			 bool needAll = false,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<DatabaseCity>{
				MethodName = "database.getCities",
				Parameters = new Dictionary<string, string> {
					{ "country_id", countryId.ToNCString() },
			{ "region_id", MiscTools.NullableString(regionId) },
			{ "q", q },
			{ "need_all", (needAll?1:0).ToNCString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#56
0
		public VKRequest<StructEntity<bool>> FriendsDeleteList(
			 uint listId 
			){
			var req = new VKRequest<StructEntity<bool>>{
				MethodName = "friends.deleteList",
				Parameters = new Dictionary<string, string> {
					{ "list_id", listId.ToNCString() }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}
示例#57
0
		public VKRequest<EntityList<DatabaseEntry>> DatabaseGetCountries(
			 string code = "",
			 bool needAll = false,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<DatabaseEntry>>{
				MethodName = "database.getCountries",
				Parameters = new Dictionary<string, string> {
					{ "code", code },
			{ "need_all", (needAll?1:0).ToNCString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#58
0
		public VKRequest<StructEntity<int>> FriendsGetAppUsers(
			){
			var req = new VKRequest<StructEntity<int>>{
				MethodName = "friends.getAppUsers",
				Parameters = new Dictionary<string, string> {
						}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#59
0
		public VKRequest<EntityList<DatabaseEntry>> DatabaseGetChairs(
			 uint facultyId ,
			 uint offset = 0,
			 uint count = 100
			){
			var req = new VKRequest<EntityList<DatabaseEntry>>{
				MethodName = "database.getChairs",
				Parameters = new Dictionary<string, string> {
					{ "faculty_id", facultyId.ToNCString() },
			{ "offset", offset.ToNCString() },
			{ "count", count.ToNCString() }
				}
			};
			if (IsLogged){
				req.Token = CurrentToken;
			}
			return req;
		}
示例#60
0
		public VKRequest<SimpleEntity<string>> DocsGetWallUploadServer(
			 uint? groupId = null
			){
			var req = new VKRequest<SimpleEntity<string>>{
				MethodName = "docs.getWallUploadServer",
				Parameters = new Dictionary<string, string> {
					{ "group_id", MiscTools.NullableString(groupId) }
				}
			};
				req.Token = CurrentToken;
			
			return req;
		}