void Awake() { name = "MetronomeManager"; if (instance == null) { instance = this; } metronomes = new Children<Metronome>(transform); AudioManager.instance.managers.AddChild (GetComponent<MetronomeManager>()); }
void SetActive(Children newActive) { float width = rt.rect.width; float height = rt.rect.height; switch (newActive) { case Children.LEFTUP: leftUp.sizeDelta = new Vector2 (width, height); leftUp.localPosition = new Vector2 (0, 0); leftDown.sizeDelta = new Vector2 (0, 0); leftDown.localPosition = new Vector2 (0, 0); right.sizeDelta = new Vector2 (0, 0); right.localPosition = new Vector2 (0, 0); break; case Children.LEFTDOWN: leftUp.sizeDelta = new Vector2 (width, height * 0.2f); leftUp.localPosition = new Vector2 (0, height / 2f - height * 0.2f / 2f); leftDown.sizeDelta = new Vector2 (width, height * 0.8f); leftDown.localPosition = new Vector2 (0, -height / 2f + height * 0.8f / 2f); right.sizeDelta = new Vector2 (0, 0); right.localPosition = new Vector2 (0, 0); break; case Children.RIGHT: leftUp.sizeDelta = new Vector2 (width * 0.2f, height * 0.5f); leftUp.localPosition = new Vector2 (-width / 2f + width * 0.2f / 2f, height / 2f - height * 0.5f / 2f); leftDown.sizeDelta = new Vector2 (width * 0.2f, height * 0.5f); leftDown.localPosition = new Vector2 (-width / 2f + width * 0.2f / 2f, -height / 2f + height * 0.5f / 2f); right.sizeDelta = new Vector2 (width * 0.8f, height); right.localPosition = new Vector2 (width / 2f - width * 0.8f / 2f, 0); break; } }
void Awake() { name = "EnergyManager"; if (instance == null) { instance = this; } energies = new Children<Energy>(transform); AudioManager.instance.managers.AddChild (GetComponent<EnergyManager>()); }
void Awake() { name = "AudioSendManager"; if (instance == null) { instance = this; } sends = new Children<AudioSend>(transform); AudioManager.instance.managers.AddChild (GetComponent<AudioSendManager>()); }
void Awake() { name = "AudioElementManager"; if (instance == null) { instance = this; } categories = new Children<Category>(transform, true); elements = new Children<AudioElement>(transform); AudioManager.instance.managers.AddChild (GetComponent<AudioElementManager>()); }
void SetActive(Children newActive) { float width = rt.rect.width; // print (width); switch (newActive) { case Children.LEFT: leftChild.sizeDelta = new Vector2 (width * activeWidthRatio, rt.rect.height); rightChild.sizeDelta = new Vector2 (width * inactiveWidthRatio, rt.rect.height); leftChild.localPosition = new Vector2 (-width / 2f + width * activeWidthRatio / 2f, 0); rightChild.localPosition = new Vector2 (width / 2f - width * inactiveWidthRatio / 2f, 0); break; case Children.RIGHT: leftChild.sizeDelta = new Vector2 (width * inactiveWidthRatio, rt.rect.height); rightChild.sizeDelta = new Vector2 (width * activeWidthRatio, rt.rect.height); leftChild.localPosition = new Vector2 (-width / 2f + width * inactiveWidthRatio / 2f, 0); rightChild.localPosition = new Vector2 (width / 2f - width * activeWidthRatio / 2f, 0); break; } }
public void Seed(IDocumentStore store) { const string name = "John Doe"; const string friend = "Stever Rogers"; var rand = new Random(); for (int i = 0; i < 10; i++) { using (IDocumentSession session = store.OpenSession()) { var person = new Person { Name = name }; if (i % 2 == 0) { person.Friends = new List<Friend> { new Friend { Name = friend } }; } session.Store(person); // add children for (int j = 0; j < 5; j++) { var child = new Children { Name = name + " jr.", Parent = person.Id, // keep Phlegmatic from being set in a child Temperament = (Temperaments)rand.Next(0, 2) }; session.Store(child); } session.SaveChanges(); } } }
public void ShowInstacePopup(ContentView currentPage, PopupInstanceLayout currentLayout, View view, View relativeTo, double width, double height, bool modal, string title) { _tempCurrentPage = currentPage; _tempCurrentLayout = currentLayout; _tempContent = currentPage.Content; currentPage.Content = currentLayout; _popupContent = view; _relativeTo = relativeTo; _oheight = height; _owidth = width; PopupChanged = false; _height = _oheight + 16; _width = _owidth; _isModal = modal; _popupType = PopupType.Relative; _title = title; var points = this.GetXY(_relativeTo); DrawPopup(_popupContent, false, _title); if (_isModal) { _popupShield = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = new Color(0, 0, 0, 0.4) }; // var tapToSheild = new TapGestureRecognizer(); tapToSheild.Tapped += (s, e) => DismisPopup(); _popupShield.GestureRecognizers.Add(tapToSheild); // SetLayoutFlags(_popupShield, AbsoluteLayoutFlags.None); Children.Add(_popupShield, new Rectangle(0, 0, _parentview.Width, _parentview.Height)); //To handle popup visibility Task.Run(() => Task.Delay(100)).Wait(); } SetLayoutFlags(_popupFramer, AbsoluteLayoutFlags.None); if (!PopupVisible) { SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, 0, 0)); } Children.Add(_popupFramer); _triangleStack.Children.Insert(0, new StackLayout { BackgroundColor = Color.Transparent, WidthRequest = (GetX(relativeTo) - points.X) + (_relativeTo.Width / 2) - 10 }); if (!PopupVisible) { _popupFramer.LayoutTo(new Rectangle(points.X, points.Y, _width, _height), Device.OnPlatform <uint>(150, 50, 50), Easing.Linear); OnOpened(); } else { SetLayoutBounds(_popupFramer, new Rectangle(points.X, points.Y, _width, _height)); } PopupVisible = true; }
protected override void BuildMyself() { Children.Add(new TypeMetadataTreeViewItem(_method.ReturnType)); }
/// <summary> /// Determines whether additional overflow columns are needed and if existing columns can /// be removed. /// </summary> /// <param name="availableSize">The size of the space available, used to constrain the /// number of additional columns that can be created.</param> /// <returns>The resulting size of the original content plus any extra columns.</returns> protected override Size MeasureOverride(Size availableSize) { if (this.RichTextContent == null) { return(new Size(0, 0)); } // Make sure the RichTextBlock is a child, using the lack of // a list of additional columns as a sign that this hasn't been // done yet if (this._overflowColumns == null) { Children.Add(this.RichTextContent); this._overflowColumns = new List <RichTextBlockOverflow>(); } // Start by measuring the original RichTextBlock content this.RichTextContent.Measure(availableSize); var maxWidth = this.RichTextContent.DesiredSize.Width; var maxHeight = this.RichTextContent.DesiredSize.Height; var hasOverflow = this.RichTextContent.HasOverflowContent; // Make sure there are enough overflow columns int overflowIndex = 0; while (hasOverflow && maxWidth < availableSize.Width && this.ColumnTemplate != null) { // Use existing overflow columns until we run out, then create // more from the supplied template RichTextBlockOverflow overflow; if (this._overflowColumns.Count > overflowIndex) { overflow = this._overflowColumns[overflowIndex]; } else { overflow = (RichTextBlockOverflow)this.ColumnTemplate.LoadContent(); this._overflowColumns.Add(overflow); this.Children.Add(overflow); if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = overflow; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow; } } // Measure the new column and prepare to repeat as necessary overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height)); maxWidth += overflow.DesiredSize.Width; maxHeight = Math.Max(maxHeight, overflow.DesiredSize.Height); hasOverflow = overflow.HasOverflowContent; overflowIndex++; } // Disconnect extra columns from the overflow chain, remove them from our private list // of columns, and remove them as children if (this._overflowColumns.Count > overflowIndex) { if (overflowIndex == 0) { this.RichTextContent.OverflowContentTarget = null; } else { this._overflowColumns[overflowIndex - 1].OverflowContentTarget = null; } while (this._overflowColumns.Count > overflowIndex) { this._overflowColumns.RemoveAt(overflowIndex); this.Children.RemoveAt(overflowIndex + 1); } } // Report final determined size return(new Size(maxWidth, maxHeight)); }
public void Start(double length) { if (Children.Any()) { // restart if we were already run previously. FinishTransforms(true); load(); } smallRing.ResizeTo(logo_size * 0.086f, 400, Easing.InOutQuint); mediumRing.ResizeTo(130, 340, Easing.OutQuad); mediumRing.Foreground.ResizeTo(1, 880, Easing.Out); double remainingTime() => length - TransformDelay; using (BeginDelayedSequence(250, true)) { welcomeText.FadeIn(700); welcomeText.TransformSpacingTo(new Vector2(20, 0), remainingTime(), Easing.Out); const int line_duration = 700; const int line_resize = 150; foreach (var line in lines) { line.FadeIn(40).ResizeWidthTo(0, line_duration - line_resize, Easing.OutQuint); } const int line_end_offset = 120; smallRing.Foreground.ResizeTo(1, line_duration, Easing.OutQuint); lineTopLeft.MoveTo(new Vector2(-line_end_offset, -line_end_offset), line_duration, Easing.OutQuint); lineTopRight.MoveTo(new Vector2(line_end_offset, -line_end_offset), line_duration, Easing.OutQuint); lineBottomLeft.MoveTo(new Vector2(-line_end_offset, line_end_offset), line_duration, Easing.OutQuint); lineBottomRight.MoveTo(new Vector2(line_end_offset, line_end_offset), line_duration, Easing.OutQuint); using (BeginDelayedSequence(length * 0.56, true)) { bigRing.ResizeTo(logo_size, 500, Easing.InOutQuint); bigRing.Foreground.Delay(250).ResizeTo(1, 850, Easing.OutQuint); using (BeginDelayedSequence(250, true)) { backgroundFill.ResizeHeightTo(1, remainingTime(), Easing.InOutQuart); backgroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart); using (BeginDelayedSequence(50, true)) { foregroundFill.ResizeWidthTo(1, remainingTime(), Easing.InOutQuart); foregroundFill.RotateTo(-90, remainingTime(), Easing.InOutQuart); } this.ScaleTo(1, remainingTime(), Easing.InOutCubic); const float circle_size = logo_size * 0.9f; const int rotation_delay = 110; const int appear_delay = 80; purpleCircle.MoveToY(circle_size / 2, remainingTime(), Easing.InOutQuart); purpleCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart); purpleCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart); using (BeginDelayedSequence(appear_delay, true)) { yellowCircle.MoveToY(-circle_size / 2, remainingTime(), Easing.InOutQuart); yellowCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart); yellowCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart); using (BeginDelayedSequence(appear_delay, true)) { blueCircle.MoveToX(-circle_size / 2, remainingTime(), Easing.InOutQuart); blueCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart); blueCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart); using (BeginDelayedSequence(appear_delay, true)) { pinkCircle.MoveToX(circle_size / 2, remainingTime(), Easing.InOutQuart); pinkCircle.Delay(rotation_delay).RotateTo(-180, remainingTime() - rotation_delay, Easing.InOutQuart); pinkCircle.ResizeTo(circle_size, remainingTime(), Easing.InOutQuart); } } } } } } }
public MashViewCell() { //Create label for hop name and bind it to "HopName" WhiteTextColorLabel grainLabel = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.55), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) }; grainLabel.SetBinding(Label.TextProperty, new Binding("SelectedGrain.GrainName", BindingMode.OneWay, null, null, "{0}")); //Create label for AA Percentage Low and bind it to AALow WhiteTextColorLabel srm = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.13), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), XAlign = TextAlignment.Center }; srm.SetBinding(Label.TextProperty, new Binding("SelectedGrain.srmColor", BindingMode.OneWay, null, null, "{0}")); WhiteTextColorLabel ppg = new WhiteTextColorLabel { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, WidthRequest = (double)(App.ScreenWidth * 0.15), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), XAlign = TextAlignment.Center }; ppg.SetBinding(Label.TextProperty, new Binding("SelectedGrain.PPG", BindingMode.OneWay, null, null, "{0}")); //Create label for AA Percentage High and bind it to AAHigh GrainThemedNumberEntry pounds = new GrainThemedNumberEntry { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.CenterAndExpand, Keyboard = Keyboard.Numeric, WidthRequest = (double)(App.ScreenWidth * 0.15) }; pounds.SetBinding(Entry.TextProperty, new Binding("Pounds", BindingMode.TwoWay, null, null, "{0}")); pounds.Focused += (object sender, FocusEventArgs e) => { Handlefocus(pounds); }; pounds.Unfocused += (object sender, FocusEventArgs e) => { HandleUnfocused(pounds); }; VerticalOptions = LayoutOptions.CenterAndExpand; Padding = new Thickness(5, 0, 0, 5); BackgroundColor = Color.Transparent; ColumnDefinitions = new ColumnDefinitionCollection { new ColumnDefinition { Width = new GridLength(3, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }; Children.Add(grainLabel, 0, 1, 0, 1); Children.Add(srm, 1, 2, 0, 1); Children.Add(ppg, 2, 3, 0, 1); Children.Add(pounds, 3, 4, 0, 1); }
private void RemoveChild(LSBody child) { Children.Remove(child); }
public override void UpdateLayout() { //while (!layoutIsValid) //{ //if (!(sizeIsValid && positionIsValid)) base.UpdateLayout(); //if (!base.layoutIsValid) // return; currentXForWidget = ClientRectangle.X; currentYForWidget = ClientRectangle.Y; highestWidget = 0; largestWidget = 0; Rectangle contentBounds = Rectangle.Zero; GraphicObject[] widgets = new GraphicObject[Children.Count]; Children.CopyTo(widgets); foreach (GraphicObject w in widgets) { if (w.renderBounds.Width > largestWidget) { largestWidget = w.renderBounds.Width; } if (w.renderBounds.Height > highestWidget) { highestWidget = w.renderBounds.Height; } if (!enoughtSpaceForWidget(w)) { advance(w); } if (enoughtSpaceForWidget(w)) { w.renderBounds.X = currentXForWidget; w.renderBounds.Y = currentYForWidget; w.positionIsValid = true; contentBounds += w.renderBounds; advance(w); } else { break; } } contentBounds.Width += BorderWidth + Margin; contentBounds.Height += BorderWidth + Margin; if (SizeToContent) { renderBounds.Size = contentBounds.Size; } else if (VerticalScrolling) { renderBounds.Size = new Size(renderBounds.Size.Width, contentBounds.Size.Height); } else if (HorizontalScrolling) { renderBounds.Size = new Size(contentBounds.Size.Width, renderBounds.Size.Height); } if (layoutIsValid) { registerForRedraw(); } }
/// <summary> /// Tell children the same message, delayed. /// The list of children to send to are filtered by the predicate provided /// </summary> /// <remarks> /// This will fail to be accurate across a Daylight Saving Time boundary /// </remarks> /// <param name="message">Message to send</param> /// <param name="delayUntil">Date and time to send</param> /// <param name="predicate">The list of children to send to are filtered by the predicate provided</param> /// <param name="sender">Optional sender override. The sender is handled automatically if you do not provide one.</param> /// <returns>IDisposable that you can use to cancel the operation if necessary. You do not need to call Dispose /// for any other reason.</returns> public static Unit tellChildren <T>(T message, DateTime delayUntil, Func <ProcessId, bool> predicate, ProcessId sender = default(ProcessId)) => Children.Filter(predicate).Values.Iter(child => tell(child, message, delayUntil, sender));
/// <summary> /// Tell children the same message, delayed. /// The list of children to send to are filtered by the predicate provided /// </summary> /// <param name="message">Message to send</param> /// <param name="schedule">A structure that defines the method of delivery of the scheduled message</param> /// <param name="predicate">The list of children to send to are filtered by the predicate provided</param> /// <param name="sender">Optional sender override. The sender is handled automatically if you do not provide one.</param> /// <returns>IDisposable that you can use to cancel the operation if necessary. You do not need to call Dispose /// for any other reason.</returns> public static Unit tellChildren <T>(T message, Schedule schedule, Func <ProcessId, bool> predicate, ProcessId sender = default(ProcessId)) => Children.Filter(predicate).Values.Iter(child => tell(child, message, schedule, sender));
public TabbedMascotaPage() { InitializeComponent(); Children.Add(new MainMascotaPage()); Children.Add(new AddMascotaPage()); }
private void TestArrangeOverrideCore(Orientation orientation) { ResetState(); DepthAlignment = DepthAlignment.Stretch; // Create and add children var child1 = new ArrangeValidator { DepthAlignment = DepthAlignment.Stretch }; var child2 = new ArrangeValidator { DepthAlignment = DepthAlignment.Stretch }; var child3 = new ArrangeValidator { DepthAlignment = DepthAlignment.Stretch }; Children.Add(child1); Children.Add(child2); Children.Add(child3); // set the stack orientation Orientation = orientation; // set children margins Children[0].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); Children[1].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); Children[2].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); // set an available size var availablesizeWithMargins = 1000 * rand.NextVector3(); var availableSizeWithoutMargins = CalculateSizeWithoutThickness(ref availablesizeWithMargins, ref MarginInternal); // set the arrange validator values foreach (ArrangeValidator child in Children) { child.ReturnedMeasuredValue = 1000 * rand.NextVector3(); child.ExpectedArrangeValue = CalculateSizeWithoutThickness(ref availableSizeWithoutMargins, ref child.MarginInternal); child.ExpectedArrangeValue[(int)Orientation] = child.ReturnedMeasuredValue[(int)Orientation]; } // Measure the stack Measure(availableSizeWithoutMargins); Arrange(availablesizeWithMargins, false); // compute the children accumulated sizes var acculumatedDesiredSizeWithMarginsList = new List <Vector3>(); for (int i = 0; i < Children.Count; i++) { var accumulatedVector = Vector3.Zero; for (int j = 0; j < i; j++) { for (int dim = 0; dim < 3; ++dim) { accumulatedVector[dim] += Children[j].RenderSize[dim] + Children[j].Margin[dim] + Children[j].Margin[dim + 3]; } } acculumatedDesiredSizeWithMarginsList.Add(accumulatedVector); } // checks the stack arranged size Assert.AreEqual(availableSizeWithoutMargins, RenderSize); // Checks the children arrange matrix for (int i = 0; i < Children.Count; i++) { var childOffsets = -RenderSize / 2; switch (orientation) { case Orientation.Horizontal: childOffsets.X += acculumatedDesiredSizeWithMarginsList[i].X; break; case Orientation.Vertical: childOffsets.Y += acculumatedDesiredSizeWithMarginsList[i].Y; break; case Orientation.InDepth: childOffsets.Z += acculumatedDesiredSizeWithMarginsList[i].Z; break; default: throw new ArgumentOutOfRangeException(nameof(orientation)); } Utilities.AssertAreNearlyEqual(Matrix.Translation(childOffsets), Children[i].DependencyProperties.Get(PanelArrangeMatrixPropertyKey)); } }
private void TestMeasureOverrideCore(Orientation orientation) { // set the stack orientation Orientation = orientation; // set children margins Children[0].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); Children[1].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); Children[2].Margin = rand.NextThickness(10, 11, 12, 13, 14, 15); // set an available size var availablesizeWithMargins = 1000 * rand.NextVector3(); var availableSizeWithoutMargins = CalculateSizeWithoutThickness(ref availablesizeWithMargins, ref MarginInternal); // set the validator expected and return values foreach (MeasureValidator child in Children) { // set the children desired size via the Measure override return value child.ReturnedMeasuredValue = 100 * rand.NextVector3(); // set the expected size for child provided size validation var expectedSize = CalculateSizeWithoutThickness(ref availableSizeWithoutMargins, ref child.MarginInternal); expectedSize[(int)Orientation] = float.PositiveInfinity; child.ExpectedMeasureValue = expectedSize; } // Measure the stack Measure(availablesizeWithMargins); // compute the children max desired sizes var maximumDesiredSizeWithMargins = Vector3.Zero; foreach (var child in Children) { maximumDesiredSizeWithMargins = new Vector3( Math.Max(maximumDesiredSizeWithMargins.X, child.DesiredSizeWithMargins.X), Math.Max(maximumDesiredSizeWithMargins.Y, child.DesiredSizeWithMargins.Y), Math.Max(maximumDesiredSizeWithMargins.Z, child.DesiredSizeWithMargins.Z)); } // compute the children accumulated sizes var acculumatedDesiredSizeWithMargins = Children.Aggregate(Vector3.Zero, (current, child) => current + child.DesiredSizeWithMargins); // Checks the desired size switch (orientation) { case Orientation.Horizontal: Assert.AreEqual(acculumatedDesiredSizeWithMargins.X, DesiredSize.X); Assert.AreEqual(maximumDesiredSizeWithMargins.Y, DesiredSize.Y); Assert.AreEqual(maximumDesiredSizeWithMargins.Z, DesiredSize.Z); break; case Orientation.Vertical: Assert.AreEqual(maximumDesiredSizeWithMargins.X, DesiredSize.X); Assert.AreEqual(acculumatedDesiredSizeWithMargins.Y, DesiredSize.Y); Assert.AreEqual(maximumDesiredSizeWithMargins.Z, DesiredSize.Z); break; case Orientation.InDepth: Assert.AreEqual(maximumDesiredSizeWithMargins.X, DesiredSize.X); Assert.AreEqual(maximumDesiredSizeWithMargins.Y, DesiredSize.Y); Assert.AreEqual(acculumatedDesiredSizeWithMargins.Z, DesiredSize.Z); break; default: throw new ArgumentOutOfRangeException(nameof(orientation)); } }
protected override void Init() { Children.Add(new Bugzilla33268ListView()); Children.Add(new Simple()); Children.Add(new Bugzilla33268NoListView()); }
/// <summary> /// Remove the margin /// </summary> public void Remove() { Children.Remove(_codeNavGrid); }
public void AddChild(Source child) { Children.Add(child); child.Parent = this; }
/// <summary> /// Tell children the same message /// </summary> /// <param name="message">Message to send</param> /// <param name="sender">Optional sender override. The sender is handled automatically if you do not provide one.</param> public static Unit tellChildren <T>(T message, ProcessId sender = default(ProcessId)) => Children.Iter(child => tell(child, message, sender));
public PromotionReward[] GetRewards() { var retVal = Children.OfType<IRewardExpression>().SelectMany(x => x.GetRewards()).OfType<PromotionReward>().ToArray(); return retVal; }
/// <summary> /// Tell children the same message /// </summary> /// <param name="message">Message to send</param> /// <param name="sender">Optional sender override. The sender is handled automatically if you do not provide one.</param> internal static Unit tellSystemChildren <T>(T message, ProcessId sender = default(ProcessId)) => Children.Iter(child => tellSystem(child, message, sender));
/// <summary> /// Removes an existing object from Children if exists, /// and resets to new Child position /// </summary> public void ResetChild(WorldObject item) { Children.Remove(Children.Find(s => s.Guid == item.Guid.Full)); TrySetChild(item); }
public INamedAsset FindFirstChild() { return(Children.FirstOrDefault()); }
protected override Size ArrangeOverride(Size finalSize) { int vcount = Children.Count(x => x.Visibility == Visibility.Visible); if (Orientation == Orientation.Horizontal) { var actualRows = Math.Ceiling((double)vcount / Columns); //var cellWidth = Math.Floor(finalSize.Width / Columns); //var cellHeight = Math.Floor(finalSize.Height / actualRows); var cellWidth = finalSize.Width / Columns; var cellHeight = finalSize.Height / actualRows; Size cellSize = new Size(cellWidth, cellHeight); int row = 0, col = 0; foreach (UIElement child in Children) { if (child.Visibility != Visibility.Visible) { continue; } child.Arrange(new Rect(new Point(cellSize.Width * col, cellSize.Height * row), cellSize)); var element = child as FrameworkElement; if (element != null) { element.Height = cellSize.Height; element.Width = cellSize.Width; } if (++col == Columns) { row++; col = 0; } } } else { var actualColumns = Math.Ceiling((double)vcount / Rows); //var cellWidth = Math.Floor(finalSize.Width / actualColumns); //var cellHeight = Math.Floor(finalSize.Height / Rows); var cellWidth = finalSize.Width / actualColumns; var cellHeight = finalSize.Height / Rows; Size cellSize = new Size(cellWidth, cellHeight); int row = 0, col = 0; foreach (UIElement child in Children) { if (child.Visibility != Visibility.Visible) { continue; } child.Arrange(new Rect(new Point(cellSize.Width * col, cellSize.Height * row), cellSize)); var element = child as FrameworkElement; if (element != null) { element.Height = cellSize.Height; element.Width = cellSize.Width; } if (++row == Rows) { col++; row = 0; } } } return(finalSize); }
protected override void ArrangeOverride(Size finalSize) { //base.ArrangeOverride(finalSize); System.Diagnostics.Debug.Assert(finalSize.Width >= 0); System.Diagnostics.Debug.Assert(finalSize.Height >= 0); var elementHeights = Children.Select(x => x.DesiredSize.Height).ToArray(); var sumHight = elementHeights.Sum(); if (sumHight > finalSize.Height) { int i = Children.Count - 1; for (; sumHight > finalSize.Height; i--) { if (i < 0) { i = Children.Count - 1; } if (elementHeights[i] <= 0) { continue; } sumHight--; elementHeights[i]--; } } if (sumHight < finalSize.Height && elementHeights.Any()) { elementHeights[elementHeights.Length - 1] += finalSize.Height - sumHight; } for (int i = 0; i < Children.Count; i++) { int x; int width; switch (Children[i].HorizontalAlignment) { case HorizontalAlignment.Left: x = 0; width = (int)MathEx.Min(finalSize.Width, Children[i].DesiredSize.Width); break; case HorizontalAlignment.Right: width = (int)MathEx.Min(finalSize.Width, Children[i].DesiredSize.Width); x = (int)finalSize.Width - width; break; case HorizontalAlignment.Center: width = (int)MathEx.Min(finalSize.Width, Children[i].DesiredSize.Width); if ((finalSize.Width - width) % 2 == 1) { width++; } x = (int)(finalSize.Width - width) / 2; break; default: case HorizontalAlignment.Strech: x = 0; width = (int)finalSize.Width; break; } Children[i].Arrange(new Rect(x, i == 0 ? 0 : elementHeights.Take(i).Sum(), width, elementHeights[i])); } }
public void Add(RouteHandler child) { Children.Add(child); }
private void SortChildren() { Children.Sort((x, y) => x.depth.CompareTo(y.depth)); }
public CarouselPageCode() { InitializeComponent(); Thickness padding; switch (Device.RuntimePlatform) { case Device.iOS: case Device.Android: padding = new Thickness(0, 40, 0, 0); break; default: padding = new Thickness(); break; } var redContentPage = new ContentPage { Padding = padding, Content = new StackLayout { Children = { new Label { Text = "Red", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center }, new BoxView { Color = Color.Red, WidthRequest = 200, HeightRequest = 200, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand } } } }; var greenContentPage = new ContentPage { Padding = padding, Content = new StackLayout { Children = { new Label { Text = "green", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center }, new BoxView { Color = Color.Green, WidthRequest = 200, HeightRequest = 200, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand } } } }; var blueContentPage = new ContentPage { Padding = padding, Content = new StackLayout { Children = { new Label { Text = "blue", FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), HorizontalOptions = LayoutOptions.Center }, new BoxView { Color = Color.Blue, WidthRequest = 200, HeightRequest = 200, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand } } } }; Children.Add(redContentPage); Children.Add(greenContentPage); Children.Add(blueContentPage); }
private void RemoveBuble(Bubble bubble) { Children.Remove(bubble); bubble.Clicked -= bubble_Clicked; _bubbles[bubble.Row, bubble.Column] = null; }
internal OffsetOfExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_OffsetOfExpr) { _indexExprs = new Lazy <IReadOnlyList <Expr> >(() => Children.Cast <Expr>().ToList()); _typeSourceInfoType = new Lazy <Type>(() => TranslationUnit.GetOrCreate <Type>(Handle.TypeOperand)); }
/// /// ------------------------------------------------------------------------------------------------ /// Name PopupLayouts /// <summary> /// Initializes a new instance of the <see cref="T:PopupLayouts{T,T,T}"/> class. /// </summary> /// <param name="view"> first parameter will take any View</param> /// <param name="parentPage"> second parameter a reference to the current content window</param> /// <param name="parentScroll"> third parameter optional parent scroll view if you want relative popups to show relative to scroll position</param> /// /// ------------------------------------------------------------------------------------------------ /// public PopupInstanceLayout(View view, ContentView parentPage, ScrollView parentScroll = null) { _parentview = parentPage; _contentArea = view; _lastwidth = parentPage.Width; _lastwidth = parentPage.Height; HorizontalOptions = LayoutOptions.FillAndExpand; VerticalOptions = LayoutOptions.FillAndExpand; BackgroundColor = Color.Transparent; _scrollVset = 0; if (parentScroll != null) { if (_parentScroll == null) { this._parentScroll = parentScroll; this._scrollVset = parentScroll.Y; } this._parentScroll.Scrolled += ((object sender, ScrolledEventArgs e) => { if (e.ScrollY > 0) { this.LastScrollY = e.ScrollY; } }); } Children.Add(view, new Rectangle(0f, 0f, parentPage.Width - parentPage.Padding.HorizontalThickness, parentPage.Height - parentPage.Padding.VerticalThickness), AbsoluteLayoutFlags.None); _parentview.SizeChanged += (async(object sender, EventArgs e) => { if (view != null && _parentview.Width > 0) { if (Math.Abs(_lastwidth - _parentview.Width) > .001) { _lastwidth = _parentview.Width; _lastheight = _parentview.Height; SetLayoutBounds(view, new Rectangle(0f, 0f, _parentview.Width - _parentview.Padding.HorizontalThickness, _parentview.Height - _parentview.Padding.VerticalThickness)); if (_parentScroll != null && _relativeTo != null && PopupVisible) { await _parentScroll.ScrollToAsync(_relativeTo, ScrollToPosition.MakeVisible, false); } else if (_parentScroll != null && LastScrollY > 0) { if (_lastwidth > _lastheight) { await _parentScroll.ScrollToAsync(0, LastScrollY + 216, false); } else { await _parentScroll.ScrollToAsync(0, LastScrollY - 216, false); } } if (view != null && PopupVisible) { if (_isModal) { SetLayoutBounds(_popupShield, new Rectangle(0, 0, _parentview.Width, _parentview.Height)); if (!Children.Contains(_popupShield)) { Children.Add(_popupShield); } } switch (_popupType) { case PopupType.Center: _popupWidth = _parentview.Width * _scale; _popupHeight = _parentview.Height * _scale; _popupLeft = ((_parentview.Width - _parentview.Padding.HorizontalThickness) - _popupWidth) / 2; _popupTop = ((_parentview.Height - _parentview.Padding.VerticalThickness) - _popupHeight) / 2; if (_popupFramer != null) { SetLayoutBounds(_popupFramer, new Rectangle(_popupLeft, _popupTop, _popupWidth, _popupHeight)); } break; case PopupType.Relative: _width = _owidth; _height = _oheight; Device.BeginInvokeOnMainThread(() => { Children.Remove(_popupFramer); _popupFramer = null; _popupFrame = null; _popupStack = null; if (_isModal) { Children.Remove(_popupShield); _popupShield = null; } }); Device.StartTimer(TimeSpan.FromMilliseconds(500), () => { Task.Factory.StartNew(delegate { Device.BeginInvokeOnMainThread(() => ShowInstacePopup(_tempCurrentPage, _tempCurrentLayout, _popupContent, _relativeTo, _owidth, _oheight, _isModal, _title)); }); return(false); }); return; case PopupType.Margin: _left = _parentview.Width * _marginRect.Left; _top = _parentview.Height * _marginRect.Top; _right = _parentview.Width * _marginRect.Right; _bottom = _parentview.Height * _marginRect.Bottom; SetLayoutBounds(_popupFramer, new Rectangle(_left, _top, _parentview.Width - _right, _parentview.Height - _bottom)); break; default: break; } if (_popupFramer != null) { if (!Children.Contains(_popupFramer)) { Children.Add(_popupFramer); } } } } } }); }
protected virtual void ItemsModel3D_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Replace: case NotifyCollectionChangedAction.Remove: if (e.OldItems != null) { foreach (var item in e.OldItems) { Element3D element; if (elementDict.TryGetValue(item, out element)) { Children.Remove(element); elementDict.Remove(item); } } InvalidateRender(); } break; case NotifyCollectionChangedAction.Reset: Clear(); break; } switch (e.Action) { case NotifyCollectionChangedAction.Reset: if (this.ItemsSource != null) { if (this.ItemTemplate == null) { foreach (var item in this.ItemsSource) { var model = item as Element3D; if (model != null) { this.Children.Add(model); elementDict.Add(item, model); } else { throw new InvalidOperationException("Cannot create a Model3D from ItemTemplate."); } } } else { foreach (var item in this.ItemsSource) { var model = this.ItemTemplate.LoadContent() as Element3D; if (model != null) { model.DataContext = item; this.Children.Add(model); elementDict.Add(item, model); } else { throw new InvalidOperationException("Cannot create a Model3D from ItemTemplate."); } } } } InvalidateRender(); break; case NotifyCollectionChangedAction.Add: case NotifyCollectionChangedAction.Replace: if (e.NewItems != null) { if (this.ItemTemplate != null) { foreach (var item in e.NewItems) { var model = this.ItemTemplate.LoadContent() as Element3D; if (model != null) { model.DataContext = item; this.Children.Add(model); elementDict.Add(item, model); } else { throw new InvalidOperationException("Cannot create a Model3D from ItemTemplate."); } } } else { foreach (var item in e.NewItems) { var model = item as Element3D; if (model != null) { this.Children.Add(model); elementDict.Add(item, model); } else { throw new InvalidOperationException("Cannot create a Model3D from ItemTemplate."); } } } } break; } }
/// <summary> /// Adds the bubble. /// </summary> /// <param name="bubble">The bubble.</param> public void AddBubble(Bubble bubble) { Children.Add(bubble); bubble.Clicked += new EventHandler(bubble_Clicked); }
public void CreateXElementMultipleReferenceDataTypes() { var father = new Person() { Name = "Father", Birthday = new DateTime(1970, 7, 7), Height = 180, Weight = 80 }; var mother = new Person() { Name = "Mother", Birthday = new DateTime(1975, 7, 7), Height = 175, Weight = 72 }; var child = new Child() { Father = father, Mother = mother }; var child2 = new Child() { Father = father, Mother = mother }; var children = new Children() { ChildOne = child, ChildTwo = child2 }; var expectedFather = new XElement("Person"); expectedFather.SetElementValue("Name", "Father"); expectedFather.SetElementValue("Birthday", "1970-07-07T00:00:00"); expectedFather.SetElementValue("Weight", "80"); expectedFather.SetElementValue("Height", "180"); var expectedMother = new XElement("Person"); expectedMother.SetElementValue("Name", "Mother"); expectedMother.SetElementValue("Birthday", "1975-07-07T00:00:00"); expectedMother.SetElementValue("Weight", "72"); expectedMother.SetElementValue("Height", "175"); var expectedChild1 = new XElement("ChildOne", expectedFather, expectedMother); var expectedChild2 = new XElement("ChildTwo", expectedFather, expectedMother); var expectedChildren = new XElement("Children", expectedChild1, expectedChild2); var dataStore = new ChildrenDataStore(); var actualElement = dataStore.CreateXElement(children); var guid = actualElement.GetGuid(); expectedChildren.SetAttributeValue("ref", guid); guid = actualElement.Elements().ElementAt(0).GetGuid(); expectedChild1.SetAttributeValue("ref", guid); guid = actualElement.Elements().ElementAt(1).GetGuid(); expectedChild2.SetAttributeValue("ref", guid); guid = actualElement.Elements().ElementAt(0).Elements().ElementAt(0).GetGuid(); expectedFather.SetAttributeValue("ref", guid); guid = actualElement.Elements().ElementAt(0).Elements().ElementAt(1).GetGuid(); expectedMother.SetAttributeValue("ref", guid); Assert.AreEqual(expectedChildren.Value, actualElement.Value); }
public void CreateDemoDb(string filepath) { if (File.Exists(filepath)) { File.Delete(filepath); } #region creation Db4oFactory.Configure().BlockSize(8); IObjectContainer objContainer = Db4oFactory.OpenFile(filepath); for (int i = 0; i < 75; i++) { try { Pilot p1 = new Pilot("John " + i, i + 2); Car c1 = new Car("Ferrari " + i); c1.Count = i; c1.List = new ArrayList(); for (int l = 0; l < 15; l++) { c1.List.Add(l + 77); } c1.Pilot = p1; Children ch1 = new Children(); ch1.Child_name = "Baby " + i; ch1.Child_no = 1; ch1.DateOfBirth = DateTime.Now; c1.Pilot.Children = new Children(); c1.Pilot.Children = ch1; c1.Pilot.Dbl = i / 3; c1.Pilot.ByteProp = (Byte)(1.1 * i * 255.0); c1.Pilot.SbyteProp = (SByte)(1.23 * i * 55.0); c1.Pilot.SingleProp = 2; c1.Htbl = new Hashtable(); for (int m = 0; m < 10; m++) { c1.Htbl.Add(m + 7, "value " + m + 9); } c1.CharArr = new char[2]; c1.CharArr[0] = '$'; c1.CharArr[1] = '*'; c1.DblArr = new float[6]; for (int n = 0; n < 6; n++) { c1.DblArr[n] = n + 33; } if (i % 2 == 0) c1.Pilot.HasWon = false; else c1.Pilot.HasWon = true; c1.IntArrl = new int[] { 1 + i, 2 + i, 3 + i }; c1.Int16 = 12; c1.String = "String Ferrari" + i; c1.Character = '!'; c1.DecimalProp = 0.7M; objContainer.Store(c1); objContainer.Commit(); } catch { } } for (int i = 0; i < 75; i++) { try { Pilot p1 = new Pilot("Michael " + i, i + 2); Car c1 = new Car("BMW " + i); c1.Count = i; c1.List = new ArrayList(); for (int k = 0; k < 3; k++) { c1.List.Add(k + 55); } c1.Pilot = p1; Children ch1 = new Children(); ch1.Child_name = "Child " + i; ch1.Child_no = 1; c1.Pilot.Children = new Children(); c1.Pilot.Children = ch1; c1.Pilot.Dbl = i / 3; c1.Pilot.ByteProp = (Byte)(1.5 * i * 255.0); c1.Pilot.SbyteProp = (SByte)(1.4 * i * 55.0); c1.Pilot.SingleProp = 2; c1.Htbl = new Hashtable(); for (int l = 0; l < 10; l++) { c1.Htbl.Add("key no" + l + 34, "Value " + l + 12); } c1.CharArr = new char[3]; c1.CharArr[0] = '!'; c1.CharArr[1] = '&'; c1.CharArr[2] = '^'; c1.DblArr = new float[8]; for (int m = 0; m < 8; m++) { c1.DblArr[m] = m + 21; } if (i % 2 == 0) c1.Pilot.HasWon = true; else c1.Pilot.HasWon = false; c1.IntArrl = new int[] { 4 + i, 5 + i, 7 + i }; c1.Int16 = 12; c1.String = "String BMW" + i; c1.Character = '('; c1.DecimalProp = 0.4M; objContainer.Store(c1); objContainer.Commit(); } catch { } } objContainer.Close(); objContainer = null; #endregion RefreshConnectionData(filepath); }