コード例 #1
0
 public RecursionTests()
 {
     boxWithKey = new Box(new List <IContainable>()
     {
         key
     });
 }
コード例 #2
0
        public void Cook(IVegetable firstVegetable, IVegetable secondVegetable, IContainable bowl)
        {
            var areIngridientsAvaliable = (firstVegetable != null) && (secondVegetable != null) && (bowl != null);

            if (!areIngridientsAvaliable)
            {
                this.speachLog.Say("Oops, bad stuff happened with the ingredients!");
                return;
            }

            this.PrepareVegetables(firstVegetable, secondVegetable);

            var isPreparationComplete = this.CheckIfVegetableIsReadyToCook(firstVegetable) &&
                                        this.CheckIfVegetableIsReadyToCook(secondVegetable);

            if (isPreparationComplete)
            {
                bowl.Contents.Add(secondVegetable);
                bowl.Contents.Add(firstVegetable);

                this.speachLog.Say("Awesome we got ourselves vegetables in a bowl!");
            }
            else
            {
                this.speachLog.Say("Oops, We Messed Up Brah!");
            }
        }
コード例 #3
0
ファイル: Container.cs プロジェクト: vennyoot/chicken-game
 private void AddItem(IContainable obj)
 {
     if (IsContainable())
     {
         currentItems.Add(obj);
     }
 }
コード例 #4
0
ファイル: Customer.cs プロジェクト: VictorWinberg/unity-game
    public virtual bool Place(GameObject gameObject)
    {
        IContainable container = gameObject.GetComponent <IContainable> ();

        if (container == null)
        {
            return(false);
        }

        IEnumerable <string> items = container.getItems().Select(item => item.name).OrderBy(x => x);

        if (!items.Any())
        {
            return(false);
        }

        IEnumerable <string> order = new List <string> {
            "Water"
        }.OrderBy(x => x);

        Serve(items.SequenceEqual(order));
        Destroy(gameObject);

        return(true);
    }
コード例 #5
0
        /// <summary>Export data according to shuffle definition in Definition to format Type</summary>
        /// <param name="container"></param>
        /// <param name="definition">Shuffle Definition</param>
        /// <param name="type">Type of target file</param>
        /// <param name="delimeter">Delimeter to use when exporting to Type: Text</param>
        /// <param name="ShuffleEventHandler">Event handler processing messages from the export. May be null.</param>
        /// <param name="defpath">Folder path for the shuffle definition file.</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <param name="splitFiles">if true, it will split into seperate XmlDocuments for each record exported. </param>
        /// <returns>XmlDocument with exported data</returns>
        public static Dictionary <string, XmlDocument> QuickExport(IContainable container, XmlDocument definition, SerializationType type, char delimeter, EventHandler <ShuffleEventArgs> ShuffleEventHandler, string defpath, bool clearRemainingShuffleVars, bool splitFiles = false)
        {
            container.Logger.StartSection("QuickExport");
            var shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(definition, clearRemainingShuffleVars);
            shuffle.Definition     = definition;
            shuffle.definitionpath = defpath;
            var blocks = shuffle.ExportFromCRM();
            Dictionary <string, XmlDocument> results;

            if (splitFiles)
            {
                results = shuffle.SplitFiles(blocks, type, delimeter);
            }
            else
            {
                results = new Dictionary <string, XmlDocument>
                {
                    { string.Empty, shuffle.Serialize(blocks, type, delimeter) }
                };
            }
            container.Logger.EndSection();
            return(results);
        }
コード例 #6
0
        public ContentRegistration Add(IContainable containable)
        {
            Containables.Add(containable);
            containable.ContainerName = ContainerName;

            return(this);
        }
コード例 #7
0
 public void Add(IContainable item)
 {
     if (item != null)
     {
         Contents.Add(item);
         OnItemAdded?.Invoke(item, EventArgs.Empty);
     }
 }
コード例 #8
0
 public bool Remove(IContainable item)
 {
     if (Contents.Remove(item))
     {
         OnItemRemoved?.Invoke(this, EventArgs.Empty);
         return(true);
     }
     return(false);
 }
コード例 #9
0
        protected virtual void Press(object sender, MouseEventArgs e)
        {
            IContainable c = Contents.GetItemAtPoint(e.Position);

            if (c != null)
            {
                if (c is IInteractive)
                {
                    _pressedItem = (IInteractive)c;
                    _pressedItem.Press(e);
                }
            }
        }
