예제 #1
0
 public PaletteDefinition(string name,
                          IBlockCollection paletteBlock, IBlockCollection instancesBlock)
 {
     Name = name;
     this.paletteBlock   = paletteBlock;
     this.instancesBlock = instancesBlock;
 }
예제 #2
0
 public IGistConfig<IndexValue, string> CreateGistConfig(IBlockCollection blocks)
 {
     return
         new GistConfig<IndexValue, string>
             {
                 Blocks = blocks,
                 Ext =
                     new OrderedGistExtension<IndexValue, string>(
                     new GistIndexValueType
                         {
                             StringComparer =
                                 Options.WhenStringThenIgnoreCase
                                     ? StringComparer.OrdinalIgnoreCase
                                     : StringComparer.Ordinal,
                             DateTimeComparer =
                                 Options.WhenDateThenIgnoreTimeOfDay
                                     ? (IComparer<DateTime>) new IgnoreTimeOfDayComparer()
                                     : Comparer<DateTime>.Default
                         }
                     , new GistStringType()),
                 UpdateStrategy =
                     Options.IsUnique
                         ? UpdateStrategy<IndexValue, string>.UniqueKey
                         : UpdateStrategy<IndexValue, string>.AppendKey
             };
 }
예제 #3
0
 public IGistConfig <IndexValue, string> CreateGistConfig(IBlockCollection blocks)
 {
     return
         (new GistConfig <IndexValue, string>
     {
         Blocks = blocks,
         Ext =
             new OrderedGistExtension <IndexValue, string>(
                 new GistIndexValueType
         {
             StringComparer =
                 Options.WhenStringThenIgnoreCase
                                     ? StringComparer.OrdinalIgnoreCase
                                     : StringComparer.Ordinal,
             DateTimeComparer =
                 Options.WhenDateThenIgnoreTimeOfDay
                                     ? (IComparer <DateTime>) new IgnoreTimeOfDayComparer()
                                     : Comparer <DateTime> .Default
         }
                 , new GistStringType()),
         UpdateStrategy =
             Options.IsUnique
                         ? UpdateStrategy <IndexValue, string> .UniqueKey
                         : UpdateStrategy <IndexValue, string> .AppendKey
     });
 }
예제 #4
0
 public void DataBindCollection(IBlockCollection blockCollection)
 {
     this.blockCollection = blockCollection;
     //blockCollection.CollectionChanged += new EventHandler(blockCollection_CollectionChanged);
     blockCollection.BlockAdded   += blockCollection_CollectionChanged;
     blockCollection.BlockRemoved += blockCollection_CollectionChanged;
     UpdateComboBox();
 }
예제 #5
0
파일: MasterTable.cs 프로젝트: Kevnz/KiwiDB
 public MasterTable(IBlockCollection blocks)
     : base(blocks.MasterBlockReference,
            new GistConfig <string, IJsonValue>
 {
     Blocks = blocks,
     Ext    =
         new OrderedGistExtension <string, IJsonValue>(
             new GistStringType(), new GistJsonType()),
     UpdateStrategy =
         UpdateStrategy <string, IJsonValue> .UpdateKey
 })
 {
 }
예제 #6
0
        public override string GetBlockStringForScriptingReferenceType(short blockIndex, short type)
        {
            IBlockCollection blocks = GetBlockCollectionForScriptingReferenceType(type);

            if (blocks != null)
            {
                return("\"" + blocks.GetBlock(blockIndex).BlockName + "\"");
            }
            else
            {
                return(blockIndex.ToString());
            }
        }
예제 #7
0
        public override string[] GetBlockStringsForScriptingReferenceType(short type)
        {
            IBlockCollection blocks = GetBlockCollectionForScriptingReferenceType(type);

            string[] blockStrings = new string[blocks.BlockCount];

            for (int i = 0; i < blocks.BlockCount; i++)
            {
                blockStrings[i] = blocks.GetBlock(i).BlockName;
            }

            return(blockStrings);
        }
예제 #8
0
 protected Gist <string, string> CreateGist(IBlockCollection blocks,
                                            IUpdateStrategy <string, string> updateStrategy)
 {
     return(new Gist <string, string>(
                blocks.MasterBlockReference,
                new GistConfig <string, string>
     {
         Blocks = blocks,
         Ext = new OrderedGistExtension <string, string>(
             new GistStringType(),
             new GistStringType()
             ),
         UpdateStrategy = updateStrategy
     }
                ));
 }
