コード例 #1
0
        /* Конструктор Класса */
        public Profile(Club instance, string route = "/profile/")
        {
            // Задаем параметры
            club_instance = instance; // Передача экземпляра
            api_route     = route;    // Передача маршрута

            // Создаем модели данных
            profile = new profileModel();             // Создать модель
            profile.profile_data = new profileData(); // Добавить модель
            profile.ban_data     = new banData();     // Добавить модель
        }
コード例 #2
0
        public async Task <bool> getProfile(double profile_uid, OnProfileLoaded complete, OnProfileError error)
        {
            // Формируем данные для отправки
            var formContent = new FormUrlEncodedContent(new[] {
                new KeyValuePair <string, string>("access_token", club_instance.auth.access_token),
                new KeyValuePair <string, string>("profile_uid", profile_uid.ToString()),
                new KeyValuePair <string, string>("lang", club_instance.language)
            });

            // Отправка запроса
            bool getprofile = await club_instance.requests.sendRequest(api_route + "get_profile/", formContent, ((string data) => {
                profile = JsonConvert.DeserializeObject <profileModel>(data); // Конверсия JSON
                complete();
            }), ((string code) => {
                error(code);
            }));

            // Все ок
            return(true);
        }