public void AddPassthroughGroup() { HashSet <GameRelease> games = new HashSet <GameRelease>() { EnumExt.GetValues <GameRelease>() }; foreach (var group in Groups) { games.Remove(group.GameRelease); } GameRelease release = GameRelease.SkyrimSE; if (games.Count > 0) { release = games.First(); } var groupVM = new PassthroughGroupVM(this) { GameRelease = release, Do = true, }; groupVM.Passthroughs.Add(new PassthroughVM(groupVM)); Groups.Add(groupVM); }
public PassthroughVM(PassthroughGroupVM group) { Parent = group; this.WhenAnyValue( x => x.Do, x => x.Parent.Do, (c, p) => c && p) .ToGuiProperty(this, nameof(Doing), out _Doing); DeleteCommand = ReactiveCommand.Create(() => { group.Passthroughs.Remove(this); }); }
public GroupTestVM(RunningTestsVM parent, PassthroughGroupVM group) { Parent = parent; Settings = group; Passthroughs.AddRange(group.Passthroughs .Where(p => p.Do) .Select(p => new PassthroughTestVM(this, p))); Passthroughs.Connect() .ObserveOnGui() .Bind(_passthroughDisplay) .Subscribe() .DisposeWith(this); _Name = this.WhenAnyValue(x => x.Settings.GameRelease) .Select(g => g.ToString()) .ToGuiProperty(this, nameof(Name), string.Empty); _State = Passthroughs.Connect() .TransformMany(x => x.Tests) .AutoRefresh(x => x.State) .Transform(p => p.State, transformOnRefresh: true) .QueryWhenChanged(states => { bool notComplete = false; foreach (var state in states) { if (state == TestState.Error) { return(TestState.Error); } if (state != TestState.Complete) { notComplete = true; } } return(notComplete ? TestState.Running : TestState.Complete); }) .ToGuiProperty(this, nameof(State)); }
public PassthroughVM(PassthroughGroupVM group, Target target) : this(group) { Do = target.Do; Path.TargetPath = target.Path; }