示例#1
0
 public EntryViewModel(IEntry model, ICommandsAggregateService commands,
                       Func <IIdentifier, IdentifierViewModel> identifierVmFactory,
                       Func <IBookIndex, BookIndexViewModel> bookIndexVmFactory,
                       Func <IEntryLimits, EntryLimitsViewModel> entryLimitsVmFactory)
     : base(model)
 {
     Commands = commands;
     Entries  = Entry.Entries.ToBindableMap("entries",
                                            Commands.RemoveCatalogueItemCommand.For(() => Entries));
     EntryLinks = Entry.EntryLinks.ToBindableMap("entry links",
                                                 Commands.RemoveCatalogueItemCommand.For(() => EntryLinks));
     Groups = Entry.Groups.ToBindableMap("groups",
                                         Commands.RemoveCatalogueItemCommand.For(() => Groups));
     GroupLinks = Entry.GroupLinks.ToBindableMap("group links",
                                                 Commands.RemoveCatalogueItemCommand.For(() => GroupLinks));
     Profiles = Entry.Profiles.ToBindableMap("profiles",
                                             Commands.RemoveCatalogueItemCommand.For(() => Profiles));
     ProfileLinks = Entry.ProfileLinks.ToBindableMap("profile links",
                                                     Commands.RemoveCatalogueItemCommand.For(() => ProfileLinks));
     Rules = Entry.Rules.ToBindableMap("rules",
                                       Commands.RemoveCatalogueItemCommand.For(() => Rules));
     RuleLinks = Entry.RuleLinks.ToBindableMap("rule links",
                                               Commands.RemoveCatalogueItemCommand.For(() => RuleLinks));
     Id         = identifierVmFactory(Entry.Id);
     Book       = bookIndexVmFactory(Entry.Book);
     Limits     = entryLimitsVmFactory(Entry.Limits);
     RootEntry  = Entry as IRootEntry;
     IsRootItem = RootEntry != null;
     Categories = Entry.Context.Catalogue.SystemContext.Categories.PrependWith(new NoCategory());
     Modifiers  = Entry.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
     CreateCatalogueItemCommand = Commands.CreateCatalogueItemCommand.EnableFor(Entry);
 }
示例#2
0
 public ProfileLinkViewModel(IProfileLink model, ICommandsAggregateService commands,
                             Func <IIdentifier, IdentifierViewModel> identifierVmFactory) : base(model)
 {
     Commands  = commands;
     Id        = identifierVmFactory(Link.Id);
     Modifiers = Link.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
 }
示例#3
0
 public GroupViewModel(IGroup model, ICommandsAggregateService commands,
                       Func <IIdentifier, IdentifierViewModel> identifierVmFactory,
                       Func <IEntryLimits, EntryLimitsViewModel> entryLimitsVmFactory)
     : base(model)
 {
     Commands = commands;
     Entries  = Group.Entries.ToBindableMap("entries",
                                            Commands.RemoveCatalogueItemCommand.For(() => Entries));
     EntryLinks = Group.EntryLinks.ToBindableMap("entry links",
                                                 Commands.RemoveCatalogueItemCommand.For(() => EntryLinks));
     Groups = Group.Groups.ToBindableMap("groups",
                                         Commands.RemoveCatalogueItemCommand.For(() => Groups));
     GroupLinks = Group.GroupLinks.ToBindableMap("group links",
                                                 Commands.RemoveCatalogueItemCommand.For(() => GroupLinks));
     Id             = identifierVmFactory(Group.Id);
     Limits         = entryLimitsVmFactory(Group.Limits);
     Modifiers      = Group.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
     DefaultChoices =
         Group.GetEntryLinkPairs()
         .Select(pair => pair.HasLink ? pair.Link.ToFacade() : pair.Entry.ToFacade())
         .PrependWith(NoChoiceItemFacade)
         .ToArray();
     DefaultChoice = Group.DefaultChoice == null
         ? NoChoiceItemFacade
         : DefaultChoices.First(
         facade =>
         Group.DefaultChoice.Equals(facade.IsLink
                     ? ((IEntryLink)facade.Item).Target
                     : (IEntry)facade.Item));
     CreateCatalogueItemCommand = Commands.CreateCatalogueItemCommand.EnableFor(Group);
 }
