Ejemplo n.º 1
0
        public void UpdateTitleBarTeamStats()
        {
            int    licensed    = 0;
            int    provisioned = 0;
            string name        = string.Empty;

            //do a call to get team info
            IMemberServices service = service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion);

            service.GetInfoUrl       = ApplicationResource.ActionGetInfo;
            service.UserAgentVersion = ApplicationResource.UserAgent;
            string AccessToken = ApplicationResource.DefaultAccessToken;

            IDataResponse response = service.GetInfo(AccessToken);

            if (response.StatusCode == HttpStatusCode.OK)
            {
                if (response.Data != null)
                {
                    string  data     = response.Data.ToString();
                    dynamic jsonData = JsonConvert.DeserializeObject <dynamic>(data);

                    name        = jsonData["name"];
                    licensed    = jsonData["num_licensed_users"];
                    provisioned = jsonData["num_provisioned_users"];
                }
            }
            //get toolkit version and build title text
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            this.Text = "Dropbox Business Admin Toolkit v" + version + "            Team: " + name + "       Licensed Users: " + licensed.ToString() + "       Provisioned Users: " + provisioned.ToString();
            this.Update();
            this.Refresh();
        }