public override async Task OnAppearingAsync() { await _layerService.InitializeData(); var zones = await _zoneService.GetAllZoneContractsAsync(); ZonesList.Clear(); foreach (var zone in zones) { var zoneUsers = _layerService.UsersInsideZone(zone.ZoneID); ZonesList.Add(new ZoneViewModel(zone, zoneUsers)); } IsBusy = false; }
public override async Task OnAppearingAsync() { await _zoneService.InitializeData(); ZonesList.Clear(); var zones = await _zoneService.GetAllZoneContractsAsync(); foreach (var zone in zones) { ZonesList.Add(new ZoneViewModel(zone)); } var profile = await _requestService.GetAsync <UserInfoContract>("api/UserInfoSelf"); UserProfile = new ProfileViewModel() { UserInfo = profile }; IsBusy = false; }
private void AreasList_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { ZonesList.Items.Clear(); if (AreasList.SelectedItems.Count > 0) { int area = Int32.Parse(AreasList.SelectedItems[0].Name); //m1.collectNames(TextDescriptionType.TEXT_ZoneName); // For each zone defined which uses this area... var states = m1.getZoneStatuses(); foreach (int index in m1.getZonePartitions().Select((zArea, index) => { if (area == zArea) { return(index); } else { return(-1); } }).Intersect(m1.getConfiguredZones())) { // Add it to the list ZonesList.Items.Add(new ListViewItem { Name = index.ToString(), Text = m1.getTextDescription(TextDescriptionType.TEXT_ZoneName, index), }); ZonesList.Columns[0].Width = -1; switch (states[index].logicalState) { case LogicalZoneState.LZS_BYPASSED: ZonesList.Items[index.ToString()].ImageKey = "zone_bypassed"; ZonesList.Items[index.ToString()].SubItems.Add("Bypassed"); break; case LogicalZoneState.LZS_NORMAL: ZonesList.Items[index.ToString()].ImageKey = "zone_normal"; ZonesList.Items[index.ToString()].SubItems.Add("Normal"); break; case LogicalZoneState.LZS_TROUBLE: ZonesList.Items[index.ToString()].ImageKey = "zone_trouble"; ZonesList.Items[index.ToString()].SubItems.Add("Troubled"); break; case LogicalZoneState.LZS_VIOLATED: ZonesList.Items[index.ToString()].ImageKey = "zone_violated"; ZonesList.Items[index.ToString()].SubItems.Add("Violated"); break; } switch (states[index].physicalState) { case PhysicalZoneState.PZS_EOL: ZonesList.Items[index.ToString()].SubItems.Add("EOL"); break; case PhysicalZoneState.PZS_OPEN: ZonesList.Items[index.ToString()].SubItems.Add("Open"); break; case PhysicalZoneState.PZS_SHORT: ZonesList.Items[index.ToString()].SubItems.Add("Short"); break; } } ZonesList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); } }