public override void Present <T>() { var ps = this.presenters; Presenter presenter; lock (this.locker) { presenter = EH.FirstOrDefault( ps, p => p is T); } if (presenter == null) { return; } lock (this.locker) { foreach (var p in ps) { p.Stop(); } } this.startPresenter?.Invoke(presenter); }
public void Items_in_original_collection_same_with_array() { var mf = this.manifestObject; var sourceList = new List <object> { mf(), mf(), mf(), mf(), mf() }; var endArray = EH.ToArray( sourceList); var endArrayLength = endArray.Length; var sourceListCount = sourceList.Count; Assert.Equal( sourceListCount, endArrayLength); for ( var indexer = zero; indexer < endArrayLength && indexer < sourceListCount; ++indexer) { Assert.Same( sourceList[indexer], endArray[indexer]); } }
public override void PresentFluidly <T>( string name) { NamedPresenter np; lock (this.locker) { var matchingPresenters = EH.OfType <T>( this.presenters); foreach (var presenter in matchingPresenters) { if (presenter.Name != name) { continue; } np = presenter; goto start; } } return; start: this.startPresenter?.Invoke(np); }
public void Type_test() { var empty = EH.Empty <object>(); this.outputter.WriteLine( empty.GetType().ToString()); }
public override bool Equals( object obj) { return(EH.All( this.dependencies, t => t.Equals(obj))); }
public virtual bool IsRegistered <T>() where T : Presenter { return(EH.Any( EH.OfType <T>( this.presenters))); }
public override int GetHashCode() { return(EH.Aggregate( this.dependencies, 0, (current, o) => current ^ o.GetHashCode())); }
public virtual bool Contains( T item) { return(EH.Contains( this.items, item)); }
public virtual IEnumerator <V> GetEnumerator() { return(EH.Select( this.items, i => i.Value) .GetEnumerator()); }
public IEnumerable <T> Generate() { return(EH.Select( this.gates, gate => this.generator(gate)) ?? EH.Empty <T>()); }
// pass the Nameable.Name last, after all constructor arguments public override T Create <T>( params object[] dependencies) { var ds = dependencies; if (ds == null) { return(base.Create <T>()); } var l = ds.Length; if (l < one || !typeof(Nameable).IsAssignableFrom(typeof(T))) { return(base.Create <T>(ds)); } var possibleNameable = base.Create <T>( EH.ToArray( EH.Take( ds, l - one))); if (possibleNameable is Nameable n && EH.Last(ds) is string name) { n.Name = name; } return(possibleNameable); }
public virtual ICollection <string> ReadSectionNames() { return(new LinkedList <string>( EH.Select( this.readSectionHeaders( this.readLines()), header => header.Name))); }
public virtual bool Contains( T item) { this.checkItems(); return(EH.Contains( this.items, item)); }
public virtual bool IsRegistered <T>( string name) where T : NamedPresenter { return(EH.Any( EH.OfType <T>( this.presenters), p => p.Name == name)); }
public void Not_null() { Assert.NotNull( EH.ToArray( (IEnumerable <object>)null)); Assert.NotNull( EH.ToArray( (Lot <object>)null)); }
public virtual bool Contains( V value) { return(EH.Contains( EH.Select( this.items, kvp => kvp.Value), value)); }
public override bool IsRegistered <T>() { lock (this.locker) { return(EH.Any( EH.OfType <T>( this.presenters))); } }
public virtual void StopPresenter <T>() where T : Presenter { foreach (var presenter in EH.OfType <T>( this.presenters)) { presenter?.Stop(); break; } }
public virtual BigInteger ReadBigInteger( IEnumerable <bool> bits) { var bytes = this.GetBytes(bits); const byte zero = 0; return(new BigInteger( EH.ToArray(bytes) ?? new byte[zero])); }
public IniReaderWriter( string filePath) : this( () => File.Exists(filePath) ? File.ReadAllLines(filePath) : new string[0], lines => File.WriteAllLines( filePath, EH.ToArray(lines))) { }
public override bool IsRegistered <T>( string name) { lock (this.locker) { return(EH.Any( EH.OfType <T>( this.presenters), p => p.Name == name)); } }
public override void StopPresenter <T>() { lock (this.locker) { foreach (var presenter in EH.OfType <T>( this.presenters)) { presenter.Stop(); break; } } }
public virtual void CopyTo( V[] valueArray) { var lot = this.items; Array.Copy( EH.ToArray( EH.Select( lot, kvp => kvp.Value)), valueArray, lot.Count); }
public virtual void StopPresenter <T>( string name) where T : NamedPresenter { foreach (var presenter in EH.Where( EH.OfType <T>( this.presenters), p => p.Name == name)) { presenter?.Stop(); break; } }
public virtual void PresentFluidly <T>() where T : Presenter { var presenter = EH.FirstOrDefault( this.presenters, p => p is T); if (presenter == null) { return; } this.startPresenter?.Invoke(presenter); }
public virtual TUi GetUi <TPresenter, TUi>( string presenterName = null, string fieldName = Presenter.DefaultUiFieldName) where TPresenter : Presenter { Lot <Presenter> matchingPresenters = new LinkedListLot <Presenter>( EH.Where( this.presenters, p => p is TPresenter)); const byte one = 1; if (matchingPresenters.Count < one) { return(default);
public override void StopPresenter <T>( string name) { lock (this.locker) { foreach (var presenter in EH.Where( EH.OfType <T>( this.presenters), p => p.Name == name)) { presenter.Stop(); break; } } }
public virtual bool Unregister <T>() where T : Presenter { var ps = this.presenters; bool unregistered = falsity; lock (this.locker) { foreach (var p in EH.OfType <T>(ps)) { unregistered = ps.Remove(p); break; } } return(unregistered); }
public override void PresentFluidly <T>() { Presenter presenter; lock (this.locker) { presenter = EH.FirstOrDefault( this.presenters, p => p is T); } if (presenter == null) { return; } this.startPresenter?.Invoke(presenter); }
public virtual void PresentFluidly <T>( string name) where T : NamedPresenter { var matchingPresenters = EH.OfType <T>( this.presenters); foreach (var presenter in matchingPresenters) { if (presenter.Name != name) { continue; } this.startPresenter?.Invoke(presenter); break; } }