protected override void LoadComplete() { base.LoadComplete(); controlPoints = (BindableList <ControlPoint>)Group.ControlPoints.GetBoundCopy(); controlPoints.BindCollectionChanged((_, __) => { ClearInternal(); foreach (var point in controlPoints) { switch (point) { case DifficultyControlPoint difficultyPoint: AddInternal(new DifficultyPointPiece(difficultyPoint) { Depth = -2 }); break; case TimingControlPoint timingPoint: AddInternal(new TimingPointPiece(timingPoint)); break; case SampleControlPoint samplePoint: AddInternal(new SamplePointPiece(samplePoint) { Depth = -1 }); break; } } }, true); }
void load(Workspace workspace) { _documents = workspace.Documents.GetBoundCopy(); _documents.ItemsAdded += handleAdded; _documents.ItemsRemoved += handleRemoved; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = DesignerColours.Side }, new ScrollContainer(Direction.Vertical) { RelativeSizeAxes = Axes.Both, Child = _flow = new FillFlowContainer <Item> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding(2) } } }; handleAdded(_documents); }
protected override void LoadComplete() { base.LoadComplete(); SelectedItems.BindTo(editor.SelectedComponents); // track each target container on the current screen. var targetContainers = target.ChildrenOfType <ISkinnableTarget>().ToArray(); if (targetContainers.Length == 0) { string targetScreen = target.ChildrenOfType <Screen>().LastOrDefault()?.GetType().Name ?? "this screen"; AddInternal(new ScreenWhiteBox.UnderConstructionMessage(targetScreen, "doesn't support skin customisation just yet.")); return; } foreach (var targetContainer in targetContainers) { var bindableList = new BindableList <ISkinnableDrawable> { BindTarget = targetContainer.Components }; bindableList.BindCollectionChanged(componentsChanged, true); targetComponents.Add(bindableList); } }
public ScriptUtilites(BindableList variables, Playfield playfield, HandleManager handleManager, OptionsPanel optionsPanel) { this.variables = variables; this.playfield = playfield; this.handleManager = handleManager; this.optionsPanel = optionsPanel; }
protected virtual void BindList <T>(BindableList <T> bindableList, BindableListWatcherCallback <T> listener) where T : IBindable { var watcher = new BindableListWatcher <T>(bindableList, listener); // remember the watcher so we can destroy it when the mediator is destroyed RegisteredBindableListWatchers.Add(watcher); }
private void load(VerifyScreen verify) { hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy(); foreach (IssueType issueType in configurableIssueTypes) { var checkbox = new SettingsCheckbox { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, LabelText = issueType.ToString(), Current = { Default = !hiddenIssueTypes.Contains(issueType) } }; checkbox.Current.SetDefault(); checkbox.Current.BindValueChanged(state => { if (!state.NewValue) { hiddenIssueTypes.Add(issueType); } else { hiddenIssueTypes.Remove(issueType); } }); Flow.Add(checkbox); } }
public void TestRemoveNotifiesBoundListSubscriptions() { const string item = "item"; bindableStringList.Add(item); var listA = new BindableList <string>(); listA.BindTo(bindableStringList); NotifyCollectionChangedEventArgs triggeredArgsA1 = null; NotifyCollectionChangedEventArgs triggeredArgsA2 = null; listA.CollectionChanged += (_, args) => triggeredArgsA1 = args; listA.CollectionChanged += (_, args) => triggeredArgsA2 = args; var listB = new BindableList <string>(); listB.BindTo(bindableStringList); NotifyCollectionChangedEventArgs triggeredArgsB1 = null; NotifyCollectionChangedEventArgs triggeredArgsB2 = null; listB.CollectionChanged += (_, args) => triggeredArgsB1 = args; listB.CollectionChanged += (_, args) => triggeredArgsB2 = args; bindableStringList.Remove(item); Assert.That(triggeredArgsA1, Is.Not.Null); Assert.That(triggeredArgsA2, Is.Not.Null); Assert.That(triggeredArgsB1, Is.Not.Null); Assert.That(triggeredArgsB2, Is.Not.Null); }
public void TestRemoveNotifiesBoundListSubscriptions() { const string item = "item"; bindableStringList.Add(item); var listA = new BindableList <string>(); listA.BindTo(bindableStringList); bool wasRemovedA1 = false; bool wasRemovedA2 = false; listA.ItemsRemoved += s => wasRemovedA1 = true; listA.ItemsRemoved += s => wasRemovedA2 = true; var listB = new BindableList <string>(); listB.BindTo(bindableStringList); bool wasRemovedB1 = false; bool wasRemovedB2 = false; listB.ItemsRemoved += s => wasRemovedB1 = true; listB.ItemsRemoved += s => wasRemovedB2 = true; bindableStringList.Remove(item); Assert.Multiple(() => { Assert.IsTrue(wasRemovedA1); Assert.IsTrue(wasRemovedA2); Assert.IsTrue(wasRemovedB1); Assert.IsTrue(wasRemovedB2); }); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); data = CreateDataSource(); grid.SetDataSource(data); }
public void TestMoveNotifiesBoundListSubscriptions() { bindableStringList.AddRange(new[] { "0", "1", "2" }); var listA = new BindableList <string>(); listA.BindTo(bindableStringList); NotifyCollectionChangedEventArgs triggeredArgsA1 = null; NotifyCollectionChangedEventArgs triggeredArgsA2 = null; listA.CollectionChanged += (_, args) => triggeredArgsA1 = args; listA.CollectionChanged += (_, args) => triggeredArgsA2 = args; var listB = new BindableList <string>(); listB.BindTo(bindableStringList); NotifyCollectionChangedEventArgs triggeredArgsB1 = null; NotifyCollectionChangedEventArgs triggeredArgsB2 = null; listB.CollectionChanged += (_, args) => triggeredArgsB1 = args; listB.CollectionChanged += (_, args) => triggeredArgsB2 = args; bindableStringList.Move(0, 1); Assert.That(triggeredArgsA1, Is.Not.Null); Assert.That(triggeredArgsA2, Is.Not.Null); Assert.That(triggeredArgsB1, Is.Not.Null); Assert.That(triggeredArgsB2, Is.Not.Null); }
private void load() { LayerBelowRuleset.AddRange(new Drawable[] { new PlayfieldBorder { RelativeSizeAxes = Axes.Both, PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Corners } }, distanceSnapGridContainer = new Container { RelativeSizeAxes = Axes.Both } }); selectedHitObjects = EditorBeatmap.SelectedHitObjects.GetBoundCopy(); selectedHitObjects.CollectionChanged += (_, __) => updateDistanceSnapGrid(); placementObject = EditorBeatmap.PlacementObject.GetBoundCopy(); placementObject.ValueChanged += _ => updateDistanceSnapGrid(); distanceSnapToggle.ValueChanged += _ => updateDistanceSnapGrid(); // we may be entering the screen with a selection already active updateDistanceSnapGrid(); }
/// <summary> /// Construct a new leaderboard. /// </summary> /// <param name="scoreProcessor">A score processor instance to handle score calculation for scores of users in the match.</param> /// <param name="userIds">IDs of all users in this match.</param> public MultiplayerGameplayLeaderboard(ScoreProcessor scoreProcessor, int[] userIds) { // todo: this will eventually need to be created per user to support different mod combinations. this.scoreProcessor = scoreProcessor; // todo: this will likely be passed in as User instances. playingUsers = new BindableList <int>(userIds); }
public EditUnnaturalClassViewModel(IDialogService dialogService, Segmenter segmenter, IEnumerable <SoundClass> soundClasses) : base("New Segment-based Class", soundClasses) { _dialogService = dialogService; _segmenter = segmenter; _segments = new BindableList <string>(); _addSegmentCommand = new RelayCommand(AddSegment); _removeSegmentCommand = new RelayCommand(RemoveSegment, CanRemoveSegment); }
public EditNaturalClassViewModel(FeatureSystem featSys, IEnumerable <SoundClass> soundClasses) : base("New Feature-based Class", soundClasses) { _availableFeatures = new BindableList <FeatureViewModel>(featSys.OfType <SymbolicFeature>().Select(f => new FeatureViewModel(f))); _activeFeatures = new BindableList <FeatureViewModel>(); _addCommand = new RelayCommand(AddFeature, CanAddFeature); _removeCommand = new RelayCommand(RemoveFeature, CanRemoveFeature); }
public void TestGetEnumeratorWhenCopyConstructorIsUsedDoesNotReturnTheEnumeratorOfTheInputtedEnumerator() { string[] array = { "" }; var list = new BindableList <string>(array); var enumerator = list.GetEnumerator(); Assert.AreNotEqual(array.GetEnumerator(), enumerator); }
public EditNaturalClassViewModel(FeatureSystem featSys, IEnumerable<SoundClass> soundClasses) : base("New Feature-based Class", soundClasses) { _availableFeatures = new BindableList<FeatureViewModel>(featSys.OfType<SymbolicFeature>().Select(f => new FeatureViewModel(f))); _activeFeatures = new BindableList<FeatureViewModel>(); _addCommand = new RelayCommand(AddFeature, CanAddFeature); _removeCommand = new RelayCommand(RemoveFeature, CanRemoveFeature); }
public EditUnnaturalClassViewModel(IDialogService dialogService, Segmenter segmenter, IEnumerable <SoundClass> soundClasses, UnnaturalClass unnaturalClass) : base("Edit Segment-based Class", soundClasses, unnaturalClass) { _dialogService = dialogService; _segmenter = segmenter; _ignoreModifiers = unnaturalClass.IgnoreModifiers; _segments = new BindableList <string>(unnaturalClass.Segments); _addSegmentCommand = new RelayCommand(AddSegment); _removeSegmentCommand = new RelayCommand(RemoveSegment, CanRemoveSegment); }
public SettingsTeamDropdown(BindableList <TournamentTeam> teams) { foreach (var t in teams.Prepend(new TournamentTeam())) { add(t); } teams.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); teams.ItemsAdded += items => items.ForEach(add); }
public WordPairsViewModel(IBusyService busyService) { _busyService = busyService; _wordPairs = new BindableList<WordPairViewModel>(); _wordPairs.CollectionChanged += _wordPairs_CollectionChanged; _selectedWordPairs = new BindableList<WordPairViewModel>(); _selectedWordPairs.CollectionChanged += _selectedWordPairs_CollectionChanged; _selectedCorrespondenceWordPairs = new BindableList<WordPairViewModel>(); _selectedWordPairsMonitor = new SimpleMonitor(); }
public WordsViewModel(IBusyService busyService, ReadOnlyBindableList<WordViewModel> words) { _busyService = busyService; _words = words; _words.CollectionChanged += WordsChanged; _selectedWords = new BindableList<WordViewModel>(); _selectedWords.CollectionChanged += _selectedWords_CollectionChanged; _selectedSegmentWords = new BindableList<WordViewModel>(); _selectedWordsMonitor = new SimpleMonitor(); }
public ListPairsBindViewModel() { Items = new BindableList <ItemViewModel>() { new ItemViewModel(false, "回锅肉", null), new ItemViewModel(false, "梅菜扣肉", null), new ItemViewModel(false, "水煮鱼", null), new ItemViewModel(true, "鱼香肉丝", null) }; }
public SegmentMappingsViewModel(IProjectService projectService, IDialogService dialogService, IImportService importService) { _projectService = projectService; _dialogService = dialogService; _importService = importService; _mappings = new BindableList <SegmentMappingViewModel>(); _newCommand = new RelayCommand(AddMapping); _removeCommand = new RelayCommand(RemoveMapping, CanRemoveMapping); _importCommand = new RelayCommand(Import); }
public WordsViewModel(IBusyService busyService, ReadOnlyBindableList<WordViewModel> words) { _busyService = busyService; _words = words; _words.CollectionChanged += WordsChanged; _selectedWords = new BindableList<WordViewModel>(); _selectedWords.CollectionChanged += _selectedWords_CollectionChanged; _selectedSegmentWords = new BindableList<WordViewModel>(); _selectedWordsMonitor = new SimpleMonitor(); }
public WordPairsViewModel(IBusyService busyService) { _busyService = busyService; _wordPairs = new BindableList <WordPairViewModel>(); _wordPairs.CollectionChanged += _wordPairs_CollectionChanged; _selectedWordPairs = new BindableList <WordPairViewModel>(); _selectedWordPairs.CollectionChanged += _selectedWordPairs_CollectionChanged; _selectedCorrespondenceWordPairs = new BindableList <WordPairViewModel>(); _selectedWordPairsMonitor = new SimpleMonitor(); }
public void TestDisabledNotifiesBoundLists() { var list = new BindableList <string>(); list.BindTo(bindableStringList); bindableStringList.Disabled = true; Assert.IsTrue(list.Disabled); }
public void TestAddWithStringNotifiesBoundList(string str) { var list = new BindableList <string>(); list.BindTo(bindableStringList); bindableStringList.Add(str); Assert.Contains(str, list); }
public void TestMoveNotifiesBoundList() { bindableStringList.AddRange(new[] { "0", "1", "2" }); var list = new BindableList <string>(); list.BindTo(bindableStringList); bindableStringList.Move(0, 1); Assert.That(list, Is.EquivalentTo(new[] { "1", "0", "2" })); }
public EditorBeatmapSkin(Skin skin) { Skin = skin; ComboColours = new BindableList <Colour4>(); if (Skin.Configuration.ComboColours != null) { ComboColours.AddRange(Skin.Configuration.ComboColours.Select(c => (Colour4)c)); } ComboColours.BindCollectionChanged((_, __) => updateColours()); }
public void TestBindCollectionChangedWithRunImmediately() { var list = new BindableList <int>(); NotifyCollectionChangedEventArgs triggeredArgs = null; list.BindCollectionChanged((_, args) => triggeredArgs = args, true); Assert.That(triggeredArgs.Action, Is.EqualTo(NotifyCollectionChangedAction.Add)); Assert.That(triggeredArgs.NewItems, Is.EquivalentTo(list)); }
public SettingsRoundDropdown(BindableList <TournamentRound> rounds) { Bindable = new Bindable <TournamentRound>(); foreach (var r in rounds.Prepend(new TournamentRound())) { add(r); } rounds.ItemsRemoved += items => items.ForEach(i => Control.RemoveDropdownItem(i)); rounds.ItemsAdded += items => items.ForEach(add); }
public void TestBindCollectionChangedWithoutRunningImmediately() { var list = new BindableList <int> { 1 }; NotifyCollectionChangedEventArgs triggeredArgs = null; list.BindCollectionChanged((_, args) => triggeredArgs = args); Assert.That(triggeredArgs, Is.Null); }
private void load(LyricEditorColourProvider colourProvider, ILyricEditorState state) { hoveredBackground.Colour = colourHover = colourProvider.Background1(LyricEditorMode.CreateTimeTag); colourSelected = colourProvider.Colour3(LyricEditorMode.CreateTimeTag); // update selected state by bindable. selectedTimeTags = state.SelectedTimeTags.GetBoundCopy(); selectedTimeTags.BindCollectionChanged((a, b) => { selected = selectedTimeTags.Contains(timeTag); updateState(); }); Action = () => { // navigate to current lyric. switch (state.Mode) { case LyricEditorMode.CreateTimeTag: state.BindableCaretPosition.Value = new TimeTagIndexCaretPosition(lyric, timeTag?.Index ?? new TextIndex()); break; case LyricEditorMode.RecordTimeTag: state.BindableCaretPosition.Value = new TimeTagCaretPosition(lyric, timeTag); break; case LyricEditorMode.AdjustTimeTag: state.BindableCaretPosition.Value = new NavigateCaretPosition(lyric); break; default: throw new IndexOutOfRangeException(nameof(state.Mode)); } // set current time-tag as selected. selectedTimeTags.Clear(); if (timeTag == null) { return; } // select time-tag is not null. selectedTimeTags.Add(timeTag); if (timeTag.Time == null) { return; } // seek to target time-tag time if time-tag has time. clock.Seek(timeTag.Time.Value); }; }
public SegmentMappingsViewModel(IDialogService dialogService, IImportService importService, SegmentMappingViewModel.Factory mappingFactory, NewSegmentMappingViewModel.Factory newMappingFactory) { _dialogService = dialogService; _importService = importService; _mappingFactory = mappingFactory; _newMappingFactory = newMappingFactory; _mappings = new BindableList<SegmentMappingViewModel>(); _newCommand = new RelayCommand(AddMapping); _removeCommand = new RelayCommand(RemoveMapping, CanRemoveMapping); _importCommand = new RelayCommand(Import); _mappings.CollectionChanged += MappingsChanged; }
public void TestRemoveNotifiesBoundList() { const string item = "item"; bindableStringList.Add(item); var list = new BindableList <string>(); list.BindTo(bindableStringList); bindableStringList.Remove(item); Assert.IsEmpty(list); }
public StreamViewModel( IStatusUpdateService statusUpdateService, IPluginRepository pluginsRepository, StreamConfigurationViewModel streamConfigurationViewModel) { _pluginsRepository = pluginsRepository; _statusUpdate = statusUpdateService; StreamConfiguration = streamConfigurationViewModel; StreamConfiguration.Parent = this; Updates = new BindableList<IStatusUpdate>(_statusUpdate.OutgoingUpdates); _settings = CompositionManager.Get<IApplicationSettingsProvider>(); }
public SoundClassesViewModel(IProjectService projectService, IDialogService dialogService) { _projectService = projectService; _dialogService = dialogService; _soundClasses = new BindableList<SoundClassViewModel>(); _soundClasses.CollectionChanged += _soundClasses_CollectionChanged; _newNaturalClassCommand = new RelayCommand(NewNaturalClass); _newUnnaturalClassCommand = new RelayCommand(NewUnnaturalClass); _editSoundClassCommand = new RelayCommand(EditSoundClass, CanEditSoundClass); _removeSoundClassCommand = new RelayCommand(RemoveSoundClass, CanRemoveSoundClass); _moveSoundClassUpCommand = new RelayCommand(MoveSoundClassUp, CanMoveSoundClassUp); _moveSoundClassDownCommand = new RelayCommand(MoveSoundClassDown, CanMoveSoundClassDown); }
public EditNaturalClassViewModel(FeatureSystem featSys, IEnumerable<SoundClass> soundClasses, NaturalClass naturalClass) : base("Edit Feature-based Class", soundClasses, naturalClass) { _type = naturalClass.Type == CogFeatureSystem.ConsonantType ? SoundType.Consonant : SoundType.Vowel; _availableFeatures = new BindableList<FeatureViewModel>(); _activeFeatures = new BindableList<FeatureViewModel>(); foreach (SymbolicFeature feature in featSys.OfType<SymbolicFeature>()) { SymbolicFeatureValue sfv; if (naturalClass.FeatureStruct.TryGetValue(feature, out sfv)) _activeFeatures.Add(new FeatureViewModel(feature, (FeatureSymbol) sfv)); else _availableFeatures.Add(new FeatureViewModel(feature)); } _addCommand = new RelayCommand(AddFeature, CanAddFeature); _removeCommand = new RelayCommand(RemoveFeature, CanRemoveFeature); }
public MultipleWordAlignmentViewModel(IProjectService projectService, IBusyService busyService, IExportService exportService, IAnalysisService analysisService) : base("Multiple Word Alignment") { _projectService = projectService; _busyService = busyService; _exportService = exportService; _analysisService = analysisService; _projectService.ProjectOpened += _projectService_ProjectOpened; var showCognateSets = new TaskAreaBooleanViewModel("Show cognate sets") {Value = true}; showCognateSets.PropertyChanged += _showCognateSets_PropertyChanged; TaskAreas.Add(new TaskAreaItemsViewModel("Common tasks", new TaskAreaItemsViewModel("Sort words by", new TaskAreaCommandGroupViewModel( new TaskAreaCommandViewModel("Form", new RelayCommand(() => SortBy("StrRep", ListSortDirection.Ascending))), new TaskAreaCommandViewModel("Variety", new RelayCommand(() => SortBy("Variety", ListSortDirection.Ascending)))), showCognateSets))); TaskAreas.Add(new TaskAreaItemsViewModel("Other tasks", new TaskAreaCommandViewModel("Export all cognate sets", new RelayCommand(ExportCognateSets, CanExportCognateSets)))); _words = new BindableList<MultipleWordAlignmentWordViewModel>(); _selectedWords = new BindableList<MultipleWordAlignmentWordViewModel>(); _showInVarietyPairsCommand = new RelayCommand(ShowInVarietyPairs, CanShowInVarietyPairs); _performComparisonCommand = new RelayCommand(PerformComparison); _groupByCognateSet = true; _sortByProp = "StrRep"; Messenger.Default.Register<ComparisonPerformedMessage>(this, msg => AlignWords()); Messenger.Default.Register<DomainModelChangedMessage>(this, msg => { if (msg.AffectsComparison) ResetAlignment(); }); Messenger.Default.Register<PerformingComparisonMessage>(this, msg => ResetAlignment()); Messenger.Default.Register<SwitchViewMessage>(this, HandleSwitchView); }
private void LoadSegments() { var segments = new BindableList<WordSegmentViewModel>(); if (_word.Shape != null && _word.Shape.Count > 0) { Annotation<ShapeNode> prefixAnn = _word.Prefix; if (prefixAnn != null) segments.AddRange(GetSegments(prefixAnn)); segments.Add(new WordSegmentViewModel("|")); segments.AddRange(GetSegments(_word.Stem)); segments.Add(new WordSegmentViewModel("|")); Annotation<ShapeNode> suffixAnn = _word.Suffix; if (suffixAnn != null) segments.AddRange(GetSegments(suffixAnn)); } segments.CollectionChanged += SegmentsChanged; Set("Segments", ref _segments, segments); IsValid = _word.Shape != null && _word.Shape.Count > 0; }
protected WorkspaceViewModelBase(string displayName) : base(displayName) { _taskAreas = new BindableList<TaskAreaViewModelBase>(); }
public CommonDialogWindowBaseContent() { Initialize(); Buttons = new BindableList<DialogButtonInfo>(this); }
public void ResetUpdates() { //This operation cannot be simply threaded, the results have been logged in MT-141 Updates = new BindableList<IStatusUpdate>(_statusUpdate.OutgoingUpdates); RaisePropertyChanged(() => Updates); }
public SegmentMappingsTableSegmentViewModel(Segment segment, SoundType type) : base(segment, type) { _segmentPairs = new BindableList<SegmentMappingsTableSegmentPairViewModel>(); }