Exemple #1
0
        /// <summary>
        /// Expands the GroupBox</summary>
        public void Expand()
        {
            if (!IsCollapsed)
            {
                return;
            }

            Expanding.Raise(this, EventArgs.Empty);

            foreach (Control child in Controls)
            {
                if (ReferenceEquals(child, m_btn))
                {
                    continue;
                }

                child.Show();
            }

            MinimumSize = new Size(m_prevMinSize.Width, m_prevMinSize.Height);

            base.Height = LastHeight;
            LastHeight  = CollapseHeight;

            IsCollapsed = false;

            Invalidate();
            m_btn.Invalidate();

            Expanded.Raise(this, EventArgs.Empty);
        }
		private PositionedGraph buildTreeGraph(ObjectGraph objectGraph, Expanded expanded)
		{
			var resultGraph = new PositionedGraph();
			
			// create empty PosNodes
			foreach (ObjectGraphNode objectGraphNode in objectGraph.ReachableNodes)
			{
				TreeGraphNode posNode = createNewTreeGraphNode(objectGraphNode); 
				resultGraph.AddNode(posNode);
				treeNodeFor[objectGraphNode] = posNode;
				posNode.InitContentFromObjectNode(expanded);
			}
			
			// create edges
			foreach (PositionedGraphNode posNode in resultGraph.Nodes)
			{
				// create edges outgoing from this posNode
				foreach (PositionedNodeProperty property in posNode.Properties)
				{
					//property.IsPropertyExpanded = expanded.Expressions.IsExpanded(property.Expression);
					
					if (property.ObjectGraphProperty.TargetNode != null)
					{
						ObjectGraphNode targetObjectNode = property.ObjectGraphProperty.TargetNode;
						PositionedGraphNode edgeTarget = treeNodeFor[targetObjectNode];
						property.Edge = new TreeGraphEdge 
							{ IsTreeEdge = false, Name = property.Name, Source = property, Target = edgeTarget };
					}
				}
			}
			
			resultGraph.Root = treeNodeFor[objectGraph.Root];
			return resultGraph;
		}
Exemple #3
0
        protected override void ProcessRecord()
        {
            var ctl = new NavItem
            {
                Key       = Key,
                Text      = Text,
                Url       = Url,
                Icon      = Icon,
                IconColor = IconColor
            };

            if (NewWindow.IsPresent)
            {
                ctl.NewWindow = NewWindow.ToBool();
            }

            if (Expanded.IsPresent)
            {
                ctl.Expanded = Expanded.ToBool();
            }

            if (SubItems != null)
            {
                foreach (var subItem in SubItems)
                {
                    ctl.SubItems.Add(subItem);
                }
            }

            SetControlProps(ctl);

            WriteObject(ctl);
        }
        // Expanded is passed so that the correct ContentNodes are expanded in the PositionedNode
        PositionedGraph BuildPositionedGraph(ObjectGraph objectGraph, Expanded expanded)
        {
            var positionedNodeFor = new Dictionary <ObjectGraphNode, PositionedNode>();
            var positionedGraph   = new PositionedGraph();

            // create empty PositionedNodes
            foreach (ObjectGraphNode objectNode in objectGraph.ReachableNodes)
            {
                var posNode = new PositionedNode(objectNode, expanded);
                posNode.MeasureVisualControl();
                positionedGraph.AddNode(posNode);
                positionedNodeFor[objectNode] = posNode;
            }

            // create edges
            foreach (PositionedNode posNode in positionedGraph.Nodes)
            {
                foreach (PositionedNodeProperty property in posNode.Properties)
                {
                    if (property.ObjectGraphProperty.TargetNode != null)
                    {
                        ObjectGraphNode targetObjectNode = property.ObjectGraphProperty.TargetNode;
                        PositionedNode  edgeTarget       = positionedNodeFor[targetObjectNode];
                        property.Edge = new PositionedEdge {
                            Name = property.Name, Source = property, Target = edgeTarget
                        };
                    }
                }
            }
            positionedGraph.Root = positionedNodeFor[objectGraph.Root];
            return(positionedGraph);
        }
 protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx)
 {
     return(Positioned.fill(
                new LayoutBuilder(builder: (_context, constraints) => {
         var totalExtent =
             ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent;
         var animation = new FloatTween(-totalExtent, 0).animate(ctx.state.actionsMoveAnimation);
         return new AnimatedBuilder(
             animation: ctx.state.actionsMoveAnimation,
             builder: (cxt, child) => {
             var widgets = new List <Widget>();
             ctx.buildActions(cxt).ForEach(item => {
                 var widget = new Expanded(child: item);
                 widgets.Add(widget);
             });
             return new Stack(
                 children: new List <Widget> {
                 ctx.createPositioned(
                     position: animation.value,
                     extent: totalExtent,
                     child: new Flex(
                         ctx.state.widget.direction,
                         children: widgets
                         )
                     )
             }
                 );
         }
             );
     })
                ));
 }