예제 #9
0
 public IndexCatalog(IBlockCollection blocks, IIndexValueFactory indexValueFactory, IMasterTable masterTable)
     : base(
         blocks.ApplicationBlockReference,
         new GistConfig <string, IJsonValue>
 {
     Blocks = blocks,
     Ext    =
         new OrderedGistExtension <string, IJsonValue>(
             new GistStringType(), new GistJsonType()),
     UpdateStrategy = UpdateStrategy <string, IJsonValue> .UpdateKey
 })
 {
     Blocks            = blocks;
     IndexValueFactory = indexValueFactory;
     MasterTable       = masterTable;
 }
예제 #10
0
 protected Gist<string, string> CreateGist(IBlockCollection blocks,
                                           IUpdateStrategy<string, string> updateStrategy)
 {
     return new Gist<string, string>(
         blocks.MasterBlockReference,
         new GistConfig<string, string>
             {
                 Blocks = blocks,
                 Ext = new OrderedGistExtension<string, string>(
                     new GistStringType(),
                     new GistStringType()
                     ),
                 UpdateStrategy = updateStrategy
             }
         );
 }
예제 #11
0
 protected virtual Gist <string, string> CreateGist(IBlockCollection blocks)
 {
     return(CreateGist(blocks, new UpdateKey <string, string>()));
 }
예제 #12
0
파일: SyncService.cs 프로젝트: wyk125/AElf
 public SyncService(IChainService chainService, ILogger logger)
 {
     _blockCollection = new BlockCollection(chainService, logger);
 }
예제 #13
0
 public void JustDecompileGenerated_set_UncommittedBlockList(IBlockCollection value)
 {
     this.JustDecompileGenerated_UncommittedBlockList_k__BackingField = value;
 }
