Esempio n. 1
0
        private void readApps()
        {
            //QRSWebClient qrsClient = new QRSWebClient(txtServer.Text + ":4242");
            QRSNTLMWebClient qrsClient = new QRSNTLMWebClient(txtServer.Text);
            string           result    = qrsClient.Get("/qrs/app");

            List <app> apps = new List <app>();

            apps = JsonConvert.DeserializeObject <List <app> >(result);

            cmbApps.DataSource = apps;
        }
Esempio n. 2
0
        private void readStreams()
        {
            //QRSWebClient qrsClient = new QRSWebClient(txtServer.Text + ":4242");
            QRSNTLMWebClient qrsClient = new QRSNTLMWebClient(txtServer.Text);
            string           result    = qrsClient.Get("/qrs/stream");

            List <stream> streams = new List <stream>();

            streams = JsonConvert.DeserializeObject <List <stream> >(result);

            cmbStreams.DataSource = streams;
        }
        public CustomProperty addCustomProperty(string name, List<string> values)
        {
            CustomProperty newCP = new CustomProperty();
            string result;

            //Check if a tag with this name already exists
            Dictionary<string, string> filter = new Dictionary<string, string>();
            filter.Add("filter", "name eq '" + name + "'");
            result = qrsClient.Get("/qrs/custompropertydefinition/full", filter);
            List<CustomProperty> existingCP = JsonConvert.DeserializeObject<List<CustomProperty>>(result);

            //build the option list
            List<string> CPvalues = new List<string>();

            for (int i = 0; i < values.Count;i++ )
            {
                CPvalues.Add(values[i]);
            }

            if (existingCP.Count > 0)
            {
                //if exists then update it
                newCP = existingCP[0];
                newCP.choiceValues = CPvalues.ToArray();
                result = qrsClient.Put("/qrs/custompropertydefinition/"+newCP.ID, JsonConvert.SerializeObject(newCP, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
            }
            else
            {
                //if not then add it
                newCP.name = name;
                newCP.choiceValues = CPvalues.ToArray();
                newCP.objectTypes = new string[] { "App" };

                result = qrsClient.Post("/qrs/custompropertydefinition", JsonConvert.SerializeObject(newCP, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }));
                newCP = JsonConvert.DeserializeObject<CustomProperty>(result);
            }

            return newCP;
        }