public CheckableItem(NumericalBaseService numericalBaseService, FlagItem flagItem, StatusInfoCommand statusInfoCommand) { if (numericalBaseService == null) { throw new ArgumentNullException(nameof(numericalBaseService)); } if (flagItem == null) { throw new ArgumentNullException(nameof(flagItem)); } if (statusInfoCommand == null) { throw new ArgumentNullException(nameof(statusInfoCommand)); } this.numericalBaseService = numericalBaseService; this.flagItem = flagItem; StatusInfoCommand = statusInfoCommand; IsChecked = false; FlagName = flagItem.Name; ToolTip = CalculateToolTip(); UpdateFlagValue(); numericalBaseService.NumericalBaseChanged += HandleNumericalBaseChanged; }
public MainHeaderViewModel(ProjectContext projectContext, StatusInfo statusInfo, UserInterface userInterface) { if (projectContext == null) { throw new ArgumentNullException(nameof(projectContext)); } if (statusInfo == null) { throw new ArgumentNullException(nameof(statusInfo)); } this.projectContext = projectContext; CopyCommand = new CopyCommand(userInterface, projectContext); PasteCommand = new PasteCommand(userInterface, projectContext); NumericalBaseRollCommand = new NumericalBaseRollCommand(projectContext, userInterface); StatusInfoCommand = new StatusInfoCommand(statusInfo, userInterface); this.projectContext.Loaded += HandleProjectLoaded; this.projectContext.Unloaded += HandleProjectUnloaded; this.projectContext.FlagsNumberChanged += HandleFlagsNumberChanged; this.projectContext.FlagsNumber.ValueChanged += HandleMainValueChanged; this.projectContext.NumericalBaseService.NumericalBaseChanged += HandleNumericalBaseChanged; UpdateMainValue(); UpdateNumericalBaseText(); IsEnabled = projectContext.IsLoaded; }
public MainFooterViewModel(ProjectContext projectContext, StatusInfo statusInfo, UserInterface userInterface) { if (projectContext == null) { throw new ArgumentNullException(nameof(projectContext)); } if (statusInfo == null) { throw new ArgumentNullException(nameof(statusInfo)); } this.projectContext = projectContext; this.statusInfo = statusInfo; SelectAllFlagsCommand = new SelectAllFlagsCommand(userInterface, projectContext); SelectNoFlagsCommand = new SelectNoFlagsCommand(userInterface, projectContext); StatusInfoCommand = new StatusInfoCommand(statusInfo, userInterface); ToggleDisplaySelectedCommand = new ToggleDisplaySelectedCommand(userInterface, projectContext); ToggleDisplayUnselectedCommand = new ToggleDisplayUnselectedCommand(userInterface, projectContext); DisplaySelected = projectContext.DisplaySelected; DisplayUnselected = projectContext.DisplayUnselected; statusInfo.StatusTextChanged += HandleStatusTextChanged; this.projectContext.Loaded += HandleProjectLoaded; this.projectContext.Unloaded += HandleProjectUnloaded; this.projectContext.DisplaySelectedChanged += HandleFlagsDisplaySelectedChanged; IsEnabled = projectContext.IsLoaded; }
private void UpdateFlagsList(FlagsNumber flagsNumber) { flags.Clear(); StatusInfoCommand statusInfoCommand = new StatusInfoCommand(statusInfo, userInterface); IEnumerable <CheckableItem> checkableItems = flagsNumber .Select(x => new CheckableItem(projectContext.NumericalBaseService, x, statusInfoCommand)); foreach (CheckableItem item in checkableItems) { flags.Add(item); } }