Exemple #6
0
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.GATEWAY);
            if (Bot.Main.EnemyRace != Race.Terran)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); });
            }
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.PYLON, Natural, NaturalDefensePos);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.GATEWAY);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.PYLON, 2);
            result.Building(UnitTypes.ROBOTICS_BAY, () => { return(!UseImmortals); });
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.GATEWAY, 2);
            result.Building(UnitTypes.PYLON, Natural);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Building(UnitTypes.PYLON, Natural);
            result.If(() => { return(Count(UnitTypes.COLOSUS) >= 6); });
            result.Building(UnitTypes.GATEWAY, 2);

            return(result);
        }
Exemple #7
0
		// Expanded is passed so that the correct ContentNodes are expanded in the PositionedNode
		PositionedGraph BuildPositionedGraph(ObjectGraph objectGraph, Expanded expanded)
		{
			var positionedNodeFor = new Dictionary<ObjectGraphNode, PositionedNode>();
			var positionedGraph = new PositionedGraph();
			
			// create empty PositionedNodes
			foreach (ObjectGraphNode objectNode in objectGraph.ReachableNodes) {
				var posNode = new PositionedNode(objectNode, expanded);
				posNode.MeasureVisualControl();
				positionedGraph.AddNode(posNode);
				positionedNodeFor[objectNode] = posNode;
			}
			
			// create edges
			foreach (PositionedNode posNode in positionedGraph.Nodes)
			{
				foreach (PositionedNodeProperty property in posNode.Properties)	{
					if (property.ObjectGraphProperty.TargetNode != null) {
						ObjectGraphNode targetObjectNode = property.ObjectGraphProperty.TargetNode;
						PositionedNode edgeTarget = positionedNodeFor[targetObjectNode];
						property.Edge = new PositionedEdge {
							Name = property.Name, Source = property, Target = edgeTarget
						};
					}
				}
			}
			positionedGraph.Root = positionedNodeFor[objectGraph.Root];
			return positionedGraph;
		}
Exemple #8
0
        /// <summary>
        /// Accordion section was Expanded (aka selected)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnExpanderExpanded(object sender, RoutedEventArgs e)
        {
            if (currentlyExpandedExpander != null)
            {
                Expander expanderLoosing = currentlyExpandedExpander as Expander;
                expanderLoosing.IsExpanded = false;
                SetRowHeight(currentlyExpandedExpander, GridUnitType.Auto);
            }

            currentlyExpandedExpander = sender as Expander;

            SetRowHeight(sender, GridUnitType.Star);

            if (Expanded != null)
            {
                Expanded.Invoke(currentlyExpandedExpander.Content, e);
            }

            QuickFilterControl qf = WpfHelper.FindDescendantElement(currentlyExpandedExpander, nameIdOfQuickFilter) as QuickFilterControl;

            if (qf != null)
            {
                qf.Visibility = System.Windows.Visibility.Visible;
            }
        }
