public static Caption <T> WithTextBox <T>(this Caption <T> model, IParent parent, string caption, string label, InputBox <T> .TryParse tryParse, T value) where T : struct { model.Input = new TextBoxViewModel <T>(parent, caption ?? model.Name, label, tryParse, value); return(model); }
public FrameworkElement ResolveEditor(Xceed.Wpf.Toolkit.PropertyGrid.PropertyItem propertyItem) { Contract.Requires(propertyItem != null); IParent p = (IParent)propertyItem.Instance; while (p.Parent != null) { p = p.Parent; } Config cfg = (Config)p; ComboBox cbx = new ComboBox(); // cbx.IsSynchronizedWithCurrentItem = true; cbx.DisplayMemberPath = "Name"; cbx.SelectedValuePath = "Name"; var _binding_lst = new Binding("ListConnectionStringVMs"); // bind to the Value property of the PropertyItem _binding_lst.Source = cfg; _binding_lst.ValidatesOnExceptions = false; _binding_lst.ValidatesOnDataErrors = false; _binding_lst.Mode = BindingMode.OneWay; BindingOperations.SetBinding(cbx, ComboBox.ItemsSourceProperty, _binding_lst); var _binding = new Binding("Value"); // bind to the Value property of the PropertyItem _binding.Source = propertyItem; _binding.ValidatesOnExceptions = true; _binding.ValidatesOnDataErrors = true; _binding.Mode = propertyItem.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay; BindingOperations.SetBinding(cbx, ComboBox.SelectedValueProperty, _binding); return(cbx); }
void parent_DictionaryClosed(object sender, EventArgs e) { IParent parent = sender as IParent; lock (instances) instances.Remove(parent.Parent.CurrentUser.ConnectionString); }
private ModelException CreateRequiredPropertyException(IParent parent, string format) => new ModelException(string.Format( CultureInfo.InvariantCulture, format, this.Property.DeclaringType.FullName, this.Property.Name, parent.GetPath()));
public static Icon Put(TextureRegion2D region, [CallerLineNumber] int id = 0, bool isAbsoluteId = false) { // 1. Check if Icon with id already exists. // a. If already exists. Get it. // b If not, create it. // 4. Ping it. id = GuiHelper.CurrentIMGUI.CreateId(id, isAbsoluteId); GuiHelper.CurrentIMGUI.TryGetValue(id, out IComponent c); Icon a; if (c is Icon) { a = (Icon)c; a.Region = region; } else { a = new Icon(id, region); } IParent parent = GuiHelper.CurrentIMGUI.GrabParent(a); if (a.LastPing != InputHelper.CurrentFrame) { a.LastPing = InputHelper.CurrentFrame; a.Index = parent.NextIndex(); } return(a); }
private bool IsNotExistsConn(AppDbSettings val) { if (val.ConnGuid.Length == 0) { return(true); } IParent p = (IParent)val; while (p.Parent != null) { p = p.Parent; } Config cfg = (Config)p; foreach (var t in cfg.GroupPlugins.ListPlugins) { foreach (var tt in t.ListGenerators) { foreach (var ttt in tt.ListSettings) { if (ttt.Guid == val.ConnGuid) { return(true); } } } } return(false); }
public Model(IParent parent) : base(parent) { Children = new List<PhysicalObject2D>(); _objectsToBeRemoved = new List<PhysicalObject2D>(); _objectsToBeAdded = new List<PhysicalObject2D>(); }
internal Context(IParent parent, int number, string identifier, ChildrenRetrievalPolicy childrenRetrievalPolicy) { this.Parent = parent; this.Number = number; this.Identifier = identifier; this.ChildrenRetrievalPolicy = childrenRetrievalPolicy; }
protected override void VerifyInjection(IParent parent) { parent.Should().NotBeNull(); parent.Children.Should().NotBeNull(); parent.Children.Count.Should().Be(1); parent.Children[0].Should().BeOfType<ChildB>(); }
public static Caption <T> WithComboBox <T>(this Caption <T> model, IParent parent, List <ComboBoxItem <T> > values, string caption, string label, InputBox <T> .TryParse tryParse, ComboBoxItem <T> value) where T : struct { model.Input = new ComboBoxViewModel <T>(parent ?? model.Parent, values, caption, label, tryParse, value); return(model); }
protected override void VerifyInjection(IParent parent) { parent.ShouldNotBeNull(); parent.Children.ShouldNotBeNull(); parent.Children.Count.ShouldBe(1); parent.Children[0].ShouldBeInstanceOf <ChildB>(); }
public JumpResetter(IParent parent) : base(parent : parent, textureId: "jump_resetter", collidable: false, size: new Vector2(20)) { }
public PlayerCheckpoint(IParent parent) : base(parent: parent, textureId: "flag", collidable: false) { StartingColors = new List<Color>(); }
/// <summary> /// Finds the parent of the specified type. /// </summary> /// <typeparam name="TParent">The ty</typeparam> /// <param name="model">The model.</param> /// <param name="maxLevels">The maximum levels to search. If <c>-1</c>, the number is unlimited.</param> /// <returns>The parent or <c>null</c> if the parent is not found.</returns> /// <exception cref="ArgumentNullException">The <paramref name="model" /> is <c>null</c>.</exception> public static TParent FindParent <TParent>(this IParent model, int maxLevels = -1) where TParent : class { Argument.IsNotNull("model", model); if (maxLevels == 0) { return(null); } var parent = model.Parent; if (parent == null) { return(null); } var parentT = parent as TParent; if (parentT != null) { return(parentT); } return(FindParent <TParent>(parent, maxLevels - 1)); }
public static new MenuPanel Push([CallerLineNumber] int id = 0, bool isAbsoluteId = false) { // 1. Check if MenuPanel with id already exists. // a. If already exists. Get it. // b If not, create it. // 3. Push it on the stack. // 4. Ping it. id = GuiHelper.CurrentIMGUI.CreateId(id, isAbsoluteId); GuiHelper.CurrentIMGUI.TryGetValue(id, out IComponent c); MenuPanel a; if (c is MenuPanel) { a = (MenuPanel)c; } else { a = new MenuPanel(id); } IParent parent = GuiHelper.CurrentIMGUI.GrabParent(a); if (a.LastPing != InputHelper.CurrentFrame) { a.Reset(); a.LastPing = InputHelper.CurrentFrame; a.Index = parent.NextIndex(); } GuiHelper.CurrentIMGUI.Push(a); return(a); }
internal Context(IParent parent, int number, string identifier, ChildrenRetrievalPolicy childrenRetrievalPolicy) { this.Parent = parent; this.Number = number; this.Identifier = identifier; this.ChildrenRetrievalPolicy = childrenRetrievalPolicy; }
protected override void VerifyInjection(IParent parent) { parent.Should().NotBeNull(); parent.Children.Should().NotBeNull(); parent.Children.Count.Should().Be(1); parent.Children[0].Should().BeOfType <ChildB>(); }
public ComplexDependentChild(IParent parent, Lazy<ILogger> logger, Func<ProductChoices, IProduct> productCreator, Random random) { if(parent == null) { throw new ArgumentNullException(nameof(parent)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (productCreator == null) { throw new ArgumentNullException(nameof(productCreator)); } if (random == null) { throw new ArgumentNullException(nameof(random)); } this.parent = parent; this.logger = logger; this.productCreator = productCreator; this.random = random; }
public LevelFinish(IParent parent, Vector2 position = new Vector2()) : base(parent: parent, position: position, collidable: true) { TextureId = "flagEnd"; }
protected override void VerifyInjection(IParent parent) { parent.ShouldNotBeNull(); parent.Children.ShouldNotBeNull(); parent.Children.Count.ShouldBe(1); parent.Children[0].ShouldBeInstanceOf<ChildB>(); }
public CaptionViewModel(IParent parent = null, [CallerMemberName] string caption = null, InputBox <T> input = null) { Parent = parent; Caption = caption; Input = input; }
public Particle( IParent parent, string textureId, float LifeTime, Color color, World world, Vector2 position = new Vector2(), bool collidable = false, float layerDepth = 0.5f) : base(parent: parent, position: position, collidable: collidable) { this.TextureId = textureId; this.LifeTime = LifeTime; this.Color = color; this._parent = parent; LayerDepth = layerDepth; if (collidable) { MovableBehaviour = new MovableBehaviour(this); } LastFrameBounds = Bounds; }
public BusinessObjectKeyedCollection( Func <TItem, TKey> getKeyForItemDelegate, IEnumerable <TItem> items, IParent parent) : this(getKeyForItemDelegate, items) { SetParent(parent); }
public FormData(IParent mother) { Mother = mother; InitializeComponent(); WindowState = FormWindowState.Maximized; Ended = false; Completed = false; }
public NpcSpawn(IParent parent, int difficulty) : base(parent: parent, collidable: false) { TextureId = "NpcSpawnSprite"; Difficulty = difficulty; if(Color ==null) Color = Color.White; }
/// <summary> /// Inserts a parent at the top of the parent stack. /// </summary> /// <param name="p">The parent to insert.</param> /// <param name="maxChildren">The parent's max amount of children, 0 means infinite.</param> public void Push(IParent p, int maxChildren = 0) { _parents.Push((_currentParent, _maxChildren, _childrenCount)); _currentParent = p; _maxChildren = maxChildren; _childrenCount = 0; PushId(p.Id); }
public FormResult(IParent mother, Tester mate) { Mother = mother; InitializeComponent(); WindowState = FormWindowState.Maximized; Mate = mate; this.UpdateInstructions(); }
public void Push(IParent p, int maxChildren = 0) { Parents.Push((CurrentParent, MaxChildren, ChildrenCount)); CurrentParent = p; MaxChildren = maxChildren; ChildrenCount = 0; PushId(p.Id); }
public InputBox(IParent parent, string caption, string label, TryParse tryParse, T value = default) : base(parent) { _tryParse = tryParse; Text = value.ToString(); Caption = caption; Label = label; }
public DeadlyPlatform(IParent parent, int blockAmountX, int blockAmountY, Vector2 position = new Vector2(), Color color = new Color()) : base(parent: parent, blockAmountX: blockAmountX, blockAmountY: blockAmountY, position: position, color: color) { }
public ComplexDependentChild(IParent parent, Lazy <ILogger> logger, Func <ProductChoices, IProduct> productCreator, SecureRandom random) { this.Parent = parent ?? throw new ArgumentNullException(nameof(parent)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); this.productCreator = productCreator ?? throw new ArgumentNullException(nameof(productCreator)); this.random = random ?? throw new ArgumentNullException(nameof(random)); }
public static IList <DefinitionListItem> Parse(Paragraph paragraph, IParent last) { if (paragraph.TextAreas.Count < 2) { return(Array.Empty <DefinitionListItem>()); } var result = new List <DefinitionListItem>(); IEnumerable <ITextArea> term = null; IList <ITextArea> rest = paragraph.TextAreas.ToList(); var firstIndentation = paragraph.TextAreas[0].Indentation; while (rest.Count > 0) { for (var index = 0; index < rest.Count; index++) { var item = rest[index]; if (item.Content.Text.Last() != '\n') { continue; } var next = index + 1; if (index + 1 == rest.Count) { if (term == null) { return(Array.Empty <DefinitionListItem>()); } result.Add(new DefinitionListItem(term.ToList(), rest, paragraph.Unit, last)); return(result); } var indentation = rest[next].Indentation; if (term == null) { if (indentation > firstIndentation) { term = rest.Take(next); rest = rest.Skip(next).ToList(); break; } } else if (indentation == firstIndentation) { // another term starts. var body = rest.Take(next); rest = rest.Skip(next).ToList(); result.Add(new DefinitionListItem(term.ToList(), body, paragraph.Unit, last)); term = null; break; } } } return(Array.Empty <DefinitionListItem>()); }
public DependentChild(IParent parent) { if(parent == null) { throw new ArgumentNullException(nameof(parent)); } this.parent = parent; }
public Teleporter(IParent parent, Vector2 position) : base(parent: parent, position: position, blockAmountX: 1, blockAmountY : 2, color : Color.White) { this.Collidable = false; }
protected void ParentIsValidated() { try { _parentPostValidation = _parentPreValidation.Validate(); } catch (InvalidNameException) {} catch (InvalidIdException) {} }
public void RemoveOld(object _o) { Remove((T)_o); for (int i = 0; i < Count; i++) { IParent p = this[i] as IParent; p.PropertyIndex = i; } }
private int GetParentId(IParent parent) { if (parent is BusinessBase) { Object retval = parent.GetType().GetProperty("Id").GetValue(parent); return (int) retval; } return GetParentId(parent.Parent); }
public Weapon(IParent parent, World world, string textureId, Vector2 size, Vector2 rotationOrigin, Color color) : base(world, textureId) { _world = world; _character = (Character)parent; _spriteRotationOrigin = rotationOrigin; Size = size; Color = color; }
public MovingPlatform(IParent parent, Vector2 position, int blockAmountX, int blockAmountY, Color color) : base(parent: parent, position: position, blockAmountX: blockAmountX, blockAmountY: blockAmountY, color : color) { Direction = 0; }
public FormPreferences(IParent mother) { InitializeComponent(); WindowState = FormWindowState.Maximized; Mother = mother; OriginalLanguage = Mother.Get("ID"); ManageLanguages(); Translate(); }
public EditForm(IParent parent, CLIENTS clientToEdit) { _parent = parent; _client = clientToEdit; InitializeComponent(); NameTextBox.Text = clientToEdit.C_NAME; SurnameTextBox.Text = clientToEdit.SURNAME; PhoneNrTextBox.Text = clientToEdit.PHONE_NUMBER.ToString(); AddressTextBox.Text = clientToEdit.ADRESS; }
public void TwoDependencies_NonNested() { IParent parent = Factory.Get <IParent>(); IChild1 child1 = parent.Child1; IChild2 child2 = parent.Child2; Assert.IsNotNull(parent, "Parent is null"); Assert.IsNotNull(child1, "Child 1 is null"); Assert.IsNotNull(child2, "Child 2 is null"); }
public Platform(IParent parent, int blockAmountX, int blockAmountY, Vector2 position = new Vector2(), Color color = new Color()) : base(parent: parent, position: position, collidable: true) { _colorBehaviour = new ColorBehaviour(this); Color = color; BlockAmountX = blockAmountX; BlockAmountY = blockAmountY; }
public DisappearingPlatform(IParent parent, Vector2 position, int blockAmountX, int blockAmountY, Color color, float timeToDisappear, float timeToReappear) : base(parent: parent, position: position, blockAmountX: blockAmountX, blockAmountY: blockAmountY, color : color) { _timeToDisappear = timeToDisappear; _timeToReappear = timeToReappear; state = State.Normal; _counter =0; }
public void Parent_MultipleConstructors() { Dojector.Bind <IParent>(typeof(ParentMultipleConstructors)); IParent parent = Factory.Get <IParent>(); IChild1 child1 = parent.Child1; IChild2 child2 = parent.Child2; Assert.IsNotNull(parent, "Parent is null"); Assert.IsNotNull(child1, "Child 1 is null"); Assert.IsNotNull(child2, "Child 2 is null"); }
public void NestedDependencies() { INestedParent topLevelParent = Factory.Get <INestedParent>(); IParent parent = topLevelParent.ParentNested; IChild1 child1 = parent.Child1; IChild2 child2 = parent.Child2; Assert.IsNotNull(topLevelParent, "Top level parent is null"); Assert.IsNotNull(parent, "Nested Parent is null"); Assert.IsNotNull(child1, "Child 1 is null"); Assert.IsNotNull(child2, "Child 2 is null"); }
protected override void OnSetUp() { storedParent = CreateParent(1); using (var s = OpenSession()) { using (var tx = s.BeginTransaction()) { s.Save(storedParent); tx.Commit(); } } }
public Character(IParent parent, ISpawn spawn = null) : base(parent) { Spawn = spawn; MovableBehaviour = new MovableBehaviour(); _onDieListeners = new List<Delegate>(); _colorBehaviour = new ColorBehaviour(this); WalkingAcceleration = 15; WalkingSpeed = 40; jumpPower = 42; }
public ParticleFountain(IParent parent, PhysicalObject2D stuckTo, float angle, float radius, float spawnDelay, float lifeTime, float particleLifeTime, Color color) : base(parent) { Vector2 randomPosition = Vector2.Zero; this._stuckTo = stuckTo; this._particleLifeTime = particleLifeTime; this._lifeTime = lifeTime; this._angle = angle; this._spawnDelay = spawnDelay; this._spawnTimer = 0f; this._radius = radius; this._color = color; }
protected Sprite( IParent parent, Vector2 position = new Vector2(), Vector2 size = new Vector2(), bool collidable = true, float elasticity = 0 ) : base(parent) { Position = position; if (size != new Vector2()) Size = size; Collidable = collidable; Elasticity = elasticity; }
public Sprite( IParent parent, string textureId, Vector2 position = new Vector2(), Vector2 size = new Vector2(), bool collidable = true, float elasticity = 0 ) : this(parent: parent, position: position, size: size, collidable: collidable, elasticity: elasticity) { if (textureId == null || textureId == "") throw new ArgumentException("TextureId can't be null"); TextureId = textureId; }
public ParticleExplosion(IParent parent, Vector2 position, int howMany, float radius, float spawnDelay, float lifeTime, float particleLifeTime, Color color) : base(parent) { Parent = parent; Vector2 randomPosition = Vector2.Zero; this._position = position; this._particleLifeTime = particleLifeTime; this._lifeTime = lifeTime; this._spawnDelay = spawnDelay; this._spawnTimer = 0f; this._radius = radius; this._color = color; this._howMany = howMany; }
public Button(string textureId, Vector2 position, Vector2 size, IParent parent) : base(parent: parent, textureId: textureId, position: position, size: size, collidable: false) { _onClickListeners = new List<FunctionCall>(); _onClickListenersString = new List<Tuple<FunctionCallString, string>>(); Color = Color.White; if (parent is Menu) parentMenu = (Menu)parent; else parentMenu = null; InputManager.AddMouseMoveCallback(MouseOver, parentMenu, parent is Menu); InputManager.AddMouseCallback(InputManager.MouseButtons.LeftButton, OnClick, InputManager.InputState.OnInputDown, parentMenu, parent is Menu); }
public ParticleGenerator(IParent parent, Vector2 position, int howMany, float radius, float lifeTime, Color color, float scale = 1f) : base(parent) { Position = position; this._parent = parent; this._position = position; this._howMany = howMany; this._radius = radius; this._lifeTime = lifeTime; this._color = color; this._randomColor = false; this._scale = scale; for (int i = 0; i < howMany; i++) { AddParticle(); } }
public ParticleFountain(IParent parent, PhysicalObject2D stuckTo, float angle, float radius, Vector2 offset, float spawnDelay, float lifeTime, float particleLifeTime, Color color, float layerDepth = 0.5f) : base(parent) { Vector2 randomPosition = Vector2.Zero; this._stuckTo = stuckTo; this._particleLifeTime = particleLifeTime; this._lifeTime = lifeTime; this._angle = angle; this._spawnDelay = spawnDelay; this._spawnTimer = 0f; this._radius = radius; Color = color; this._offset = offset; this._layerDepth = layerDepth; this._hasLifetime = _lifeTime != -1; Children.Add(new Sprite(null, "blood")); }
public ParticleCloud(IParent parent, Vector2 position, int howMany, float radius, float lifeTime, Color color) : base(parent) { Vector2 randomPosition = Vector2.Zero; Position = position; for (int i = 0; i < howMany; i++) { double randomRadius = Math.Sqrt(NumberFactory.RandomDouble()) * radius; double randomAngle = NumberFactory.RandomDouble() * NumberFactory.TwoPi; float randomLifeTime = (float)(lifeTime * NumberFactory.RandomDouble()); randomPosition.X = (float)(randomRadius * Math.Cos(randomAngle)); randomPosition.Y = (float)(randomRadius * Math.Sin(randomAngle)); Particle particle = new Particle(this, "cloud", randomLifeTime, color, (World)parent); particle.Initialize(); particle.Position = position + randomPosition - particle.Size / 2; Add(particle); } }
public TextBalloon( IParent parent, PhysicalObject2D talkingObject, Vector2 offset, int fontSize, FunctionCall whenDone = null, bool repeatAction = false ) : base(parent) { TalkingObject = talkingObject; Offset = offset; _currentRow = 0; _started = false; _visible = false; _charTimer = 0; _currentChar = 0; _currentRow = 0; _fontSize = fontSize; WhenDone = whenDone; this.RepeatAction = repeatAction; }
public Button(string textureId, string caption, Color color, Vector2 position, Vector2 size, IParent parent) : this(textureId, position, size, parent) { Caption = caption; Color = color; }
public Shower(IParent parent, int blockAmountX, int blockAmountY, Vector2 position, Color color = default(Color)) : base(parent, blockAmountX, blockAmountY, position, color) { }
internal Context(IParent parent, int number, string identifier) : this(parent, number, identifier, ChildrenRetrievalPolicy.All) { }