Beispiel #1
0
        public async Task SetActiveZoneViewModel(string zoneUdn)
        {
            if (string.IsNullOrEmpty(zoneUdn))
            {
                zoneUdn = await ApplicationData.Current.LocalSettings.ReadAsync <string>("ACTIVEZONE");

                zoneUdn = ZoneViewModels.Select(z => z).Where(z => z.Udn == zoneUdn).FirstOrDefault()?.Udn;
                if (string.IsNullOrEmpty(zoneUdn))
                {
                    zoneUdn = ZoneViewModels.First().Udn;
                    await ApplicationData.Current.LocalSettings.SaveAsync("ACTIVEZONE", zoneUdn);
                }
            }

            foreach (var zone in ZoneViewModels)
            {
                if (zone.Udn == zoneUdn)
                {
                    zone.IsActive = true;
                    (SecondaryItems.Select(i => i).Where(i => i.GetType() == typeof(ManageZonesNavigationViewModel)).FirstOrDefault()).Label = zone.Name;
                    ActiveZoneViewModel = zone;

                    await ApplicationData.Current.LocalSettings.SaveAsync("ACTIVEZONE", zone.Udn);
                }
                else
                {
                    zone.IsActive = false;
                }
            }
        }
Beispiel #2
0
        internal void UpdateItems()
        {
            _bar.RemoveAllViews();

            if (SecondaryItems != null)
            {
                foreach (var control in SecondaryItems.Select(item => DroidFactory.GetNativeObject <Android.Views.View>(item, "item")).Where(item => item != null))
                {
                    _bar.AddView(control);
                }
            }

            if (PrimaryItems == null || !PrimaryItems.Any())
            {
                return;
            }
            {
                _bar.AddView(new Android.Views.View(Context), new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1));
                foreach (var control in PrimaryItems.Select(item => DroidFactory.GetNativeObject <Android.Views.View>(item, "item")).Where(item => item != null))
                {
                    _bar.AddView(control);
                }
            }
        }