Example #1
0
		/// <summary>
		/// Метод для создания ячеек
		/// </summary>
		/// <returns>The cell.</returns>
		/// <param name="tableView">Table view.</param>
		/// <param name="item">Item.</param>
		/// <param name="index">Index.</param>
		UITableViewCell CreatorCell(UITableView tableView, GroupCell item, NSIndexPath index){
			var cell = tableView.DequeueReusableCell (item.Tag ?? item.ToString ());
			switch (item.Tag) {
			case ScheduleViewModel.CellType_FromSchedule:
				TextFieldViewCell fromCell;
				if(cell == null){
					fromCell = TextFieldViewCell.Create ();
					fromCell.TextField.Placeholder = item.SecondaryText;
					fromCell.TextField.Started += (s, e) => viewModel.FromScheduleCommand.Execute (this);
					fromCell.TextField.InputView = new UIView ();
					cell = fromCell;
				}else{
					fromCell = cell as TextFieldViewCell;
				}
				fromCell.TextField.Text = item.PrimaryText;
				break;
			case ScheduleViewModel.CellType_ToSchedule:
				TextFieldViewCell toCell;
				if(cell == null){
					toCell = TextFieldViewCell.Create ();
					toCell.TextField.Placeholder = item.SecondaryText;
					toCell.TextField.Started += (s, e) => viewModel.ToScheduleCommand.Execute (this);
					toCell.TextField.InputView = new UIView ();
					cell = toCell;
				}else{
					toCell = cell as TextFieldViewCell;
				}
				toCell.TextField.Text = item.PrimaryText;
				break;	
			case ScheduleViewModel.CellType_DateSchedule:
				TextRangeViewCell dateCell;
				if (cell == null) {
					dateCell = TextRangeViewCell.Create (item.Tag);
					cell = dateCell;
				} else {
					dateCell = cell as TextRangeViewCell;
				}
				dateCell.TextLabel.Text = item.PrimaryText;
				dateCell.TextLabel.TextColor = UIColor.FromRGB (199, 199, 205);
				dateCell.AccessorText = item.SecondaryText;
				break;
			case ScheduleViewModel.CellType_Switch:
				SwitchRangeViewCell switchCell;
				if (cell == null) {
					switchCell = SwitchRangeViewCell.Create (item.Tag);
					switchCell.ChangeSwitch += (s, e) => viewModel.UpdateShowAll(e);
					cell = switchCell;
				} else {
					switchCell = cell as SwitchRangeViewCell;
				}
				switchCell.TextLabel.Text = item.PrimaryText;
				switchCell.AccessorOn = (bool)item.Data;
				break;
			}
			return cell;
		}
Example #2
0
        private static void AddGroupLocation(TreeNode parentNode, GroupCell groupCell)
        {
            if (groupCell.Cells.Count == 0)
            {
                return;
            }

            var tooltip    = groupCell.ToString();
            var tag        = groupCell.GetCells();
            var cellNumber = groupCell.Cells.Count == 1 ? tag : groupCell.GetCells();
            var name       = $"({groupCell.Cells.Count}шт) {tooltip}";
            var tgroup     = MakeNode(parentNode, name, cellNumber);

            foreach (var cellNumver in groupCell.Cells.Keys)
            {
                AddLocation(tgroup, cellNumver);
            }
        }
Example #3
0
		/// <summary>
		/// Метод для создания ячеек
		/// </summary>
		/// <returns>The cell.</returns>
		/// <param name="tableView">Table view.</param>
		/// <param name="item">Item.</param>
		/// <param name="index">Index.</param>
		static UITableViewCell CreatorCell(UITableView tableView, GroupCell item, NSIndexPath index){
			var cell = tableView.DequeueReusableCell (item.Tag ?? item.ToString ());
			switch (item.Tag) {
			case InfoStationViewModel.CellType_Default:
				TextRangeViewCell defaultCell;
				if (cell == null) {
					defaultCell = TextRangeViewCell.Create (item.Tag);
					cell = defaultCell;
				} else {
					defaultCell = cell as TextRangeViewCell;
				}
				defaultCell.TextLabel.Text = item.PrimaryText;
				defaultCell.AccessorText = item.SecondaryText;
				break;
			case InfoStationViewModel.CellType_Date:
				MapViewCell mapCell;
				var station = item.Data as Station;
				if (station != null) {
					if (cell == null) {
						item.Height = (float)tableView.Bounds.Width;
						mapCell = MapViewCell.Create ();
						mapCell.Config ();
						cell = mapCell;
					} else {
						mapCell = cell as MapViewCell;
					}
					mapCell.UpdateLocation (station.Point, station.StationTitle, station.RegionTitle);
				}
				break;
			case InfoStationViewModel.CellType_ExtendedText:
				ExtendedTextViewCell extendedCell;
				if (cell == null) {
					extendedCell = ExtendedTextViewCell.Create ();
					cell = extendedCell;
				} else {
					extendedCell = cell as ExtendedTextViewCell;
				}
				extendedCell.PrimaryLabel.Text = item.PrimaryText;
				break;
			}
			return cell;
		}
Example #4
0
        internal FormNavigator(string destination, string loc, string loc2, string nick)
        {
            InitializeComponent();

            _herbs = new SortedDictionary <string, GroupCell>();
            _bots  = new SortedDictionary <string, GroupCell>();
            foreach (var cellNumber in Map.Cells.Keys)
            {
                _scAutoComplete.Add(cellNumber);

                Cell cell;
                if (!Map.Cells.TryGetValue(cellNumber, out cell))
                {
                    continue;
                }

                if (!string.IsNullOrEmpty(cell.HerbGroup) && !cell.HerbGroup.Trim().Equals("0"))
                {
                    var sp = cell.HerbGroup.Split(',');
                    foreach (var herbString in sp)
                    {
                        int level;
                        if (int.TryParse(herbString.Trim(), out level))
                        {
                            var group = new GroupCell("Травы", level);
                            var key   = group.ToString();
                            if (!_herbs.ContainsKey(key))
                            {
                                _herbs.Add(key, group);
                            }

                            _herbs[key].AddCell(cellNumber);
                        }
                    }
                }

                if (cell.MapBots != null && cell.MapBots.Count > 0)
                {
                    foreach (var mapBot in cell.MapBots)
                    {
                        var level = mapBot.MaxLevel;
                        var group = new GroupCell(mapBot.Name, level);
                        var key   = group.ToString();
                        if (!_bots.ContainsKey(key))
                        {
                            _bots.Add(key, group);
                        }

                        _bots[key].AddCell(cellNumber);
                    }
                }
            }

            textDest.AutoCompleteCustomSource = _scAutoComplete;

            _destination = destination;
            if (string.IsNullOrEmpty(_destination))
            {
                _destination = AppVars.Profile.MapLocation;
            }

            textDest.Text = _destination;

            PopulateStandardList();

            var navscriptmanager = new NavScriptManager(this);

            browserMap.Name = "browserMap";
            browserMap.ScriptErrorsSuppressed = true;
            browserMap.ObjectForScripting     = navscriptmanager;

            PointToDest(new [] { _destination });

            _compas     = null;
            _compasnick = null;
            if (loc == null)
            {
                return;
            }

            _compasnick = nick;
            if (loc == "Природа")
            {
                var tlist = new List <string>();
                foreach (var pos in Map.Cells.Keys)
                {
                    var c = Map.Cells[pos];
                    if (c.Tooltip.Equals(loc2, StringComparison.OrdinalIgnoreCase))
                    {
                        tlist.Add(pos);
                    }
                }

                _compas = tlist.ToArray();
            }
        }