示例#4
0
 public RuleViewModel(IRule model, ICommandsAggregateService commands,
                      Func <IIdentifier, IdentifierViewModel> identifierVmFactory,
                      Func <IBookIndex, BookIndexViewModel> bookIndexVmFactory) : base(model)
 {
     Commands  = commands;
     Id        = identifierVmFactory(Rule.Id);
     Book      = bookIndexVmFactory(Rule.Book);
     Modifiers = Rule.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
 }
 public CatalogueConditionGroupViewModel(ICatalogueConditionGroup model, ICommandsAggregateService commands)
     : base(model)
 {
     Commands      = commands;
     ConditionsMap = Group.Conditions.ToBindableMap("conditions",
                                                    Commands.RemoveConditionItemCommand.For(() => ConditionsMap));
     GroupsMap = Group.ConditionGroups.ToBindableMap("condition groups",
                                                     Commands.RemoveConditionItemCommand.For(() => GroupsMap));
 }
 public EntryLinkViewModel(IEntryLink model, ICommandsAggregateService commands,
                           Func <IIdentifier, IdentifierViewModel> identifierVmFactory) : base(model)
 {
     Commands   = commands;
     Id         = identifierVmFactory(Link.Id);
     RootLink   = Link as IRootLink;
     IsRootItem = RootLink != null;
     Categories = Link.Context.Catalogue.SystemContext.Categories.PrependWith(new NoCategory());
     Modifiers  = Link.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
 }
示例#7
0
 public ProfileModifierViewModel(IProfileModifier model, ICommandsAggregateService commands,
                                 IDialogService dialogService) : base(model, commands)
 {
     DialogService       = dialogService;
     ParentProfile       = Modifier.GetParentProfile();
     CharacteristicTypes = ParentProfile.TypeLink.Target.CharacteristicTypes;
     Fields        = CharacteristicTypes.Select(type => type.Id).ToArray();
     IsFieldActive = CanFieldBeActive();
     IsValueActive = CanValueBeActive();
 }
 protected ModifierViewModelBase(TModifier model, ICommandsAggregateService commands) : base(model)
 {
     if (commands == null)
     {
         throw new ArgumentNullException(nameof(commands));
     }
     Commands      = commands;
     Repetition    = new ModifierRepetitionViewModel(Modifier.Repetition);
     ConditionsMap = Modifier.Conditions.ToBindableMap("conditions",
                                                       Commands.RemoveConditionItemCommand.For(() => ConditionsMap));
     GroupsMap = Modifier.ConditionGroups.ToBindableMap("condition groups",
                                                        Commands.RemoveConditionItemCommand.For(() => GroupsMap));
 }
示例#9
0
 public ProfileViewModel(IProfile model, ICommandsAggregateService commands,
                         Func <IIdentifier, IdentifierViewModel> identifierVmFactory,
                         Func <IBookIndex, BookIndexViewModel> bookIndexVmFactory,
                         Func <ICharacteristic, CharacteristicViewModel> characteristicVmFactory)
     : base(model)
 {
     Commands = commands;
     CharacteristicVmFactory = characteristicVmFactory;
     Id        = identifierVmFactory(Profile.Id);
     Book      = bookIndexVmFactory(Profile.Book);
     Modifiers =
         Profile.Modifiers.ToBindableMap(removeCommand: Commands.RemoveModifierCommand.For(() => Modifiers));
     UpdateCharacteristicViewModels();
 }
示例#10
0
 public CatalogueViewModel(ICatalogue model, ICommandsAggregateService commands,
                           Func <IIdentifier, IdentifierViewModel> identifierVmFactory)
     : base(model)
 {
     Commands      = commands;
     SharedEntries = Catalogue.SharedEntries.ToBindableMap("shared entries", asShared: true,
                                                           removeCommand: Commands.RemoveCatalogueItemCommand.For(() => SharedEntries));
     SharedGroups = Catalogue.SharedGroups.ToBindableMap("shared groups", asShared: true,
                                                         removeCommand: Commands.RemoveCatalogueItemCommand.For(() => SharedGroups));
     SharedProfiles = Catalogue.SharedProfiles.ToBindableMap("shared profiles", asShared: true,
                                                             removeCommand: Commands.RemoveCatalogueItemCommand.For(() => SharedProfiles));
     SharedRules = Catalogue.SharedRules.ToBindableMap("shared rules", asShared: true,
                                                       removeCommand: Commands.RemoveCatalogueItemCommand.For(() => SharedRules));
     Entries = Catalogue.Entries.ToBindableMap("entries",
                                               Commands.RemoveCatalogueItemCommand.For(() => Entries));
     EntryLinks = Catalogue.EntryLinks.ToBindableMap("entry links",
                                                     Commands.RemoveCatalogueItemCommand.For(() => EntryLinks));
     Rules = Catalogue.Rules.ToBindableMap("rules",
                                           Commands.RemoveCatalogueItemCommand.For(() => Rules));
     RuleLinks = Catalogue.RuleLinks.ToBindableMap("rule links",
                                                   Commands.RemoveCatalogueItemCommand.For(() => RuleLinks));
     Id = identifierVmFactory(Catalogue.Id);
     CreateCatalogueItemCommand = Commands.CreateCatalogueItemCommand.EnableFor(Catalogue);
 }
示例#11
0
 public MainViewModel(ICommandsAggregateService commands)
 {
     Commands = commands;
 }
 public EntryModifierViewModel(IEntryModifier model, ICommandsAggregateService commands)
     : base(model, commands)
 {
     IsFieldActive = CanFieldBeActive();
     IsValueActive = CanValueBeActive();
 }