public ComplexStringAccreator(LibraryManager lm, IDynamicContainer d)
 {
     _d = d;
     _lm = lm;
     if (d.value.homogeneous)
     {
         if (d.value.any)
         {
             _innerAccreator = new ComplexAnyHomogeneousComplexResult(lm, d);
         }
         else
         {
             _innerAccreator = new ComplexAllHomogeneousComplexResult(lm, d);
         }
     }
     else
     {
         if (d.value.any)
         {
             _innerAccreator = new ComplexAnyHetrogeneousComplexResult(lm, d);
         }
         else
         {
             _innerAccreator = new ComplexAllHetrogeneousComplexResult(lm, d);
         }
     }
 }
 public void RollOnTable()
 {
     foreach(Models.Die<int> die in _dice.ToList())
     {
         DieFunctions.Roll<int>(die, _random);
     }
     int dieResult = _dice.Sum(e => e.Face);
     _result = (from DataItem d in _table.data.ToList() where d.endValue >= dieResult && d.startValue <= dieResult select d.value).First();
 }
Exemple #3
0
 void Subblock_OnExpanding(IDynamicContainer container, ContainerGlobals globals)
 {
     if (container.Globals != null)
     {
         if (!container.Globals.IsLoaded)
         {
             LoadBlock(container);
         }
     }
     ForceAutoCenter();
 }
 public IStringBuilderAccreator getAccreatorFromDynamic(IDynamicContainer d)
 {
     IStringBuilderAccreator result = null;
     switch (d.type)
     {
         case "String":
             result = new StringAccreator((string)d.value);
             break;
         case "ComplexDataType":
             result = new Complex.ComplexStringAccreator(this, d);
             break;
         default:
             throw new NotImplementedException();
     }
     return result;
 }
 public ComplexAllHomogeneousComplexResult(LibraryManager lm, IDynamicContainer d)
 {
     _lm = lm;
     _d = d;
 }
Exemple #6
0
        private void LoadBlock(IDynamicContainer container)
        {
            this.tagDefinition = container.Globals.TagDefinition;
            //int depth = (int)buildDepth.Pop();
            //buildDepth.Push(depth + 1);
            BlockContainerPanel panel = BuildStruct(container.Globals);

            panel.SuspendLayout();
            panel.DepthDifference = container.Globals.DepthDifference;
            container.FieldPanel  = panel;
            //container.Block.BlockChanged += new BlockChangedHandler(panel.DatabindChildrenToBlock);

            /*if (container.Block != null)
             * {
             * container.Block.BlockChanged += new BlockChangedHandler((panel as BlockContainerPanel).DatabindChildrenToBlock);
             * if (container.Block.SelectedBlockIndex > -1)
             *  (panel as BlockContainerPanel).DatabindChildrenToBlock(container.Block.BlockCollection.GetBlock(container.Block.SelectedBlockIndex));
             * else
             * {
             *  if ((container.Parent != null) && (container.Parent.Block != null) && (container.Parent.Block.SelectedBlockIndex != null))
             *    ((tabArguments[tabControl.SelectedTabIndex].Container as IDynamicContainer).FieldPanel).DatabindChildrenToBlock(container.Parent.Block.BlockCollection.GetBlock(container.Parent.Block.SelectedBlockIndex));
             *  else
             *    ((tabArguments[tabControl.SelectedTabIndex].Container as Control).Controls[0] as BlockContainerPanel).DatabindChildrenToBlock(tabArguments[tabControl.SelectedTabIndex].TagData, container);
             * }
             * }
             * else
             * {
             * //((tabArguments[tabControl.SelectedTabIndex].Container as Control).Controls[0] as BlockContainerPanel).DatabindChildrenToBlock(tabArguments[tabControl.SelectedTabIndex].TagData);
             * if ((container.Parent != null) && (container.Parent.Block != null) && (container.Parent.Block.SelectedBlockIndex != null))
             *  ((tabArguments[tabControl.SelectedTabIndex].Container as IDynamicContainer).FieldPanel).DatabindChildrenToBlock(container.Parent.Block.BlockCollection.GetBlock(container.Parent.Block.SelectedBlockIndex));
             * else
             *  ((tabArguments[tabControl.SelectedTabIndex].Container as Control).Controls[0] as BlockContainerPanel).DatabindChildrenToBlock(tabArguments[tabControl.SelectedTabIndex].TagData, container);
             * }*/
            // Sets the active block to being the block's selection and performs databinding
            IBlockControl block = panel.GetParentBlock();

            if ((block != null) && (block.BlockCollection != null))
            {
                block.BlockChanged += new BlockChangedHandler(panel.DatabindChildrenToBlock);
                IBlock tempBlock = null;
                if (block.BlockCollection.BlockCount > 0)
                {
                    if (block.SelectedBlockIndex > 0)
                    {
                        tempBlock = block.BlockCollection.GetBlock(block.SelectedBlockIndex);
                    }
                    else
                    {
                        block.SelectedBlockIndex = 0;
                        tempBlock = block.BlockCollection.GetBlock(0);
                    }
                }


                // if this is a region, we don't want the databinding to disable the controls.
                // Basically, it will always databind if it's not null, or if it is a block, rather than a region/section/whatever.
                if ((tempBlock != null) || (container is BlockContainer))
                {
                    panel.DatabindChildrenToBlock(tempBlock);
                }
            }
            else
            {
                panel.DatabindChildrenToBlock(tabArguments[tabControl.SelectedTabIndex].TagData, panel);
            }

            // Databind the block.
            if (panel != null)
            {
                panel.Visible = true;
                if (panel is BlockContainerPanel)
                {
                    ConnectBlocks(panel as BlockContainerPanel);
                }
            }
            container.Globals.IsLoaded = true;
            panel.ResumeLayout();
        }