//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void UpdateViewValues()
        {
            FilterTable.ReloadData();

            int index = DataManager.nodesFilters.FindIndex((NodeFilter obj) => obj.group == DataManager.selectedNodesFilter);

            if (index >= 0)
            {
                FilterTable.SelectRow(NSIndexPath.FromRowSection(index, 0), false, UITableViewScrollPosition.Middle);
            }

            ServerButton.SetTitle(DataManager.ServerName, UIControlState.Normal);
            UserButton.SetTitle(DataManager.UserName, UIControlState.Normal);
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        private void UpdateViewValues()
        {
            int selectedIndex = 0;

            filterList.Clear();

            if (DataManager.filterToSelect is City)
            {
                filterKind = "Выберите город";
                foreach (var item in DataManager.cities)
                {
                    filterList.Add(new FilterObject("", item.Value.name, "", item.Value));
                    if ((DataManager.selectedCity != null) && (item.Value.ID == DataManager.selectedCity.ID))
                    {
                        selectedIndex = filterList.Count - 1;
                    }
                }
            }
            else if (DataManager.filterToSelect is Division)
            {
                filterKind = "Выберите подразделение";
                foreach (var item in DataManager.divisions)
                {
                    if ((DataManager.selectedCity == null) || (item.Value.city.ID == DataManager.selectedCity.ID) || (DataManager.selectedCity.ID == 0) || (item.Value.ID == 0))
                    {
                        filterList.Add(new FilterObject("", item.Value.name + " (" + item.Value.city.name + ")", "", item.Value));
                        if ((DataManager.selectedDivision != null) && (item.Value.ID == DataManager.selectedDivision.ID))
                        {
                            selectedIndex = filterList.Count - 1;
                        }
                    }
                }
            }
            else if (DataManager.filterToSelect is MachineType)
            {
                filterKind = "Выберите тип оборудования";
                foreach (var item in DataManager.machineTypes)
                {
                    filterList.Add(new FilterObject("", item.Value.name, item.Value.iconName, item.Value));
                    if ((DataManager.selectedMachineType != null) && (item.Value.ID == DataManager.selectedMachineType.ID))
                    {
                        selectedIndex = filterList.Count - 1;
                    }
                }
            }
            else if (DataManager.filterToSelect is MachineState)
            {
                filterKind = "Выберите рабочее состояние";
                foreach (var item in DataManager.machineStates)
                {
                    filterList.Add(new FilterObject("", item.Value.name, item.Value.iconName, item.Value));
                    if ((DataManager.selectedMachineState != null) && (item.Value.ID == DataManager.selectedMachineState.ID))
                    {
                        selectedIndex = filterList.Count - 1;
                    }
                }
            }
            else if (DataManager.filterToSelect is MachineServiceState)
            {
                filterKind = "Выберите сервисное состояние";
                foreach (var item in DataManager.machineServiceStates)
                {
                    filterList.Add(new FilterObject("", item.Value.name, item.Value.iconName, item.Value));
                    if ((DataManager.selectedMachineServiceState != null) && (item.Value.ID == DataManager.selectedMachineServiceState.ID))
                    {
                        selectedIndex = filterList.Count - 1;
                    }
                }
            }

            FilterTable.ReloadData();

            if (filterList.Count != 0)
            {
                FilterTable.SelectRow(NSIndexPath.FromRowSection(selectedIndex, 0), false, UITableViewScrollPosition.Middle);
            }
        }