コード例 #10
0
ファイル: CEConnection.cs プロジェクト: Jhvargasp/DocEntry
        //
        // Files the Containable object (i.e. Document, CustomObject) in
        // specified Folder.
        //
        public IReferentialContainmentRelationship FileContainable(IContainable c, String folder)
        {
            IFolder f = Factory.Folder.FetchInstance(os, folder, null);
            IReferentialContainmentRelationship rcr = null;

            if (c is IDocument)
            {
                rcr = f.File((IDocument)c, AutoUniqueName.AUTO_UNIQUE, "DocEntryFile", DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
            }
            else
            {
                rcr = f.File((ICustomObject)c, AutoUniqueName.AUTO_UNIQUE, "DocEntryFile", DefineSecurityParentage.DO_NOT_DEFINE_SECURITY_PARENTAGE);
            }
            return(rcr);
        }
コード例 #11
0
        public override bool IsWithin(IContainable shape)
        {
            var topLeft     = GetTopLeftPoint();
            var topRight    = GetTopRightPoint();
            var bottomLeft  = GetBottomLeftPoint();
            var bottomRight = GetBottomRightPoint();

            bool isWithin =
                (
                    shape.DoesContainThePoint(topLeft) &&
                    shape.DoesContainThePoint(topRight) &&
                    shape.DoesContainThePoint(bottomLeft) &&
                    shape.DoesContainThePoint(bottomRight)
                );

            return(isWithin);
        }
コード例 #12
0
        public override bool IsWithin(IContainable shape)
        {
            var leftTip   = new Location(Location.X - Radius, Location.Y);
            var rightTip  = new Location(Location.X + Radius, Location.Y);
            var topTip    = new Location(Location.X, Location.Y + Radius);
            var bottomTip = new Location(Location.X, Location.Y - Radius);

            bool isWithin =
                (
                    shape.DoesContainThePoint(leftTip) &&
                    shape.DoesContainThePoint(rightTip) &&
                    shape.DoesContainThePoint(topTip) &&
                    shape.DoesContainThePoint(bottomTip)
                );

            return(isWithin);
        }
コード例 #13
0
        protected virtual void MoveStart(object sender, MouseEventArgs e)
        {
            IContainable c = Contents.GetItemAtPoint(e.Position);

            if (_movingItem == null && c != null)
            {
                if (c is IDraggable)
                {
                    IDraggable movingItem = (IDraggable)c;
                    if (movingItem.DragBounds.Contains(e.Position))
                    {
                        _movingItem = (IDraggable)c;
                        _movingItem.DragStart(e);
                    }
                }
            }
        }
コード例 #14
0
        /// <summary>Export data according to shuffle definition in Definition to format Type</summary>
        /// <param name="container"></param>
        /// <param name="Definition">Shuffle Definition</param>
        /// <param name="Type">Type of target file</param>
        /// <param name="Delimeter">Delimeter to use when exporting to Type: Text</param>
        /// <param name="ShuffleEventHandler">Event handler processing messages from the export. May be null.</param>
        /// <param name="defpath">Folder path for the shuffle definition file.</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <returns>XmlDocument with exported data</returns>
        public static XmlDocument QuickExport(IContainable container, XmlDocument Definition, SerializationType Type, char Delimeter, EventHandler <ShuffleEventArgs> ShuffleEventHandler, string defpath, bool clearRemainingShuffleVars)
        {
            container.Logger.StartSection("QuickExport");
            var shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(Definition, clearRemainingShuffleVars);
            shuffle.Definition     = Definition;
            shuffle.definitionpath = defpath;
            var blocks = shuffle.ExportFromCRM();
            var result = shuffle.Serialize(blocks, Type, Delimeter);

            container.Logger.EndSection();
            return(result);
        }
コード例 #15
0
ファイル: VisualElementRenderer.cs プロジェクト: sung-su/maui
 protected virtual void AddHeadlessChild(VisualElement element, IContainable <EvasObject> parent)
 {
     foreach (var child in (element as IVisualTreeElement).GetVisualChildren())
     {
         if (child is VisualElement visualChild)
         {
             if (CompressedLayout.GetIsHeadless(visualChild))
             {
                 AddHeadlessChild(visualChild, parent);
                 visualChild.IsPlatformEnabled = true;
             }
             else
             {
                 var childRenderer = Platform.GetOrCreateRenderer(visualChild);
                 parent.Children.Add(childRenderer.NativeView);
             }
         }
     }
 }
コード例 #16
0
        protected virtual void Click(object sender, MouseEventArgs e)
        {
            IContainable c = Contents.GetItemAtPoint(e.Position);

            if (_pressedItem != null)
            {
                if (c != null && c == _pressedItem)
                {
                    _pressedItem.Click(e);
                    _pressedItem = null;
                }
            }
            // if click was not on active item's effective bounds,
            // tell it there was a click
            if (_activatedItem != null)
            {
                _activatedItem.Click(e);
            }
        }
コード例 #17
0
        protected virtual void Hover(object sender, MouseEventArgs e)
        {
            IContainable c = Contents.GetItemAtPoint(e.Position);

            if (_hoveredItem != null)
            {
                if (_hoveredItem != (IContainable)c)
                {
                    _hoveredItem.MouseOut(e);
                }
            }
            if (c != null)
            {
                if (c is IInteractive)
                {
                    _hoveredItem = (IInteractive)c;
                    _hoveredItem.MouseOver(e);
                }
            }
        }
コード例 #18
0
        void OnLayout()
        {
            var rect = _box.Geometry;

            Element.Layout(rect.ToDP());
            _bgColorObject.Geometry = rect;
            _bgImageObject.Geometry = rect;

            _bgImageObject.StackAbove(_bgColorObject);
            EvasObject prev = _bgImageObject;

            IContainable <EvasObject> container = _box;

            foreach (var obj in container.Children)
            {
                obj.StackAbove(prev);
                prev = obj;
            }

            if (_actionButton != null)
            {
                var btnRect = _actionButton.Geometry;
                var btnW    = Math.Max(_actionButton.MinimumWidth, btnRect.Width);
                var btnH    = Math.Max(_actionButton.MinimumHeight, btnRect.Height);
                var btnX    = (rect.Width - btnW) / 2;
                var btnY    = rect.Height - btnH;
                _actionButton.Geometry = new Rect(btnX, btnY, btnW, btnH);
                _actionButton.StackAbove(prev);
                prev = _actionButton;
            }

            _surfaceLayout.Geometry = rect;
            _surfaceLayout.StackAbove(prev);
            prev = _surfaceLayout;

            if (_moreOption != null)
            {
                _moreOption.Geometry = Xamarin.Forms.Platform.Tizen.Forms.NativeParent.Geometry;
                _moreOption.StackAbove(prev);
            }
        }
コード例 #19
0
ファイル: DefinitionBuilder.cs プロジェクト: amarwadi/n2cms
        void AddContainable(ItemDefinition definition, ContainableElement editable)
        {
            Type editableType = EnsureType <IEditable>(editable.Type);

            try
            {
                IContainable containable = Activator.CreateInstance(editableType) as IContainable;
                Utility.SetProperty(containable, "Name", editable.Name);
                Utility.SetProperty(containable, "Title", editable.Title);
                Utility.SetProperty(containable, "ContainerName", editable.ContainerName);
                Utility.SetProperty(containable, "SortOrder", editable.SortOrder);
                foreach (string key in editable.EditableProperties.Keys)
                {
                    Utility.SetProperty(containable, key, editable.EditableProperties[key]);
                }
                definition.Add(containable);
            }
            catch (MissingMethodException ex)
            {
                throw new ConfigurationErrorsException("The type '" + editable.Type + "' defined in the configuration does not have a parameterless public constructor. This is required for the type to be configurable.", ex);
            }
        }
コード例 #20
0
        private IContainable FindItem(Func <IContainable, IContainable, bool> compare)
        {
            if (_contents.Count == 0)
            {
                return(default(IContainable));
            }

            if (_contents.Count == 1)
            {
                return(_contents[0]);
            }

            IContainable found = _contents[0];

            for (int i = 1; i < _contents.Count; i++)
            {
                if (compare(_contents[i], found))
                {
                    found = _contents[i];
                }
            }
            return(found);
        }
コード例 #21
0
        public void CheckWithin(IContainable containableShape)
        {
            if (Shapes.Count == 0)
            {
                _writer.WriteLine("No shapes loaded!");
                return;
            }

            bool isThereWithin = false;

            foreach (var shape in Shapes)
            {
                if (shape.IsWithin(containableShape))
                {
                    _writer.WriteLine(shape.ToString());
                    isThereWithin = true;
                }
            }

            if (!isThereWithin)
            {
                _writer.WriteLine("No shapes within the entered one!");
            }
        }
コード例 #22
0
 public int CompareTo(IContainable other)
 {
     return this.SortOrder - other.SortOrder;
 }
コード例 #23
0
        int IComparable <IContainable> .CompareTo(IContainable other)
        {
            int delta = SortOrder - other.SortOrder;

            return(delta != 0 ? delta : Name.CompareTo(other.Name));
        }
コード例 #24
0
 public int CompareTo(IContainable other)
 {
     return(this.SortOrder - other.SortOrder);
 }
コード例 #25
0
ファイル: Shuffler.cs プロジェクト: lulzzz/Innofactor.Crm.CI
 /// <summary>Export data according to shuffle definition in Definition to format Type</summary>
 /// <param name="Definition">Shuffle Definition</param>
 /// <param name="Type">Type of target file</param>
 /// <param name="Delimeter">Delimeter to use when exporting to Type: Text</param>
 /// <param name="ShuffleEventHandler">Event handler processing messages from the export. May be null.</param>
 /// <param name="container"></param>
 /// <returns>XmlDocument with exported data</returns>
 public static XmlDocument QuickExport(XmlDocument Definition, SerializationType Type, char Delimeter, EventHandler <ShuffleEventArgs> ShuffleEventHandler, IContainable container)
 {
     return(QuickExport(Definition, Type, Delimeter, ShuffleEventHandler, container, null));
 }
コード例 #26
0
ファイル: Figure.cs プロジェクト: Rupini/Hexocracy
 protected override void OnItemBoxContact(IContainable item)
 {
     ((ItemBox)item).Contact(this);
 }
コード例 #27
0
 private void HandleWallAction(WallActionType wallactiontype, WallOrientationType wallorientationtype, IContainable currentind)
 {
     switch (wallactiontype)
     {
         case Walls.WallActionType.Bounce:
             if(wallorientationtype == WallOrientationType.Vertical)
             {
                 currentind.BounceXWall();
             }
             else
             {
                 currentind.BounceYWall();
             }
             break;
         case Walls.WallActionType.Portal:
             if(wallorientationtype == WallOrientationType.Vertical)
             {
                 currentind.TravelThroughXWall();
             }
             else
             {
                 currentind.TravelThroughYWall();
             }
             break;
     }
 }
コード例 #28
0
ファイル: ItemEditView.cs プロジェクト: dpawatts/zeus
        private void AddPropertyControlsRecursive(Control control, IContainable contained)
        {
            Control addedControl = contained.AddTo(control);

            if (contained is IEditor)
                PropertyControls.Add(contained.Name, addedControl);
            if (contained is IEditorContainer)
                foreach (IContainable subContained in ((IEditorContainer) contained).GetContained(Page.User))
                    AddPropertyControlsRecursive(addedControl, subContained);
        }
コード例 #29
0
 public void AddContained(IContainable containable)
 {
     _contained.Add(containable);
     _contained.Sort();
 }
コード例 #30
0
ファイル: BouncingObject.cs プロジェクト: Rupini/Hexocracy
 protected abstract void OnItemBoxContact(IContainable item);
コード例 #31
0
        public override bool IsWithin(IContainable shape)
        {
            bool isWithin = shape.DoesContainThePoint(Location) && shape.DoesContainThePoint(EndLocation);

            return(isWithin);
        }
コード例 #32
0
ファイル: Border.cs プロジェクト: kbo4sho/Swarm
 private void HandleWallAction(WallActionType wallactiontype, WallOrientationType wallorientationtype, IContainable currentind)
 {
     switch (wallactiontype)
     {
         case Walls.WallActionType.Bounce:
             if(wallorientationtype == WallOrientationType.Vertical)
             {
                 currentind.BounceXWall();
             }
             else
             {
                 currentind.BounceYWall();
             }
             break;
         case Walls.WallActionType.Portal:
             if(wallorientationtype == WallOrientationType.Vertical)
             {
                 currentind.TravelThroughXWall();
             }
             else
             {
                 currentind.TravelThroughYWall();
             }
             break;
     }
 }
コード例 #33
0
ファイル: Shuffler.cs プロジェクト: lulzzz/Innofactor.Crm.CI
        /// <summary>Import data in Data according to shuffle definition in Definition</summary>
        /// <param name="Definition">Shuffle Definition</param>
        /// <param name="Data">Exported data</param>
        /// <param name="ShuffleEventHandler">Event handler processing messages from the import. May be null.</param>
        /// <param name="container"></param>
        /// <param name="defpath">Path to definition file, if not standard</param>
        /// <param name="clearRemainingShuffleVars"></param>
        /// <returns>Tuple with counters for: Created, Updated, Skipped and Failed records and a collection of entityreferences for the created/updated records</returns>
        public static Tuple <int, int, int, int, int, EntityReferenceCollection> QuickImport(XmlDocument Definition, XmlDocument Data, EventHandler <ShuffleEventArgs> ShuffleEventHandler, IContainable container, string defpath, bool clearRemainingShuffleVars)
        {
            container.Logger.StartSection("QuickImport");
            Shuffler shuffle = new Shuffler(container);

            if (ShuffleEventHandler != null)
            {
                shuffle.RaiseShuffleEvent += ShuffleEventHandler;
            }
            ShuffleHelper.VerifyShuffleVars(Definition, clearRemainingShuffleVars);
            shuffle.Definition     = Definition;
            shuffle.definitionpath = defpath;
            ShuffleBlocks blocks = shuffle.Deserialize(Data);
            Tuple <int, int, int, int, int, EntityReferenceCollection> result = shuffle.ImportToCRM(blocks);

            container.Logger.EndSection();
            return(result);
        }
コード例 #34
0
 public void RemoveContained(IContainable containable)
 {
     this.ContainedEditors.Remove(containable);
 }
コード例 #35
0
 /// <summary>Adds an editor or sub-container definition to tihs container.</summary>
 /// <param name="subElement">The editor or sub-container to add.</param>
 public virtual void AddContained(IContainable subElement)
 {
     this.ContainedEditors.Add(subElement);
     this.ContainedEditors.Sort();
 }
コード例 #36
0
ファイル: Hex.cs プロジェクト: Rupini/Hexocracy
 public void OnContentLeft(IContainable content)
 {
     if (Content == content)
     {
         Content = EmptyContent.Get();
         //cType = Content.Type;
     }
 }
コード例 #37
0
 /// <summary>Checks whether the user is authorized to use a editable and has sufficient permissions.</summary>
 /// <param name="security">The security manager to query permissions on.</param>
 /// <param name="editorOrContainer">The editable containing security information.</param>
 /// <param name="user">The user to check permissions for.</param>
 /// <param name="item">The item to check permissions for.</param>
 /// <returns>True if the user is authorized for the given editable.</returns>
 public static bool IsAuthorized(this ISecurityManager security, IContainable editorOrContainer, IPrincipal user, ContentItem item)
 {
     return user != null && IsAuthorized(editorOrContainer, user, item) && IsPermitted(security, editorOrContainer, user, item);
 }
コード例 #38
0
ファイル: Hex.cs プロジェクト: Rupini/Hexocracy
 public void OnContentEntered(IContainable content)
 {
     Content = content;
     //cType = Content.Type;
 }
コード例 #39
0
ファイル: Container.cs プロジェクト: vennyoot/chicken-game
    private IContainable ItemAt(int index)
    {
        IContainable item = index < currentItems.Count ? currentItems[index] : null;

        return(item);
    }
コード例 #40
0
ファイル: ToolbarAreaAttribute.cs プロジェクト: Jobu/n2cms
 public int CompareTo(IContainable other)
 {
     throw new NotImplementedException();
 }
コード例 #41
0
 public abstract bool IsWithin(IContainable shape);
コード例 #42
0
ファイル: Shuffler.cs プロジェクト: lulzzz/Innofactor.Crm.CI
 /// <summary>General constructor for the Shuffler class</summary>
 /// <param name="container"></param>
 public Shuffler(IContainable container)
 {
     this.crmsvc = container.Service;
     this.log    = container.Logger;
 }