public void ActivateFor(ExtPersonController block) { //cancel if not saved if (block.VM.Persistent.Person.RowId == 0) { UIGlobals.Do.ShowTimedMessge("Save before creating links"); return; } Source = block; VM.IsActive = true; VM.Instructions = "Use this to link/relink/unlink this person. Open a task, note, or another person to see all options."; VM.Items.Clear(); var ep = block.VM.Persistent; //convert ExtPerson.Links to VM items foreach (var link in ep.Links) { var item = new RecordLinkVM.ItemVM { IsSticky = true, ButtonText = "Unlink", Command = new LinkInstruction { FromId = ep.Person.RowId, IsRemove = true, Link = link.Link, ToId = link.OtherId, ToDescription = link.Description } }; item.Description = $"'{ep.Person.Name}' is linked to '{link.Description}'"; VM.Items.Add(item); } }
public void ActivateFor(ExtBoxController block) { //cancel if not saved if (block.VM.Persistent.Box.RowId == 0) { UIGlobals.Do.ShowTimedMessge("Save before creating links"); return; } Source = block; VM.IsActive = true; VM.Instructions = "Use this to link/relink/unlink this item. Open another task, note, or person to see all options."; VM.Items.Clear(); var box = block.VM.Persistent; //convert ExtBox.Links to VM items foreach (var link in box.Links) { //don't show child boxes - there could be many of them and there is a lot of complexity with the ui, since the child //box could be open with unsaved changes if (link.Link == LinkType.FromBoxToChildBox) { continue; } var item = new RecordLinkVM.ItemVM { IsSticky = true, ButtonText = "Unlink", Command = new LinkInstruction { FromId = box.Box.RowId, IsRemove = true, Link = link.Link, ToId = link.OtherId, ToDescription = link.Description } }; if (link.Link == LinkType.FromBoxToParentBox) { item.Description = $"'{box.Box.Title}' is a sub-item of {link.Description}"; } else { item.Description = $"'{box.Box.Title}' is linked to {link.Description}"; } VM.Items.Add(item); } }