예제 #1
0
 // back to main page
 internal void CloseWindow()
 {
     try
     {
         Device.BeginInvokeOnMainThread(() =>
         {
             VMNavigation.PopToRootAsync(true);
         });
     }
     catch (Exception ex)
     {
         //Logger.Instance.Error($"CloseWindow exception, {ex.Message}");
     }
 }
예제 #2
0
        public async Task <ActionResult> Navigation(int?id)
        {
            List <Item>       LocationsAll = db.Items.ToList(); List <Item> Locations = new List <Item>();
            type              _type = new type(); string url = string.Empty; Item _locationSelected = new Item();
            List <Indicators> _indicators = new List <Indicators>();

            if (id != null)
            {
                Locations         = LocationsAll.Where(x => x.ParentId == id).ToList();
                _type             = LocationsAll.Where(x => x.id == id).Select(x => x.Nodo).FirstOrDefault();
                _locationSelected = LocationsAll.Where(x => x.id == id).FirstOrDefault();
                url = PIWebAPIClient.RequestDirectory(_type.ToString());
                try
                {
                    JObject data = await client.GetAsync(url);

                    _indicators           = CastData(data);
                    Session["Indicators"] = _indicators;
                    _locationSelected     = LocationsAll.Where(x => x.id == id).FirstOrDefault();
                }
                catch {
                    JObject data = null;
                    _indicators           = CastData(data);
                    Session["Indicators"] = _indicators;
                }
            }

            VMNavigation _vm = new VMNavigation()
            {
                Locations        = Locations,
                MyMenu           = BuildMenu(id),
                IndicatorsValues = _indicators,
                LocationSelected = _locationSelected
            };

            return(View(_vm));
        }