Exemple #9
0
        /// <summary>
        /// Creates and initializes a new instance of the MultiButtonEntry class.
        /// </summary>
        /// <param name="parent">The parent is a given container, which will be attached by the MultiButtonEntry as a child. It's <see cref="EvasObject"/> type.</param>
        /// <since_tizen> preview </since_tizen>
        public MultiButtonEntry(EvasObject parent) : base(parent)
        {
            _clicked              = new SmartEvent(this, "clicked");
            _expanded             = new SmartEvent(this, "expanded");
            _contracted           = new SmartEvent(this, "contracted");
            _expandedStateChanged = new SmartEvent(this, "expand,state,changed");

            _itemSelected    = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,selected", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemClicked     = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,clicked", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemLongPressed = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,longpressed", MultiButtonEntryItemEventArgs.CreateFromSmartEvent);
            _itemAdded       = new SmartEvent <MultiButtonEntryItemEventArgs>(this, "item,added", MultiButtonEntryItemEventArgs.CreateAndAddFromSmartEvent);

            _filterCallback = new Interop.Elementary.MultiButtonEntryItemFilterCallback(FilterCallbackHandler);
            _formatCallback = new Interop.Elementary.MultiButtonEntryFormatCallback(FormatCallbackHandler);

            _clicked.On              += (sender, e) => Clicked?.Invoke(this, EventArgs.Empty);
            _expanded.On             += (sender, e) => Expanded?.Invoke(this, EventArgs.Empty);
            _contracted.On           += (sender, e) => Contracted?.Invoke(this, EventArgs.Empty);
            _expandedStateChanged.On += (sender, e) => ExpandedStateChanged?.Invoke(this, EventArgs.Empty);

            _itemSelected.On    += (sender, e) => { ItemSelected?.Invoke(this, e); };
            _itemClicked.On     += (sender, e) => { ItemClicked?.Invoke(this, e); };
            _itemLongPressed.On += (sender, e) => { ItemLongPressed?.Invoke(this, e); };
            _itemAdded.On       += OnItemAdded;
        }
Exemple #10
0
 /// <summary>
 /// Creates and initializes a new instance of the Hoversel class.
 /// </summary>
 /// <param name="parent">The parent is a given container which will be attached by Hoversel as a child. It's <see cref="EvasObject"/> type.</param>
 /// <since_tizen> preview </since_tizen>
 public Hoversel(EvasObject parent) : base(parent)
 {
     _clicked     = new SmartEvent(this, "clicked");
     _clicked.On += (sender, e) =>
     {
         Clicked?.Invoke(this, EventArgs.Empty);
     };
     _expanded     = new SmartEvent(this, "expanded");
     _expanded.On += (sender, e) =>
     {
         Expanded?.Invoke(this, EventArgs.Empty);
     };
     _dismissed     = new SmartEvent(this, "dismissed");
     _dismissed.On += (sender, e) =>
     {
         Dismissed?.Invoke(this, EventArgs.Empty);
     };
     _selected     = new SmartEvent <HoverselItemEventArgs>(this, RealHandle, "selected", HoverselItemEventArgs.CreateFromSmartEvent);
     _selected.On += (s, e) =>
     {
         if (e.Item != null)
         {
             ItemSelected?.Invoke(this, e);
         }
     };
     _onItemSelected = (data, obj, info) =>
     {
         HoverselItem item = ItemObject.GetItemById((int)data) as HoverselItem;
         item?.SendItemSelected();
     };
 }
 protected override Widget buildStackActions(BuildContext context, CustomDismissibleDelegateContext ctx)
 {
     return(Positioned.fill(
                new LayoutBuilder(builder: (_context, constraints) => {
         var widgets = new List <Widget>();
         ctx.buildActions(_context).ForEach(item => {
             var widget = new Expanded(child: item);
             widgets.Add(widget);
         });
         return new Stack(
             children: new List <Widget> {
             ctx.createPositioned(
                 position: 0,
                 extent:
                 ctx.getMaxExtent(constraints) * ctx.state.totalActionsExtent,
                 child: new Flex(
                     ctx.state.widget.direction,
                     children: widgets
                     )
                 )
         }
             );
     })
                ));
 }
 /// <inheritdoc/>
 public override int GetHashCode()
 => (Role ?? string.Empty).GetHashCode() ^
 (Name ?? string.Empty).GetHashCode() ^
 (Value ?? string.Empty).GetHashCode() ^
 (Description ?? string.Empty).GetHashCode() ^
 (Keyshortcuts ?? string.Empty).GetHashCode() ^
 (Roledescription ?? string.Empty).GetHashCode() ^
 (Valuetext ?? string.Empty).GetHashCode() ^
 Disabled.GetHashCode() ^
 Expanded.GetHashCode() ^
 Focused.GetHashCode() ^
 Modal.GetHashCode() ^
 Multiline.GetHashCode() ^
 Multiselectable.GetHashCode() ^
 Readonly.GetHashCode() ^
 Required.GetHashCode() ^
 Selected.GetHashCode() ^
 Checked.GetHashCode() ^
 Pressed.GetHashCode() ^
 Level.GetHashCode() ^
 Valuemin.GetHashCode() ^
 Valuemax.GetHashCode() ^
 (Autocomplete ?? string.Empty).GetHashCode() ^
 (Haspopup ?? string.Empty).GetHashCode() ^
 (Invalid ?? string.Empty).GetHashCode() ^
 (Orientation ?? string.Empty).GetHashCode() ^
 Children.GetHashCode();
 /// <inheritdoc/>
 public override int GetHashCode()
 => Role.GetHashCode() ^
 Name.GetHashCode() ^
 Value.GetHashCode() ^
 Description.GetHashCode() ^
 KeyShortcuts.GetHashCode() ^
 RoleDescription.GetHashCode() ^
 ValueText.GetHashCode() ^
 AutoComplete.GetHashCode() ^
 HasPopup.GetHashCode() ^
 Orientation.GetHashCode() ^
 Disabled.GetHashCode() ^
 Expanded.GetHashCode() ^
 Focused.GetHashCode() ^
 Modal.GetHashCode() ^
 Multiline.GetHashCode() ^
 Multiselectable.GetHashCode() ^
 Readonly.GetHashCode() ^
 Required.GetHashCode() ^
 Selected.GetHashCode() ^
 Pressed.GetHashCode() ^
 Checked.GetHashCode() ^
 Level.GetHashCode() ^
 ValueMin.GetHashCode() ^
 ValueMax.GetHashCode() ^
 Children.GetHashCode();
