Пример #1
0
        /// <summary>
        /// Crée et ajoute quelques objets ItemViewModel dans la collection Items.
        /// </summary>
        public async void LoadData()
        {
            //   Items = JsonConvert.DeserializeObject<Scenario>(await Outils.InvokeMethod("scenario::all"));



            string result = await Outils.InvokeMethod("scenario::all");

            App.JsonScenario = result;
            dynamic stuff = JsonConvert.DeserializeObject(result);

            if (stuff.error != null)
            {
                this.error = stuff.error.message;
            }
            else
            {
                if (!String.IsNullOrEmpty(result))
                {
                    Items             = JsonConvert.DeserializeObject <Scenario>(result);
                    this.IsDataLoaded = true;
                }
            }
            OnDataLoadEvent();
        }
Пример #2
0
 private async void Scenario_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (sender == null)
     {
         return;
     }
     string id     = ((sender as StackPanel).Tag as Result).id;
     string result = await Outils.InvokeMethod("scenario::changeState", id, false, "state", "run");
 }
Пример #3
0
        private async void TextBlock_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            string result = await Outils.InvokeMethod("message::removeAll");

            this.DataContext = null;
        }
Пример #4
0
        /// <summary>
        /// Crée et ajoute quelques objets ItemViewModel dans la collection Items.
        /// </summary>
        public async void LoadData()
        {
            String result = await Outils.InvokeMethod("object::full");

            App.JsonDashboard = result;

            //
            dynamic stuff = JsonConvert.DeserializeObject(result);

            if (stuff.error != null)
            {
                this.error = stuff.error.message;
            }
            else
            {
                if (!String.IsNullOrEmpty(result))
                {
                    Items             = JsonConvert.DeserializeObject <Pluggins>(result);
                    this.IsDataLoaded = true;
                }
            }
            OnDataLoadEvent();

            /*
             * if (String.IsNullOrEmpty(setting.IPSetting)) return;
             *
             * var jsonObject = new JObject();
             *
             * jsonObject.Add("jsonrpc", "2.0");
             * jsonObject.Add("id", 1);
             * jsonObject.Add("method", "object::full");
             * JObject myParam = new JObject();
             * myParam.Add("apikey", setting.ApiKeySetting);
             * jsonObject.Add("params", myParam);
             *
             * try {
             *
             *  string url =  setting.IPKey;
             *  string JsonStringParams = jsonObject.ToString(); //"{\"jsonrpc\": \"2.0\", \"method\": \"plugin::listPlugin\", \"params\" : {\"apikey\": \"bae8j2vfxveutlx23bvs\"}, \"id\" : 1}";
             *  var searchParameters = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("request", JsonStringParams) };
             *
             *  using (var httpclient = new HttpClient())
             *  {
             *      using (var content = new FormUrlEncodedContent(searchParameters))
             *      {
             *          using (var responseMessages = await httpclient.PostAsync(new Uri(url, UriKind.Absolute), content))
             *          {
             *              string x = await responseMessages.Content.ReadAsStringAsync();
             *              if (!String.IsNullOrEmpty(x))
             *              {
             *                  Items = JsonConvert.DeserializeObject<Pluggins>(x);
             *                  this.IsDataLoaded = true;
             *              }
             *              OnDataLoadEvent();
             *              // MessageBox.Show(result);
             *          }
             *      }
             *  }
             * }catch(UriFormatException e) {
             *
             *  throw e;
             * }
             */
        }
Пример #5
0
 private void RestartJeedom(object sender)
 {
     Outils.InvokeMethod("jeeNetwork::reboot");
 }
Пример #6
0
 private void StopJeedom(object sender)
 {
     Outils.InvokeMethod("jeeNetwork::halt");
 }
Пример #7
0
 private void UpdateJeedom(object sender)
 {
     Outils.InvokeMethod("update::update");
 }