示例#1
0
 public AdvertisingDeviceInfo()
 {
     this._phoneAppInfo = AppInfo.GetPhoneAppInfo();
 }
示例#2
0
        public void GetBaseData(PhoneAppInfo phoneAppInfo, Action <BackendResult <AccountBaseData, ResultCode> > callback, bool loadStickersInfo = false)
        {
            ThemeSettings themeSettings = ThemeSettingsManager.GetThemeSettings();
            Color         color         = ((SolidColorBrush)Application.Current.Resources["PhoneBackgroundBrush"]).Color;
            // ISSUE: explicit reference operation
            string str1 = (int)((Color)@color).R == 0 ? "dark" : "light";
            string str2 = "";

            switch (themeSettings.BackgroundSettings)
            {
            case 0:
                str2 = "system";
                break;

            case 2:
                str2 = "dark";
                break;

            case 3:
                str2 = "light";
                break;
            }
            Dictionary <string, string> parameters = new Dictionary <string, string>()
            {
                {
                    "userId",
                    AppGlobalStateManager.Current.LoggedInUserId.ToString()
                },
                {
                    "device",
                    phoneAppInfo.Device
                },
                {
                    "os",
                    phoneAppInfo.OS
                },
                {
                    "version",
                    phoneAppInfo.AppVersion
                },
                {
                    "locale",
                    phoneAppInfo.Locale
                },
                {
                    "themeBackgroundMode",
                    str2
                },
                {
                    "themeActiveBackground",
                    str1
                },
                {
                    "func_v",
                    "5"
                }
            };

            if (loadStickersInfo)
            {
                parameters["loadStickers"] = "1";
            }
            VKRequestsDispatcher.DispatchRequestToVK <AccountBaseData>("execute.getBaseData", parameters, callback, (Func <string, AccountBaseData>)(jsonStr =>
            {
                jsonStr = jsonStr.Replace("\"OwnCounters\":[]", "\"OwnCounters\":{}");
                jsonStr = jsonStr.Replace("\"exports\":[]", "\"exports\":{}");
                return(JsonConvert.DeserializeObject <GenericRoot <AccountBaseData> >(jsonStr).response);
            }), true, true, new CancellationToken?(), null);
        }