Exemple #14
0
		/// <summary>
		/// Calculates layout for given <see cref="ObjectGraph" />.
		/// </summary>
		/// <param name="objectGraph"></param>
		/// <returns></returns>
		public PositionedGraph CalculateLayout(ObjectGraph objectGraph, Expanded expanded)
		{
			var positionedGraph = BuildPositionedGraph(objectGraph, expanded);
			CalculateLayout(positionedGraph);
			this.edgeRouter.RouteEdges(positionedGraph);
			
			return positionedGraph;
		}
Exemple #15
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            DownloadTracker.State.BindValueChanged(_ => UpdateState());
            Expanded.BindValueChanged(_ => UpdateState(), true);
            FinishTransforms(true);
        }
Exemple #16
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            Expanded.BindValueChanged(v =>
            {
                this.ResizeWidthTo(v.NewValue ? expandedWidth : contractedWidth, 500, Easing.OutQuint);
            }, true);
        }
Exemple #17
0
        public void ToggleExpandState()
        {
#if TARGET_JVM //No support for Nullable<bool>.GetValueOrDefault() yet
            bool?value = Expanded;
            Expanded = value.HasValue ? !value.Value : true;
#else
            Expanded = !Expanded.GetValueOrDefault(false);
#endif
        }
        public void Show()
        {
            //slide out
            double slideTime = maxSlideOutTime * GetSlidePercent();

            slideOut = new ThicknessAnimation(new Thickness(0), new Duration(TimeSpan.FromSeconds(slideTime)));
            BeginAnimation(MarginProperty, slideOut);
            Expanded?.Invoke(this, new EventArgs());
        }
Exemple #19
0
        /// <summary>
        ///
        /// </summary>
        protected virtual void OnExpanded()
        {
            Expanded?.Invoke(this, new EventArgs());

            if (queryOnExpanded)
            {
                BeginQuery(SystemProvider);
            }
        }
        /// <summary>
        /// Calculates layout for given <see cref="ObjectGraph" />.
        /// </summary>
        /// <param name="objectGraph"></param>
        /// <returns></returns>
        public PositionedGraph CalculateLayout(ObjectGraph objectGraph, Expanded expanded)
        {
            var positionedGraph = BuildPositionedGraph(objectGraph, expanded);

            CalculateLayout(positionedGraph);
            this.edgeRouter.RouteEdges(positionedGraph);

            return(positionedGraph);
        }
Exemple #21
0
        private BuildList EmergencyGateways()
        {
            BuildList result = new BuildList();

            result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); });
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.GATEWAY, 2);

            return(result);
        }
