public void DestroyGroup(GroupCell cell) { int index = this.cellList.IndexOf(cell); if (index < 0) { Log.Error(this, "Wrong, Index of cell Error", index); index = 0; } this.cellList.Remove(cell); if (index >= this.cellList.Count) { index = this.cellList.Count - 1; } if (this.selectedGroup == cell) { this.selectedGroup = null; } string groupName = (cell.data as GroupData).groupName; cell.data = null; Model.groupProxy.DestroyGroup(groupName); GameObject.Destroy(cell.gameObject); if (this.selectedGroup == null && this.cellList.Count > 0) { SelectGroupCell(this.cellList [index]); } }
/// <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; }
void OnEditGroupCellCancel(GroupCell cell) { if (cell.data == null) { GameObject.Destroy(cell.gameObject); } else { } }
private void PopulateFavoriteList(string pattern) { treeDest.BeginUpdate(); treeDest.Nodes.Clear(); var sc = new SortedDictionary <string, List <string> >(); foreach (var cellNumber in Map.Cells.Keys) { var cell = Map.Cells[cellNumber]; if (cell.Tooltip.IndexOf(pattern, StringComparison.CurrentCultureIgnoreCase) >= 0) { if (!sc.ContainsKey(cell.Tooltip)) { sc.Add(cell.Tooltip, new List <string> { cell.CellNumber }); } else { sc[cell.Tooltip].Add(cell.CellNumber); } } } if (sc.Count > 0) { var treeNode = MakeGroupNode("Подходящие названия"); foreach (var gc in sc) { if (gc.Value.Count == 1) { AddLocation(treeNode, gc.Value[0]); } else { var groupCell = new GroupCell(gc.Key); foreach (var cellNumber in gc.Value) { groupCell.AddCell(cellNumber); } AddGroupLocation(treeNode, groupCell); } } } treeDest.EndUpdate(); if (treeDest.Nodes.Count > 0) { treeDest.Nodes[0].Expand(); } }
public void SelectGroupCell(GroupCell cell) { if (this.selectedGroup != null) { this.selectedGroup.SetSelected(false); } this.selectedGroup = cell; if (this.selectedGroup != null) { this.selectedGroup.SetSelected(true); } }
GroupCell CreateGroupCell() { GameObject groupCellObj = AssetsCenter.InstantiateGameObject(Constants.groupCellPath); groupCellObj.name = "GroupCell"; groupCellObj.transform.SetParent(groupContent); groupCellObj.transform.localScale = Vector3.one; GroupCell gc = groupCellObj.GetComponent <GroupCell> (); this.cellList.Add(gc); return(gc); }
void OnEditGroupCellConfirm(GroupCell cell, string name) { if (cell.data == null) { GroupData gData = Model.groupProxy.CreateGroup(name); cell.SetData(gData); cell.SwitchToShowMode(); SelectGroupCell(cell); } else { } }
void InitGroup() { foreach (KeyValuePair <string, GroupData> kv in Model.groupProxy.groups) { GroupCell gc = CreateGroupCell(); gc.SetData(kv.Value); gc.SwitchToShowMode(); if (this.selectedGroup == null) { SelectGroupCell(gc); } else { gc.SetSelected(false); } } }
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); } }
/// <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; }
private void PopulateSkinRes(TreeNode parent, string title, string pattern) { var list = new List <string>(); foreach (var cellNumber in Map.Cells.Keys) { var cell = Map.Cells[cellNumber]; if (cell.IsBot(pattern)) { list.Add(cell.CellNumber); } } var groupCell = new GroupCell(title); foreach (var cellNumber in list) { groupCell.AddCell(cellNumber); } AddGroupLocation(parent, groupCell); //var rootNode = MakeNode(parent, title, cellNumber); }
void OnAddGroup() { GroupCell gc = CreateGroupCell(); gc.SwitchToEditMode(this.OnEditGroupCellConfirm, this.OnEditGroupCellCancel); }
public void ClosePanel() { this.mInputField.text = ""; this.currGroup = null; this.gameObject.SetActive(false); }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { if (indexPath.Row < Parent.GroupEntries.Count) { GroupCell cell = tableView.DequeueReusableCell(GroupCell.Identifier) as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new GroupCell(UITableViewCellStyle.Default, GroupCell.Identifier); cell.TableSource = this; // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); } // if it's the group nearest the user, color it different. (we always sort by distance) if (SelectedIndex == indexPath.Row) { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color); } else { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor); } cell.RowIndex = indexPath.Row; // Create the title cell.Title.Text = Parent.GroupEntries[indexPath.Row].Name; cell.Title.SizeToFit( ); // Meeting time - If it isn't set, just blank it out and we wont' show anything for that row. if (string.IsNullOrEmpty(Parent.GroupEntries[indexPath.Row].MeetingTime) == false) { cell.MeetingTime.Text = Parent.GroupEntries[indexPath.Row].MeetingTime; } else { cell.MeetingTime.Text = ConnectStrings.GroupFinder_ContactForTime; } cell.MeetingTime.SizeToFit( ); // Distance cell.Distance.Text = string.Format("{0:##.0} {1}", Parent.GroupEntries[indexPath.Row].DistanceFromSource, ConnectStrings.GroupFinder_MilesSuffix); if (indexPath.Row == 0) { cell.Distance.Text += " " + ConnectStrings.GroupFinder_ClosestTag; } cell.Distance.SizeToFit( ); // Childcare and Young Adults cell.Filters.Text = string.Empty; if (string.IsNullOrWhiteSpace(Parent.GroupEntries[indexPath.Row].Filters) == false) { if (Parent.GroupEntries[indexPath.Row].Filters.Contains(PrivateConnectConfig.GroupFinder_Childcare_Filter)) { cell.Filters.Text = ConnectStrings.GroupFinder_OffersChildcare; } if (Parent.GroupEntries[indexPath.Row].Filters.Contains(PrivateConnectConfig.GroupFinder_YoungAdults_Filter)) { if (cell.Filters.Text.Length > 0) { cell.Filters.Text += ", "; } cell.Filters.Text += ConnectStrings.GroupFinder_YoungAdults; } } cell.Filters.SizeToFit( ); // pick a nice magic number for the cell height PendingCellHeight = 105.0f; // first, always put the title at the top cell.Title.Frame = new CGRect(10, 1, cell.Frame.Width - 55, cell.Title.Frame.Height + 5); cell.MeetingTime.Frame = new CGRect(10, cell.Title.Frame.Bottom, cell.Frame.Width - 5, cell.MeetingTime.Frame.Height); cell.Distance.Frame = new CGRect(10, cell.MeetingTime.Frame.Bottom, cell.Frame.Width - 5, cell.Distance.Frame.Height); cell.Filters.Frame = new CGRect(10, cell.Distance.Frame.Bottom, cell.Frame.Width - 5, cell.Distance.Frame.Height); cell.Seperator.Frame = new CGRect(0, PendingCellHeight - 1, cell.Bounds.Width, 1); cell.JoinButton.Frame = new CGRect(cell.Bounds.Width - cell.JoinButton.Bounds.Width, (PendingCellHeight - cell.JoinButton.Bounds.Height) / 2, cell.JoinButton.Bounds.Width, cell.JoinButton.Bounds.Height); return(cell); } else if (indexPath.Row == Parent.GroupEntries.Count) { // the last row should act as a "get more groups" button // simply create a dummy cell that acts as padding UITableViewCell cell = tableView.DequeueReusableCell("10_more") as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "10_more"); UILabel textLabel = new UILabel( ); textLabel.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize); textLabel.Layer.AnchorPoint = CGPoint.Empty; textLabel.TextColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor); textLabel.BackgroundColor = UIColor.Clear; textLabel.LineBreakMode = UILineBreakMode.TailTruncation; textLabel.Text = ConnectStrings.GroupFinder_10More; textLabel.TextAlignment = UITextAlignment.Center; cell.AddSubview(textLabel); // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, 44); textLabel.Bounds = cell.Bounds; // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = UIColor.Clear; } return(cell); } else { // simply create a dummy cell that acts as padding UITableViewCell cell = tableView.DequeueReusableCell("dummy") as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell(UITableViewCellStyle.Default, "dummy"); // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect(cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, 44); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = UIColor.Clear; } return(cell); } }
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { if ( indexPath.Row < Parent.GroupEntries.Count ) { GroupCell cell = tableView.DequeueReusableCell( GroupCell.Identifier ) as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new GroupCell( UITableViewCellStyle.Default, GroupCell.Identifier ); cell.TableSource = this; // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height ); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ); } // if it's the group nearest the user, color it different. (we always sort by distance) if ( SelectedIndex == indexPath.Row ) { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ); } else { cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ); } cell.RowIndex = indexPath.Row; // Create the title cell.Title.Text = Parent.GroupEntries[ indexPath.Row ].Title; cell.Title.SizeToFit( ); // Meeting time - If it isn't set, just blank it out and we wont' show anything for that row. if ( string.IsNullOrEmpty( Parent.GroupEntries[ indexPath.Row ].MeetingTime ) == false ) { cell.MeetingTime.Text = Parent.GroupEntries[ indexPath.Row ].MeetingTime; } else { cell.MeetingTime.Text = ConnectStrings.GroupFinder_ContactForTime; } cell.MeetingTime.SizeToFit( ); // Distance cell.Distance.Text = string.Format( "{0:##.0} {1}", Parent.GroupEntries[ indexPath.Row ].Distance, ConnectStrings.GroupFinder_MilesSuffix ); if ( indexPath.Row == 0 ) { cell.Distance.Text += " " + ConnectStrings.GroupFinder_ClosestTag; } cell.Distance.SizeToFit( ); // Position the Title & Address in the center to the right of the image cell.Title.Frame = new CGRect( 10, 5, cell.Frame.Width - 5, cell.Title.Frame.Height ); cell.MeetingTime.Frame = new CGRect( 10, cell.Title.Frame.Bottom, cell.Frame.Width - 5, cell.MeetingTime.Frame.Height + 5 ); cell.Distance.Frame = new CGRect( 10, cell.MeetingTime.Frame.Bottom - 6, cell.Frame.Width - 5, cell.Distance.Frame.Height + 5 ); // add the seperator to the bottom cell.Seperator.Frame = new CGRect( 0, cell.Distance.Frame.Bottom + 5, cell.Bounds.Width, 1 ); PendingCellHeight = cell.Seperator.Frame.Bottom; cell.JoinButton.Frame = new CGRect( cell.Bounds.Width - cell.JoinButton.Bounds.Width, ( PendingCellHeight - cell.JoinButton.Bounds.Height ) / 2, cell.JoinButton.Bounds.Width, cell.JoinButton.Bounds.Height ); return cell; } else { // simply create a dummy cell that acts as padding UITableViewCell cell = tableView.DequeueReusableCell( "dummy" ) as GroupCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new UITableViewCell( UITableViewCellStyle.Default, "dummy" ); // take the parent table's width so we inherit its width constraint cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, 44 ); // remove the selection highlight cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell.BackgroundColor = UIColor.Clear; } return cell; } }
// ---------------- методы ---------------- public ScheduleViewModel () { //Инициализация данных Title = "Расписание"; dateSchedule = DateTime.Now; CloseCommand = new RelayCommand (o => { var intent = CreateIntent (); intent.GoBack (); }); FromScheduleCommand = new RelayCommand (o => { var vc = o as UIViewController; if(vc!=null){ var fromSearchList = FromStations (); ShowSearchSearchView("from", vc,fromSearchList); } }); ToScheduleCommand = new RelayCommand (o => { var vc = o as UIViewController; if(vc!=null){ var toSearchList = ToStations (); ShowSearchSearchView("to", vc,toSearchList); } }); items = new GroupRoot (); section1 = new GroupSection (); fromCell = new GroupCell (); fromCell.Tag = CellType_FromSchedule; fromCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick; fromCell.SecondaryText="From"; toCell = new GroupCell (); toCell.Tag = CellType_ToSchedule; toCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick; toCell.SecondaryText="To"; dateCell = new GroupCell (); dateCell.Tag = CellType_DateSchedule; dateCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick; dateCell.PrimaryText="Date"; dateCell.SecondaryText = DateScheduleToString; dateCell.Command = new RelayCommand (o => { OnShowSelectDateHandler(o); }); switchCell = new GroupCell (); switchCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick; switchCell.PrimaryText = "Отображать все станции"; switchCell.Tag = CellType_Switch; switchCell.Data = true; section1.Add (fromCell); section1.Add (toCell); section1.Add (dateCell); section1.Add (switchCell); items.Add (section1); }
// ---------------- методы ---------------- public InfoStationViewModel (Station station) { Title = "Станция"; //Инициализация данных от станции //Создание списка данных и последающая их передача вьюшке this.station = station; CloseCommand = new RelayCommand (o => { var intent = CreateIntent (); intent.GoBack (); }); items = new GroupRoot (); var section1 = new GroupSection (); var section2 = new GroupSection (); //ячейка - Страна var countryCell = new GroupCell (); countryCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick; countryCell.PrimaryText = "Country"; countryCell.Tag = CellType_Default; countryCell.SecondaryText = station.CountryTitle; section1.Add (countryCell); //ячейка - Город var cityCell = new GroupCell (); cityCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick; cityCell.PrimaryText = "City"; cityCell.Tag = CellType_Default; cityCell.SecondaryText = station.CityTitle; section1.Add (cityCell); if (!string.IsNullOrEmpty (station.RegionTitle)) { //ячейка - Регион var regionCell = new GroupCell (); regionCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick; regionCell.PrimaryText = "Region"; regionCell.Tag = CellType_Default; regionCell.SecondaryText = station.RegionTitle; section1.Add (regionCell); } if (!string.IsNullOrEmpty (station.StationTitle)) { //ячейка - Описание станции var titleCell = new GroupCell (); titleCell.CellStyle = GroupCellStyle.Custom| GroupCellStyle.RowClick; titleCell.PrimaryText = station.StationTitle; titleCell.Tag = CellType_ExtendedText; section1.Add (titleCell); } items.Add (section1); //Если есть данные о локации if (station.Point != null) { //ячейка - локация var pointCell = new GroupCell (); pointCell.CellStyle = GroupCellStyle.Custom | GroupCellStyle.RowClick; pointCell.PrimaryText = "Point"; pointCell.Tag = CellType_Date; pointCell.Data = station; pointCell.Command = new RelayCommand (o => { OpenMapForPlace(); }); section2.Add (pointCell); items.Add (section2); } }
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(); } }
public void OpenPanel(GroupCell group) { this.currGroup = group; this.gameObject.SetActive(true); }