Esempio n. 1
0
        private void btnRemove_Clicked(NavigationContext ctx, Button control, UIEvent args)
        {
            var bdaddr = control?.TagStr;

            DebugEx.TraceLog("BDAddr: " + bdaddr);
            //delete things from cloud
            flicThings.ForEach(f => { if (f.Key.ToString() == bdaddr)
                                      {
                                          try { DeleteThing(f.Value.ThingKey); } catch (Exception ex) { DebugEx.Assert(ex); }
                                      }
                               });
            //delete specific flicThing from local Dictionary
            flicThings.RemoveWhere(x => x.Key.ToString() == bdaddr);
            //flicd will be closed, hence all channels should be recreated
            ButtonChannels.Clear();
            DebugEx.TraceLog("=======>" + ActiveCfg.PythonServer + ActiveCfg.restrouteremoveflic + "<=========");
            Dictionary <string, string> data = new Dictionary <string, string>()
            {
                { "bdaddr", bdaddr }
            };
            var rsp = Yodiwo.Tools.Http.RequestGET(ActiveCfg.PythonServer + ActiveCfg.restrouteremoveflic, data, null);

            DebugEx.TraceLog("=======>Single Flic Removal<======" + rsp.ResponseBodyText);
            //return to mainpage
            ctx.UpdateCurrentPage(createDiscoverPage());
        }