Exemple #22
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (MessageInfo != null ? MessageInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (int)Level;
         hashCode = (hashCode * 397) ^ Expanded.GetHashCode();
         return(hashCode);
     }
 }
Exemple #23
0
 public override Build OverrideBuild()
 {
     if (!StalkerRushDetected)
     {
         if (EnemyCount(UnitTypes.GATEWAY) >= 3 &&
             Bot.Main.Frame <= 22.4 * 60 * 2.5 &&
             !Expanded.Get().Detected &&
             TotalEnemyCount(UnitTypes.ROBOTICS_FACILITY) == 0)
         {
             StalkerRushDetected = true;
             StalkerDefenseBuild.OnStart(Bot.Main);
             CancelBuilding(UnitTypes.NEXUS);
         }
     }
     if (!CannonRush &&
         Bot.Main.Frame <= 22.4 * 60 * 2 &&
         EnemyCount(UnitTypes.FORGE) + EnemyCount(UnitTypes.PHOTON_CANNON) > 0)
     {
         CannonRush = true;
         CannonDefenseBuild.OnStart(Bot.Main);
     }
     if (!CannonRush)
     {
         foreach (Unit enemy in Bot.Main.Enemies())
         {
             if (enemy.UnitType != UnitTypes.PYLON)
             {
                 continue;
             }
             if (SC2Util.DistanceSq(enemy.Pos, Main.BaseLocation.Pos) <= 30 * 30)
             {
                 CannonRush = true;
                 CannonDefenseBuild.OnStart(Bot.Main);
                 break;
             }
             if (SC2Util.DistanceSq(enemy.Pos, Natural.BaseLocation.Pos) <= 25 * 25)
             {
                 CannonRush = true;
                 CannonDefenseBuild.OnStart(Bot.Main);
                 break;
             }
         }
     }
     if (CannonRush)
     {
         return(CannonDefenseBuild);
     }
     if (StalkerRushDetected)
     {
         return(StalkerDefenseBuild);
     }
     return(null);
 }
Exemple #24
0
 private void UpdateInnerPanelCollapsedState()
 {
     if (isExpanded && innerPanel.Parent == null)
     {
         // todo - need to support collapsing without removing the child
         innerPanel.Parent = Visual;
         Expanded?.Invoke(this, null);
     }
     else if (!isExpanded && innerPanel.Parent != null)
     {
         innerPanel.Parent = null;
         Collapsed?.Invoke(this, null);
     }
 }
Exemple #25
0
        /// <summary>
        /// Opens the node.
        /// </summary>
        public void Open()
        {
            m_Panel.Show();
            if (m_ToggleButton != null)
            {
                m_ToggleButton.ToggleState = true;
            }

            if (Expanded != null)
            {
                Expanded.Invoke(this, EventArgs.Empty);
            }

            Invalidate();
        }
Exemple #26
0
        private void SetExpanded(bool expanded)
        {
            for (int i = 1; i < Children.Count; i++)
            {
                Children[i].Visible = expanded;
            }

            (FindChild("treeviewnode_expand_btn_icon") as Icon).IconType = expanded ? Icons.AngleDown : Icons.AngleRight;

            if (expanded == true)
            {
                Expanded?.Invoke(this);
                OnExpanded();
            }
        }
Exemple #27
0
        private BuildList Nexii()
        {
            BuildList result = new BuildList();

            result.If(() => { return(Bot.Main.EnemyRace != Race.Terran || Count(UnitTypes.GATEWAY) >= 2); });
            if (Bot.Main.EnemyRace == Race.Zerg)
            {
                result.If(() => { return(!EarlyPool.Get().Detected || Expanded.Get().Detected || Completed(UnitTypes.ZEALOT) >= 2); });
            }
            result.Building(UnitTypes.NEXUS, 2);
            result.If(() => { return(Attacking); });
            result.Building(UnitTypes.NEXUS);

            return(result);
        }