예제 #14
0
        public void DatabindChildrenToBlock(IBlock block, IFieldControlContainer container)
        {
            #region Old Method

            /*linkedBlock = block;
             *
             * if (block != null)
             * {
             * int index = -1;
             * IFieldControl[] childFields = GetChildFields();
             * foreach (FieldControlBase field in childFields)
             * {
             *  index++;
             *  field.Enabled = true;
             *
             *  try
             *  {
             *    // If the field is not a block, we will need to databind it.
             *    if (!(field is IBlockControl))
             *    {
             *      IField binding = (LocateFieldByName(linkedBlock, field.BoundPropertyName) as IField);
             *      if (binding != null)
             *      {
             *        field.DataBind(binding);
             *        Binding[] bindings = field.GetDataBindings();
             *        foreach (Binding bind in bindings)
             *        {
             *          bind.Parse += bind_Parse;
             *        }
             *      }
             *    }
             *    // If it is a block, we need to recurse on the block so that its children get databound.
             *    else
             *    {
             *      IBlockCollection binding = LocateFieldByName(linkedBlock, field.BoundPropertyName) as IBlockCollection;
             *      if (binding != null)
             *      {
             *        (field as IBlockControl).DataBindCollection(binding);
             *        (field as IBlockControl).Initialize();
             *      }
             *      else
             *        field.Enabled = false;
             *    }
             *  }
             *  catch (Exception ex)
             *  {
             *    Interfaces.Output.Write(Interfaces.OutputTypes.Warning, "There was an error databinding to " + field.BoundPropertyName + ":" + ex.Message, ex);
             *    //MessageBox.Show("There was an error binding \"" + field.BoundPropertyName + ":\" " + ex.Message);
             *  }
             * }
             * }
             * else
             * {
             * foreach (FieldControlBase field in GetChildFields())
             *  field.Enabled = false;
             * }*/
            #endregion

            #region New Method
            if (container is FieldContainerBase)
            {
                container = (container as FieldContainerBase).FieldPanel;
            }
            if (container == null)
            {
                return;
            }
            //(container as Control).Enabled = (block != null);
            if (block == null)
            {
                IFieldControl[] children = container.GetChildFields();
                foreach (FieldControlBase field in children)
                {
                    field.Enabled = false;
                }
                return;
            }

            Control control = container as Control;
            // This is a bug-fix. At some point along the line, databinding was attached to an FieldContainerBase... so to fix it, we relink to the FieldPanel property.
            if (container is FieldContainerBase)
            {
                control = (container as FieldContainerBase).FieldPanel;
            }

            for (int x = 0; x < control.Controls.Count; x++)
            {
                Control curControl = control.Controls[x];
                curControl.Visible = true;

                // Determine whether or not the field is a FieldControlBase or not.
                FieldControlBase field = (curControl is FieldControlBase) ? curControl as FieldControlBase : null;

                #region the current control is a field
                if (field != null)
                {
                    field.Enabled = true;
                    #region If the field is not a block, we will need to databind it.
                    if (!(field is IBlockControl))
                    {
                        IField binding = (LocateFieldByName(block, field.BoundPropertyName) as IField);
                        if (binding != null)
                        {
                            field.DataBind(binding);
                            Binding[] bindings = field.GetDataBindings();
                            foreach (Binding bind in bindings)
                            {
                                bind.Parse += bind_Parse;
                            }
                        }
                        else
                        {
                            field.Enabled = false;
                        }
                    }
                    #endregion
                    else // This shouldn't happen, EVER!
                    {
                        Interfaces.Output.Write(Interfaces.OutputTypes.Information, "DatabindChildrenToBlock came across an IBlockControl.");
                    }
                }
                #endregion
                #region the current control is a block container.
                else if (curControl is Prometheus.Controls.BlockContainer)
                {
                    Prometheus.Controls.BlockContainer blockContainer = curControl as Prometheus.Controls.BlockContainer;
                    blockContainer.Enabled = true;
                    IBlock nextBlock = null;
                    BlockContainerPanel nextContainer = null;

                    #region get the next container
                    // We're getting all of the controls of type FieldContainerPanel, though there should only be one.

                    /*Control[] fieldContainerPanels = GetChildControlsByType(blockContainer, typeof(BlockContainerPanel));
                     * if (fieldContainerPanels.Length > 0)
                     * {
                     * nextContainer = fieldContainerPanels[0] as BlockContainerPanel;
                     * }
                     * else
                     * {
                     * // This is a warning because the rest of the tag will work properly and execution can continue as normal.
                     * Interfaces.Output.Write(Interfaces.OutputTypes.Warning, "During databinding, the block \"" + blockContainer.BoundPropertyName + "\" did not have a field container panel!");
                     * continue;
                     * }*/
                    if (blockContainer.FieldPanel != null)
                    {
                        nextContainer = blockContainer.FieldPanel;
                    }

                    #endregion

                    #region get the next block

                    /*Control[] blocks = GetChildControlsByType(blockContainer, typeof(IBlockControl));
                     * if (blocks.Length > 0)
                     * {
                     * IBlockControl blockControl = blocks[0] as IBlockControl;
                     * blockControl.Container = nextContainer as IFieldControlContainer;
                     * IBlockCollection binding = LocateFieldByName(block, (blockControl as IBoundPropertyCapable).BoundPropertyName) as IBlockCollection;
                     * if (binding != null)
                     * {
                     *  blockControl.DataBindCollection(binding);
                     *  blockControl.Initialize();
                     * }
                     * }
                     * else
                     * {
                     * Interfaces.Output.Write(Interfaces.OutputTypes.Warning, "During databinding, the block \"" + blockContainer.BoundPropertyName + "\" did not have an IBlockControl!");
                     * continue;
                     * }*/
                    if (blockContainer.Block != null)
                    {
                        IBlockControl blockControl = blockContainer.Block;
                        if (blockContainer.FieldPanel == null)
                        {
                            blockControl.Container = blockContainer;
                        }
                        else
                        {
                            blockControl.Container = blockContainer.FieldPanel;
                        }
                        IBlockCollection binding = LocateFieldByName(block, (blockControl as IBoundPropertyCapable).BoundPropertyName) as IBlockCollection;
                        if (binding != null)
                        {
                            blockControl.DataBindCollection(binding);
                            blockControl.Initialize();
                        }
                        if (blockControl.SelectedBlockIndex > -1)
                        {
                            nextBlock = blockControl.BlockCollection.GetBlock(blockControl.SelectedBlockIndex);
                        }
                    }
                    #endregion

                    if ((nextBlock != null) && (nextContainer != null))
                    {
                        DatabindChildrenToBlock(nextBlock, nextContainer);
                    }
                }
                else if (curControl is FieldContainerBase)
                {
                    FieldContainerBase fieldContainer = curControl as FieldContainerBase;
                    fieldContainer.Enabled = true;

                    DatabindChildrenToBlock(block, fieldContainer.FieldPanel);
                }
                #endregion
            }
            #endregion
        }
예제 #15
0
 public Session(IBlockCollection blocks, IIndexValueFactory indexValueFactory)
 {
     IndexValueFactory = indexValueFactory;
     _blocks           = blocks;
 }
예제 #16
0
 public BlockReference(IBlockCollection blocks, Func <int> getter, Action <int> setter)
 {
     Getter = getter;
     Setter = setter;
     Blocks = blocks;
 }
예제 #17
0
 protected virtual Gist<string, string> CreateGist(IBlockCollection blocks)
 {
     return CreateGist(blocks, new UpdateKey<string, string>());
 }