Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            rClient = new RestClient();

            rClient.endPoint = this.textBoxURI.Text + BaseURL_edocs + "libraries";
            string response = string.Empty;

            response = rClient.MakeRequest();
            DebugOutput(response);
            //DeserializeJSON(response);

            //Convert JSON to a DMLibraries object
            DMLibraries _libs = GetDMLibraries(response);

            //Update the UI with the library list
            this.comboBoxLibraries.BeginUpdate();

            foreach (var item in _libs.data)
            {
                this.comboBoxLibraries.Items.Add(item);
            }

            this.comboBoxLibraries.Text = _libs.data[0];
            this.comboBoxLibraries.EndUpdate();
            this.loginLIbrary = this.comboBoxLibraries.Text;
            this.libq        += loginLIbrary;
        }
Esempio n. 2
0
 //var DMLibraries = JsonConvert.DeserializeObject<dynamic>(response);
 private void DeserializeJSON(string response)
 {
     try
     {
         //var DMLibraries = JsonConvert.DeserializeObject<dynamic>(response);
         DMLibraries _dmLIbs = JsonConvert.DeserializeObject <DMLibraries>(response);
         DebugOutput("Accessing the first item in the libraries array: " + _dmLIbs.data[0]);
         DebugOutput("Here's our jSON object: " + _dmLIbs.ToString());
     }
     catch (Exception ex)
     {
         DebugOutput("Error! " + ex.Message.ToString());
     }
 }
Esempio n. 3
0
        private DMLibraries GetDMLibraries(string response)
        {
            DMLibraries _dmLibs = null;

            try
            {
                _dmLibs = JsonConvert.DeserializeObject <DMLibraries>(response);

                return(_dmLibs);
            }
            catch (Exception ex)
            {
                DebugOutput("Error! " + ex.Message.ToString());
            }

            return(_dmLibs);
        }