Exemple #28
0
        private BuildList MainBuild()
        {
            BuildList result = new BuildList();

            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true, () => Completed(UnitTypes.PYLON) > 0);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.Building(UnitTypes.ASSIMILATOR);
            result.Building(UnitTypes.ROBOTICS_FACILITY);
            result.Building(UnitTypes.NEXUS);
            result.Upgrade(UpgradeType.WarpGate);
            result.Building(UnitTypes.GATEWAY, Main, () => Count(UnitTypes.IMMORTAL) > 0);
            result.Building(UnitTypes.PYLON, Natural, () => Natural.Owner == Bot.Main.PlayerId && !Natural.UnderAttack);
            result.Building(UnitTypes.SHIELD_BATTERY, Natural, 2, () => Bot.Main.Frame >= 3 * 60 * 22.4 && !Expanded.Get().Detected&& Completed(Natural, UnitTypes.PYLON) > 0 && !Natural.UnderAttack && !CannonDefenseDetected);
            result.If(() => Count(UnitTypes.STALKER) >= 5);
            result.Building(UnitTypes.GATEWAY, Main, () => !Expanded.Get().Detected);
            result.If(() => Count(UnitTypes.STALKER) >= 10);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.STARGATE, 2, () => TempestDetected);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => !Expanded.Get().Detected&& !TempestDetected);
            result.If(() => Count(UnitTypes.IMMORTAL) >= 2);
            result.Building(UnitTypes.TWILIGHT_COUNSEL);
            result.Upgrade(UpgradeType.Blink);
            result.Building(UnitTypes.PYLON);
            result.Building(UnitTypes.ROBOTICS_FACILITY, () => Expanded.Get().Detected&& !TempestDetected);
            result.Building(UnitTypes.FORGE);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Upgrade(UpgradeType.ProtossGroundWeapons);
            result.Building(UnitTypes.FORGE);
            result.Upgrade(UpgradeType.ProtossGroundArmor);
            result.If(() => Count(UnitTypes.IMMORTAL) >= 3 && Count(UnitTypes.STALKER) >= 10);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.ROBOTICS_BAY);
            result.Building(UnitTypes.ASSIMILATOR, 4, () => Minerals() >= 700 && Gas() < 200);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.If(() => Count(UnitTypes.STALKER) >= 20);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.NEXUS);
            result.Building(UnitTypes.ASSIMILATOR, 2);
            result.Building(UnitTypes.NEXUS);

            return(result);
        }
Exemple #29
0
        public virtual void InitOverride(AbstractNode source, Expanded expanded)
        {
            this.Name       = GetContentNodeName(source);
            this.Text       = "";                       // lazy evaluated later
            this.IsNested   = true;
            this.path       = this.Parent == null ? this.Name : this.Parent.Path + "." + this.Name;
            this.IsExpanded = (source is ThisNode) || expanded.ContentNodes.IsExpanded(this);

            foreach (AbstractNode child in source.Children)
            {
                ContentNode newChild = child is PropertyNode ?
                                       new ContentPropertyNode(this.ContainingNode, this) :
                                       new ContentNode(this.ContainingNode, this);
                newChild.InitOverride(child, expanded);
                this.Children.Add(newChild);
            }
        }
Exemple #30
0
        private BuildList EmergencyGateways()
        {
            BuildList result = new BuildList();

            result.If(() => { return(EarlyPool.Get().Detected&& !Expanded.Get().Detected); });
            result.Building(UnitTypes.PYLON, Main, WallIn.Wall[1].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main, WallIn.Wall[0].Pos, true);
            result.Building(UnitTypes.GATEWAY, Main);
            result.If(() => Count(UnitTypes.ZEALOT) >= 4);
            result.Building(UnitTypes.CYBERNETICS_CORE);
            result.If(() => Count(UnitTypes.ZEALOT) >= 6);
            result.Building(UnitTypes.ASSIMILATOR);
            result.If(() => Count(UnitTypes.ZEALOT) >= 8);
            result.Building(UnitTypes.GATEWAY, Main);

            return(result);
        }
Exemple #31
0
        public void Add(Message message)
        {
            var newList = new List <Message>(Messages)
            {
                message
            };

            message.Conversation = this;

            Messages.Replace(newList.OrderBy(m => m.SortDate));

            if (IsExpanded)
            {
                Expanded.Replace(Messages.Reverse().Skip(1));
            }

            OnPropertyChanged("First");
            OnPropertyChanged("Last");
        }
