public static ActionSetModel FromEmbeddedData(IModelsProvider provider, IDbActionSet entry) { var model = new ActionSetModel(); foreach (var actionEntry in entry.Actions) { var newAction = new ActionModel(); newAction.Name = actionEntry.Name; newAction.Id = actionEntry.Id; newAction.Visibility = actionEntry.Presentation.Visibility; newAction.Description = actionEntry.Description; FromEntry(newAction, actionEntry.Presentation); model.Items.Add(newAction); } //Items.UpdateAfter(() => //{ // Items.Clear(); // foreach (var item in entry.Actions) // { // var newAction = NewItem(); // newAction.FromModel(item); // Items.Add(newAction); // } //}); return(model); }
public virtual void UpdateVM(IDbActionSet entry) { model = actionSetsDataProvider.GetActionSet(entry.Id); Items.UpdateAfter(() => { Items.Clear(); foreach (var item in model.Items) { Items.Add(new ActionVM(item)); } }); SelectedIndex = 0; }
private void DrawAction(ActionSetModel actionSet, int id, float x, float y, int tileSize) { if (id >= actionSet.Items.Count) { return; } var action = actionSet.Items[id]; if (!action.Visibility) { return; } var image = action.Icon; Target.DrawImage(image, x, y, tileSize, tileSize); }