Exemple #32
0
        /// <summary>
        /// Opens the node.
        /// </summary>
        public void Open()
        {
            innerPanel.Show();
            if (toggleButton != null)
            {
                toggleButton.ToggleState = true;
            }

            if (Expanded != null)
            {
                Expanded.Invoke(this, EventArgs.Empty);
            }
            if (treeControl != null && treeControl.Expanded != null)
            {
                treeControl.Expanded.Invoke(this, EventArgs.Empty);
            }

            Invalidate();
        }
Exemple #33
0
        /// <summary>
        /// Opens the node.
        /// </summary>
        public void Open()
        {
            m_InnerPanel.Show();
            if (m_ToggleButton != null)
            {
                m_ToggleButton.ToggleState = true;
            }

            if (Expanded != null)
            {
                Expanded.Invoke(this);
            }
            if (m_TreeControl != null && m_TreeControl.Expanded != null)
            {
                m_TreeControl.Expanded.Invoke(this);
            }

            Invalidate();
        }
		public override void InitOverride(AbstractNode source, Expanded expanded)
		{
			if (!(source is PropertyNode))
				throw new InvalidOperationException(string.Format("{0} must initialize from {1}", typeof(ContentPropertyNode).Name, typeof(PropertyNode).Name));
			
			PropertyNode sourcePropertyNode = source as PropertyNode;
			
			this.Name = sourcePropertyNode.Property.Name;
			// Important to set Text here, as we might be just building new view over existing (evaluated) model.
			// If the model is not evaluated yet, this will be string.Empty and filled in Evaluate().
			this.Text = sourcePropertyNode.Property.Value;
			this.IsNested = false;
			this.IsExpanded = false;			// always false, Property nodes are never expanded (they have IsPropertyExpanded)
			this.Property = new PositionedNodeProperty(
				sourcePropertyNode.Property, this.ContainingNode,
				expanded.Expressions.IsExpanded(sourcePropertyNode.Property.Expression.Expr));
			if (PositionedGraphNodeControl.IsShowMemberIcon) {
				EvalMemberIcon();
			}
		}
		/// <summary>
		/// Calculates layout for given <see cref="ObjectGraph" />.
		/// </summary>
		/// <param name="objectGraph"></param>
		/// <returns></returns>
		public PositionedGraph CalculateLayout(ObjectGraph objectGraph, LayoutDirection direction, Expanded expanded)
		{
			layoutDirection = direction;

			treeNodeFor = new Dictionary<ObjectGraphNode, PositionedGraphNode>();
			seenNodes = new HashSet<PositionedGraphNode>();
			
			//TreeGraphNode tree = buildTreeRecursive(objectGraph.Root, expandedNodes);
			
			// convert ObjectGraph to PositionedGraph with TreeEdges
			var resultGraph = buildTreeGraph(objectGraph, expanded);
			// first layout pass
			calculateSubtreeSizes((TreeGraphNode)resultGraph.Root);
			// second layout pass
			calculateNodePosRecursive((TreeGraphNode)resultGraph.Root, 0, 0);
			
			//var neatoRouter = new NeatoEdgeRouter();
			//resultGraph = neatoRouter.CalculateEdges(resultGraph);
			resultGraph = new GraphEdgeRouter().RouteEdges(resultGraph);
			
			return resultGraph;
		}
Exemple #36
0
		/// <summary>
		/// Creates new PositionedNode.
		/// </summary>
		/// <param name="objectNode">Underlying ObjectNode.</param>
		public PositionedNode(ObjectGraphNode objectNode, Expanded expanded)
		{
			this.ObjectNode = objectNode;
			InitVisualControl();
			InitContentFromObjectNode(expanded);
		}
Exemple #37
0
		void InitContentFromObjectNode(Expanded expanded)
		{
			this.Content = new ContentNode(this, null);
			this.Content.InitOverride(this.ObjectNode.Content, expanded);
			this.NodeVisualControl.SetDataContext(this);
		}
		// TODO for speedup of re-layout only, posNodeForObjectGraphNode will be a service, that will return existing posNodes or create empty new
		public void InitContentFromObjectNode(Expanded expanded)
		{
			this.Content = new ContentNode(this, null);
			this.Content.InitFrom(this.ObjectNode.Content, expanded);
			this.nodeVisualControl.Root = this.Content;
		}