public void GetValues_WhenStringOnSingleSubItem_ReturnsValue()
        {
            var subItem = new SubItem { Value = "The value" };
            var item = new Item { SingleSubItem = subItem };
            var valueProp = StructurePropertyTestFactory.GetPropertyByPath<Item>("SingleSubItem.Value");
            var indexAccessor = IndexAccessorTestFactory.CreateFor(valueProp);
            
            var value = indexAccessor.GetValues(item);

            Assert.AreEqual(new object[] { "The value" }, value);
        }
Exemple #2
0
        /// <summary>
        /// add sub
        /// </summary>
        /// <param name="config"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static int AddSubItem(ref Config config, string url)
        {
            //already exists
            if (config.subItem.FindIndex(e => e.url == url) >= 0)
            {
                return(0);
            }

            SubItem subItem = new SubItem
            {
                id      = string.Empty,
                remarks = "import sub",
                url     = url
            };

            config.subItem.Add(subItem);

            return(SaveSubItem(ref config));
        }
Exemple #3
0
        /// <summary>
        /// add sub
        /// </summary>
        /// <param name="config"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static int AddSubItem(ref Config config, string url)
        {
            //already exists
            foreach (var sub in config.subItem)
            {
                if (url == sub.url)
                {
                    return(0);
                }
            }

            var subItem = new SubItem();

            subItem.id      = string.Empty;
            subItem.remarks = "import sub";
            subItem.url     = url;
            config.subItem.Add(subItem);

            return(SaveSubItem(ref config));
        }
Exemple #4
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void BindingSub()
        {
            for (int k = config.subItem.Count; k < 3; k++)
            {
                var subItem = new SubItem();
                subItem.id          =
                    subItem.remarks =
                        subItem.url = string.Empty;

                config.subItem.Add(subItem);
            }

            txtRemarks.Text = config.subItem[0].remarks.ToString();
            txtUrl.Text     = config.subItem[0].url.ToString();

            txtRemarks2.Text = config.subItem[1].remarks.ToString();
            txtUrl2.Text     = config.subItem[1].url.ToString();

            txtRemarks3.Text = config.subItem[2].remarks.ToString();
            txtUrl3.Text     = config.subItem[2].url.ToString();
        }
        private byte[] GenerateSubItemBytes(SubItem subItem)
        {
            // Some iterations return byte arrays directly, and some create
            // string content.
            switch (subItem)
            {
            case SubItem.Resx:
                return(this.GenerateResx());

            default:
                string content = this.GenerateSubItemContent(subItem);

                List <byte> bytes = new List <byte>();
                bytes.AddRange(Encoding.UTF8.GetPreamble());
                bytes.AddRange(Encoding.UTF8.GetBytes(content));

                return(bytes.ToArray());
            }

            throw new Exception("Internal error! Unexpected code location!");
        }
Exemple #6
0
        public Cart GetCart()
        {
            Cart c = new Cart();

            foreach (Control cartItem in flp_cart.Controls)
            {
                if (cartItem.AccessibleDescription == "item")
                {
                    // So this is a main Item, create it
                    OrderItem oI = new OrderItem(); // Creation will add ID
                    oI.ID          = Convert.ToInt32(cartItem.TabIndex);
                    oI.Qty         = Convert.ToInt16(cartItem.Controls[0].Text);
                    oI.Description = cartItem.Controls[1].Text;
                    oI.ItemPrice   = Convert.ToDecimal(cartItem.Controls[2].Text.Substring(1));

                    #region Adding Sub-items to the OrderItem
                    // Check if sub-items exist
                    // But first check in the 'if' statement that there even IS any control that follows the previous one, to prevent index exception
                    if (flp_cart.Controls.Count > (flp_cart.Controls.IndexOf(cartItem) + 1) && flp_cart.Controls[flp_cart.Controls.IndexOf(cartItem) + 1].Margin.Left == 20)
                    {
                        Control subBoxContainer = flp_cart.Controls[flp_cart.Controls.IndexOf(cartItem) + 1]; // sub-items main container

                        foreach (Control subBox in subBoxContainer.Controls)
                        {
                            SubItem sI = new SubItem();
                            sI.DiscountOrModifier = subBox.Controls[0].Text == "t" ? true : false; // the icon
                            sI.Description        = subBox.Controls[1].Text;                       // the description
                            sI.Price = Convert.ToDecimal(subBox.Controls[2].Text.Substring(2));    // the price, substring 2 because of currency and +/- symbols
                            oI.SubItems.Add(sI);
                        }
                    }
                    #endregion

                    c.Items.Add(oI);
                }
            }

            //When all the items and order items have been added, all that's left is the order ID attachment
            return(c);
        }
Exemple #7
0
        /// <summary>
        /// add sub
        /// </summary>
        /// <param name="config"></param>
        /// <param name="url"></param>
        /// <returns></returns>
        public static int AddSubItem(ref Config config, string url)
        {
            //already exists
            foreach (SubItem sub in config.subItem)
            {
                if (url == sub.url)
                {
                    return(0);
                }
            }

            SubItem subItem = new SubItem
            {
                id      = string.Empty,
                remarks = "import sub",
                url     = url
            };

            config.subItem.Add(subItem);

            return(SaveSubItem(ref config));
        }
Exemple #8
0
        public MaterialListView AddEmbeddedButtons(EventHandler handler, string columnName = "chAction_Default")
        {
            ColumnHeader header;

            if (!this.Columns.ContainsKey(columnName))
            {
                // Add Column header.
                header           = new ColumnHeader();
                header.Name      = columnName;
                header.Text      = "操作";
                header.Width     = 105;
                header.TextAlign = HorizontalAlignment.Center;
                this.Columns.Add(header);
            }
            else
            {
                header = this.Columns[columnName];
            }

            for (int i = 0; i < this.Items.Count; i++)
            {
                MaterialFlatButton button = new MaterialFlatButton();
                button.CustomFont = new Font("微软雅黑", 9f);
                button.Text       = "点击删除";
                button.Primary    = true;
                button.Click     += handler;

                SubItem subItem = new SubItem()
                {
                    Column = header.Index, Row = i
                };
                _embeddedControls[subItem] = button;

                this.Controls.Add(button);
            }

            return(this);
        }
Exemple #9
0
        /// <summary>
        /// Returns the ListViewItem.SubItems number for a specified piece of information
        /// </summary>
        /// <param name="SubItem"></param>
        /// <returns>-1 if the SubItem doesn't exist</returns>
        private int GetSubItemNumber(SubItem SubItem)
        {
            switch (SubItem)
            {
            case SubItem.SkippedBy:
                if (Datestamped)
                {
                    return(2);
                }
                else
                {
                    return(1);
                }

            case SubItem.SkippedReason:
                if (Datestamped)
                {
                    return(3);
                }
                else
                {
                    return(2);
                }

            case SubItem.TimeStamp:
                if (Datestamped)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }

            default:
                throw new ArgumentOutOfRangeException("SubItem");
            }
        }
Exemple #10
0
        private void addSubCacheReferences(ICacheableContent cacheableContent)
        {
            List <UnityEngine.Object> list = cacheableContent.InternalReferences();

            if (list == null)
            {
                return;
            }
            foreach (UnityEngine.Object item in list)
            {
                if (!(item == null))
                {
                    int instanceID = item.GetInstanceID();
                    if (!subCache.ContainsKey(instanceID))
                    {
                        SubItem subItem = new SubItem();
                        subItem.Value = item;
                        subCache.Add(instanceID, subItem);
                    }
                    subCache[instanceID].RefCount++;
                }
            }
        }
        public SubItem Add(SubItem model)
        {
            var connectionString = this.GetConnection();

            using (var con = new SqlConnection(connectionString))
            {
                try
                {
                    con.Open();
                    var query = @"INSERT INTO SubItem(  CodPedidoItem
                                                        ,CodPizza
                                                        ,Nome
                                                        ,Preco
                                                        ,Observacao
                                                        
                                                        ) 
                                VALUES(                  @CodPedidoItem
                                                        ,@CodPizza
                                                        ,@Nome
                                                        ,@Preco
                                                        ,@Observacao
                                                        
                                                       ); SELECT CAST(SCOPE_IDENTITY() as INT);";
                    model.CodSubItem = con.QuerySingle <int>(query, model);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    con.Close();
                }

                return(model);
            }
        }
    public int FindShortestSubArray(int[] nums)
    {
        var dict = new Dictionary <int, SubItem>();
        int max  = 0;

        for (int i = 0; i < nums.Length; i++)
        {
            SubItem t;
            if (!dict.TryGetValue(nums[i], out t))
            {
                t       = new SubItem();
                t.Item1 = 0;
                t.Item2 = i;
                t.Item3 = i;
            }
            t.Item1++;
            t.Item3       = i;
            dict[nums[i]] = t;
            if (t.Item1 > max)
            {
                max = t.Item1;
            }
        }

        var selected = dict.Values.Where(t => t.Item1 == max);
        int min      = int.MaxValue;

        foreach (var t in selected)
        {
            var len = t.Item3 - t.Item2 + 1;
            if (len < min)
            {
                min = len;
            }
        }
        return(min);
    }
Exemple #13
0
        private SubItemDeItem GetSubItemDeItem(Item item, TipoItem tipoItem, string nombre, string nombreUnidad, double precio)
        {
            SubItemsController contSubItem = new SubItemsController();
            SubItem            subItem     = contSubItem.SubItemByNombre(db, nombre);

            if (subItem == null)
            {
                UnidadsController contUnidad = new UnidadsController();
                Unidad            unidad     = contUnidad.UnidadByNombre(db, nombreUnidad);

                if (unidad == null)
                {
                    unidad = new Unidad {
                        ID = 0, Descripcion = "", Nombre = nombreUnidad
                    };
                    unidad = contUnidad.Insertar(db, unidad);
                }

                subItem = new SubItem {
                    ID = 0, Nombre = nombre, PrecioUnitario = precio, TipoItem = tipoItem, Unidad = unidad
                };
            }
            //else --> actualizar precio unitario del subitem (solo sirve de referencia)

            SubItemDeItemsController contSubItemDeItem = new SubItemDeItemsController();
            SubItemDeItem            subItemDeItem     = contSubItemDeItem.SubItemDeItemByItemSubItem(db, item, subItem);

            if (subItemDeItem == null)
            {
                subItemDeItem = new SubItemDeItem {
                    ID = 0, Item = item, SubItem = subItem
                };
                subItemDeItem = contSubItemDeItem.Insertar(db, subItemDeItem);
            }

            return(subItemDeItem);
        }
Exemple #14
0
    public void SaveData()
    {
        List <SubItem> _subItem = new List <SubItem>();

        for (int i = 0; i < haveEquipItem.Count; i++)
        {
            SubItem _sub = new SubItem(haveEquipItem[i].id, haveEquipItem[i].count);
            _subItem.Add(_sub);
        }

        for (int i = 0; i < haveLootItem.Count; i++)
        {
            SubItem _sub = new SubItem(haveLootItem[i].id, haveLootItem[i].count);
            _subItem.Add(_sub);
        }

        int[] _equip = new int[4];
        for (int i = 0; i < 4; i++)
        {
            _equip[i] = myEquipment[i + 1];
        }

        JsonData.Instance.Save(myCurrency, new int[] { hpLv, stmLv }, _equip, myAbility, _subItem);
    }
        public NewItemPage()
        {
            InitializeComponent();

            Item = new Item
            {
                Text        = "Item name",
                Description = "This is an item description."
            };
            var subitem = new SubItem()
            {
                Description = "mediocampista", Name = "Enzo Perez"
            };
            var subitem2 = new SubItem()
            {
                Description = "mediocampista", Name = "Leo Ponzio"
            };

            Subitems.Add(subitem);
            Subitems.Add(subitem2);
            repository = new ItemsRepository();

            BindingContext = this;
        }
        private void ShouldReturnSixTopicsSubItemsForSideBar()
        {
            var firstSubItem   = new SubItem(TextHelper.AnyString, "first-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var secondSubItem  = new SubItem(TextHelper.AnyString, "second-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var thirdSubItem   = new SubItem(TextHelper.AnyString, "third-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var fourthSubItem  = new SubItem(TextHelper.AnyString, "fourth-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var fifthSubItem   = new SubItem(TextHelper.AnyString, "fifth-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var sixthSubItem   = new SubItem(TextHelper.AnyString, "sixth-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var seventhSubItem = new SubItem(TextHelper.AnyString, "seventh-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());
            var eightSubItem   = new SubItem(TextHelper.AnyString, "eigth-subitem", TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <SubItem>());

            var subItems = new List <SubItem> {
                firstSubItem, secondSubItem, thirdSubItem, fourthSubItem
            };
            var secondaryItems = new List <SubItem> {
                fifthSubItem, sixthSubItem, seventhSubItem, eightSubItem
            };

            var topic = new Topic(TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString,
                                  subItems, secondaryItems, new List <SubItem>(), new List <Crumb>(), new List <Alert>(), false, TextHelper.AnyString, null, "expandingLinkText", new List <ExpandingLinkBox>(), string.Empty, string.Empty, true);
            var article = new ProcessedArticle(TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <ProcessedSection>(), TextHelper.AnyString, TextHelper.AnyString, TextHelper.AnyString, new List <Crumb>(), new List <Alert>(), topic, new List <Alert>(), null, new DateTime(), new bool());

            var articleViewModel = new ArticleViewModel(article);

            bool showMoreButton;
            var  sidebarSubItems = articleViewModel.SidebarSubItems(out showMoreButton);

            sidebarSubItems.Count().Should().Be(6);
            sidebarSubItems.ToList()[0].Should().Be(firstSubItem);
            sidebarSubItems.ToList()[1].Should().Be(secondSubItem);
            sidebarSubItems.ToList()[2].Should().Be(thirdSubItem);
            sidebarSubItems.ToList()[3].Should().Be(fourthSubItem);
            sidebarSubItems.ToList()[4].Should().Be(fifthSubItem);
            sidebarSubItems.ToList()[5].Should().Be(sixthSubItem);
            showMoreButton.Should().Be(true);
        }
        /// <summary>
        /// Returns the Text from a ListViewItem.SubItems object
        /// </summary>
        private string GetSubItemText(SubItem subItem)
        {
            switch (subItem)
            {
                case SubItem.SkippedBy:
                case SubItem.SkippedReason:
                    return HaveSkipInfo ? base.SubItems[GetSubItemNumber(subItem)].Text : "";

                case SubItem.TimeStamp:
                    return Datestamped ? base.SubItems[1].Text : "";

                default:
                    return base.SubItems[GetSubItemNumber(subItem)].Text;
            }
        }
        public static KeyValuePair <ItemModel, ItemModelViewModel> ExistingDestinationComplex()
        {
            var itmId     = Guid.NewGuid();
            var name      = "Item model";
            var itemModel = new ItemModel
            {
                Id       = itmId,
                Name     = string.Format("{0} - CHANGED!", name),
                SubItems = new List <SubItem>()
            };
            var itemModelVm = new ItemModelViewModel
            {
                Id       = itmId,
                Name     = name,
                SubItems = new SubItemViewModel[10]
            };

            for (var i = 0; i < 10; i++)
            {
                var subItemId  = Guid.NewGuid();
                var subItmName = string.Format("Sub item - {0}", i);
                var subItem    = new SubItem
                {
                    Id    = subItemId,
                    Name  = string.Format("{0} - CHANGED!", subItmName),
                    Units = new Unit[4]
                };

                var subItemVm = new SubItemViewModel
                {
                    Id    = subItemId,
                    Name  = subItmName,
                    Units = new Collection <UnitViewModel>()
                };

                itemModel.SubItems.Add(subItem);
                itemModelVm.SubItems[i] = subItemVm;

                for (var j = 0; j < 5; j++)
                {
                    var unitId   = Guid.NewGuid();
                    var unitName = string.Format("Unit - {0}", j);

                    var unit = new Unit
                    {
                        Id       = unitId,
                        Name     = string.Format("{0}, - CHANGED!", unitName),
                        SubUnits = new Collection <SubUnit>()
                    };
                    if (j < 4)
                    {
                        subItem.Units[j] = unit;
                    }

                    var unitVm = new UnitViewModel();

                    unitVm.Id       = unitId;
                    unitVm.Name     = unitName;
                    unitVm.SubUnits = new List <SubUnitViewModel>();
                    subItemVm.Units.Add(unitVm);


                    for (var k = 0; k < 6; k++)
                    {
                        var subUnitId   = Guid.NewGuid();
                        var subUnitName = string.Format("Sub unit - {0}", subUnitId);

                        var subUnit = new SubUnit
                        {
                            Id   = subUnitId,
                            Name = String.Format("{0}, - CHANGED!", subUnitName)
                        };
                        unit.SubUnits.Add(subUnit);
                        if (k < 3)
                        {
                            var subUnitVm = new SubUnitViewModel
                            {
                                Id   = subUnitId,
                                Name = subUnitName,
                            };
                            unitVm.SubUnits.Add(subUnitVm);
                        }
                    }
                }
            }

            return(new KeyValuePair <ItemModel, ItemModelViewModel>(itemModel, itemModelVm));
        }
Exemple #19
0
 public void SelectFirstSubItem() {
     for (int i = 0; i < _subItems.Count; ++i) {
         if (_subItems[i].SelectableObject != null) {
             SelectedSubItem = _subItems[i];
             break;
         }
     }
 }
Exemple #20
0
    void ItemUpdate(object mod, object data, int index)
    {
        SubItem item = mod as SubItem;

        item.Text.text = data as string;
    }
Exemple #21
0
        public void TestSubItemValues(int val1, int val2)
        {
            var item = new SubItem(new IntegerItem(val1), new IntegerItem(val2));

            Assert.AreEqual(val1 - val2, item.Value);
        }
Exemple #22
0
        /// <summary>
        /// Draws the node to the graph.
        /// </summary>
        /// <param name="graphics">The graphics object we render to.</param>
        /// <param name="nvd">The view data of this node for drawing.</param>
        /// <param name="isCurrent">Determines if the node is currently hovered over.</param>
        /// <param name="isSelected">Determines if the node is selected.</param>
        /// <param name="isDragged">Determines if the node is currently being dragged.</param>
        /// <param name="graphMousePos">The mouse position in the untransformed graph.</param>
        public void Draw(Graphics graphics, NodeViewData nvd, PointF graphMousePos,
            bool isCurrent, bool isSelected, bool isDragged,
            bool isHighlighted,
            bool isUpdated,
            HighlightBreakPoint highlightBreakPoint,
            Dictionary<string, FrameStatePool.NodeProfileInfos.ProfileInfo> profileInfos)
        {
            #if DEBUG
            //ensure consistency
            DebugCheckIntegrity();
            #endif
            RectangleF boundingBox = nvd.BoundingBox;

            // assemble the correct style
            Style style = _defaultStyle;

            Behavior b = this.Node.Behavior as Behavior;

            if (b != null && b.PlanningProcess != null) {
            FrameStatePool.PlanningState nodeState = b.PlanningProcess.GetNode(this.FullId);

            if (nodeState != null) {
                if (nodeState._bOk) {
                    style += _planSucceededStyle;

                } else {
                    style += _planFailedStyle;
                }
            }
            }

            if (isDragged)
            { style += _draggedStyle; }

            else if (isSelected)
            { style += _selectedStyle; }

            else if (isCurrent)
            { style += _currentStyle; }

            else if (isHighlighted)
            { style += _highlightedStyle; }

            else if (isUpdated)
            { style += _updatedStyle; }

            if (style.Background != null)
            { DrawShapeBackground(graphics, boundingBox, style.Background); }

            // if the node is dragged, do not render the events
            if (!isDragged) {
            // if this node is not selected, deselect the event
            if (!isSelected && _selectedSubItem != null) {
                _selectedSubItem.IsSelected = false;
                _selectedSubItem = null;
            }

            if (_subItems.Count > 0) {
                Region prevreg = graphics.Clip;

                // draw non parallel subitems first
                for (int i = 0; i < _subItems.Count; ++i) {
                    if (!_subItems[i].ShowParallelToLabel) {
                        // get the bounding box of the event
                        RectangleF newclip = GetSubItemBoundingBox(boundingBox, i);
                        graphics.Clip = new Region(newclip);

                        _subItems[i].Draw(graphics, nvd, newclip);
                    }
                }

                // draw parallel subitems second
                for (int i = 0; i < _subItems.Count; ++i) {
                    if (_subItems[i].ShowParallelToLabel) {
                        // get the bounding box of the event
                        RectangleF newclip = GetSubItemBoundingBox(boundingBox, i);
                        graphics.Clip = new Region(newclip);

                        _subItems[i].Draw(graphics, nvd, newclip);
                    }
                }

                // restore rendering area
                graphics.Clip = prevreg;
            }

            // draw the label of the node
            if (style.Label != null) {
                // calculate the height of all non-parallel subitems so we can correctly center the label
                float subItemsHeight = 0.0f;
                foreach(SubItem sub in _subItems) {
                    if (!sub.ShowParallelToLabel)
                    { subItemsHeight += sub.Height; }
                }

                float x = boundingBox.Left + (boundingBox.Width - _subItemParallelWidth) * 0.5f - _realLabelSize.Width * 0.5f;
                float y = boundingBox.Top + boundingBox.Height * 0.5f - subItemsHeight * 0.5f - _realLabelSize.Height * 0.5f;
                y += getTopAttachmentsHeight();
                graphics.DrawString(this.DisplayLabel, _font, style.Label, x, y);

                //graphics.DrawRectangle(Pens.Red, boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height);
                //graphics.DrawRectangle(Pens.Red, x, y, _realLabelSize.Width, _realLabelSize.Height);
                //graphics.DrawRectangle(Pens.Green, x, y, _labelSize.Width, _labelSize.Height);
            }
            }

            // draw the prefab border
            if (!string.IsNullOrEmpty(nvd.Node.PrefabName)) {
            _prefabStyle.Border.DashStyle = nvd.Node.IsPrefabDataDirty() ? System.Drawing.Drawing2D.DashStyle.Dash : System.Drawing.Drawing2D.DashStyle.Solid;
            DrawShapeBorder(graphics, boundingBox, _prefabStyle.Border);
            _prefabStyle.Border.DashStyle = System.Drawing.Drawing2D.DashStyle.Solid;
            }

            // draw the nodes border
            if (style.Border != null) {
            if (isHighlighted && (isCurrent || isSelected)) {
                //highlight border
                DrawShapeBorder(graphics, boundingBox, _highlightedStyle.Border);

                //shrink it to draw the selected/current border
                RectangleF rect = boundingBox;
                rect.Inflate(-_highlightedStyle.Border.Width, -_highlightedStyle.Border.Width);

                DrawShapeBorder(graphics, rect, style.Border);

            } else {
                DrawShapeBorder(graphics, boundingBox, style.Border);
            }
            }

            // draw the profile info
            if (profileInfos != null && profileInfos.Count > 0) {
            string fullId = nvd.FullId;

            if (profileInfos.ContainsKey(fullId)) {
                FrameStatePool.NodeProfileInfos.ProfileInfo profileInfo = profileInfos[fullId];
                string timeStr = string.Format("{0:F3}", Math.Abs(profileInfo.Time));
                string avgTimeStr = (profileInfo.Count <= 0) ? "0" : string.Format("{0:F3}", profileInfo.TotalTime / profileInfo.Count);
                string info = string.Format("{0}  {1}  {2}", timeStr, avgTimeStr, profileInfo.Count);
                SizeF txtSize = MeasureDisplayStringWidth(graphics, info, _profileFont);
                float x = boundingBox.Left;
                float y = boundingBox.Top - txtSize.Height - 2;
                graphics.DrawString(info, (profileInfo.Time >= 0) ? _profileBoldFont : _profileFont, Brushes.Black, x, y);
            }
            }

            // draw the attached condition
            foreach(Node.Connector connector in nvd.Connectors) {
            if (!connector.IsAsChild) {
                PointF[] vertices = getConnectorTriangle(nvd, connector);

                Brush brush = isCurrent && nvd.IsInExpandConnectorRange(graphMousePos) ? Brushes.Yellow : Brushes.Blue;

                graphics.FillPolygon(Brushes.LightGray, vertices);

                if (this.IsExpanded && connector.ChildCount > 0) {
                    graphics.FillRectangle(brush, vertices[0].X + 0.5f, vertices[0].Y + 3.5f, 5.5f, 1.5f);

                    if (!connector.IsExpanded)
                    { graphics.FillRectangle(brush, vertices[0].X + 2.5f, vertices[0].Y + 1.5f, 1.5f, 5.5f); }
                }
            }
            }

            // draw the breakpoints
            bool isBreakpointHighlighted = false;
            const float width = 18.0f;
            BreakPointStates enterState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kEnter);

            if (HighlightBreakPoint.ShowBreakPoint && (enterState == BreakPointStates.Normal || enterState == BreakPointStates.Disable) ||
            enterState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (enterState == BreakPointStates.Highlight);

            float x = boundingBox.X + width * 0.1f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(enterState), x, y, width, width);
            }

            BreakPointStates exitState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kExit);

            if (HighlightBreakPoint.ShowBreakPoint && (exitState == BreakPointStates.Normal || exitState == BreakPointStates.Disable) ||
            exitState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (exitState == BreakPointStates.Highlight);

            float x = boundingBox.X + (boundingBox.Width - width) - width * 0.1f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(exitState), x, y, width, width);
            }

            BreakPointStates planState = getBreakPointState(highlightBreakPoint, HighlightBreakPoint.kPlanning);

            if (HighlightBreakPoint.ShowBreakPoint && (planState == BreakPointStates.Normal || planState == BreakPointStates.Disable) ||
            planState == BreakPointStates.Highlight) {
            isBreakpointHighlighted |= (planState == BreakPointStates.Highlight);

            float x = boundingBox.X + (boundingBox.Width * 0.5f) - width * 0.5f;
            float y = boundingBox.Y + (boundingBox.Height - width) * 0.5f;

            graphics.FillEllipse(getBrush(planState), x, y, width, width);
            }

            // draw the expand or collapse symbol
            if (nvd.CanBeExpanded()) {
            Brush brush = isCurrent && nvd.IsInExpandRange(graphMousePos) ? Brushes.Yellow : Brushes.LightGray;

            graphics.FillRectangle(brush, boundingBox.X + 5.0f, boundingBox.Y + 5.0f, 12.0f, 2.0f);

            if (!nvd.IsExpanded)
            { graphics.FillRectangle(brush, boundingBox.X + 10.0f, boundingBox.Y, 2.0f, 12.0f); }
            }

            // draw node id
            if (ShowNodeId) {
            graphics.DrawString(nvd.FullId, _profileFont, isBreakpointHighlighted ? Brushes.Yellow : Brushes.White, boundingBox.X, boundingBox.Y + boundingBox.Height);
            }

            //graphics.DrawRectangle(Pens.Red, nvd.LayoutRectangle.X, nvd.LayoutRectangle.Y, nvd.LayoutRectangle.Width, nvd.LayoutRectangle.Height);
        }
Exemple #23
0
        public RangeType CheckFSMArrowRange(PointF graphMousePos, out SubItem subItem, out RectangleF bbox)
        {
            bbox = this.GetSubItemBoundingBox(graphMousePos);
            subItem = this.GetSubItem(this, graphMousePos);

            if (subItem != null && subItem.IsFSM && subItem.CanBeDraggedToTarget) {
            const float offset = 8.0f;

            if (graphMousePos.X <= bbox.Left + offset)
            { return RangeType.kFSMLeftArrow; }

            else if (graphMousePos.X >= bbox.Right - offset)
            { return RangeType.kFSMRightArrow; }
            }

            return RangeType.kNode;
        }
Exemple #24
0
        public int GetSubItemIndex(SubItem item)
        {
            if (item != null) {
            for (int i = 0; i < _subItems.Count; ++i) {
                if (_subItems[i] == item)
                { return i; }
            }
            }

            return -1;
        }
Exemple #25
0
 public void Add(SubItem subItem)
 {
     _context.SubItems.Add(subItem);
 }
 protected override byte[] GenerateContent(SubItem subItem)
 {
     return(this.GenerateSubItemBytes(subItem));
 }
 protected override string GetFileName(SubItem subItem)
 {
     return(Path.ChangeExtension(this.InputFilePath, this.GetGeneratedExtension(subItem)));
 }
Exemple #28
0
 public SubItemDeItem SubItemDeItemByItemSubItem(Entities context, Item item, SubItem subItem)
 {
     return(context.SubItemDeItem.SingleOrDefault(m => m.Item.ID == item.ID && m.SubItem.ID == subItem.ID));
 }
Exemple #29
0
		/// <summary>
		/// Draws the node to the graph.
		/// </summary>
		/// <param name="graphics">The graphics object we render to.</param>
		/// <param name="nvd">The view data of this node for drawing.</param>
		/// <param name="isCurrent">Determines if the node is currently hovered over.</param>
		/// <param name="isSelected">Determines if the node is selected.</param>
		/// <param name="isDragged">Determines if the node is currently being dragged.</param>
		/// <param name="graphMousePos">The mouse position in the untransformed graph.</param>
		public virtual void Draw(Graphics graphics, NodeViewData nvd, bool isCurrent, bool isSelected, bool isDragged, PointF graphMousePos)
		{
#if DEBUG
			//ensure consistency
			DebugCheckIntegrity();
#endif

			RectangleF boundingBox= nvd.BoundingBox;

			// assemble the correct style
			Style style= _defaultStyle;

			if(isDragged)
				style+= _draggedStyle;
			else if(isCurrent)
				style+= _currentStyle;
			else if(isSelected)
				style+= _selectedStyle;

			if(style.Background !=null)
				DrawShapeBackground(graphics, boundingBox, style.Background);

			// if the node is dragged, do not render the events
			if(!isDragged)
			{
				// if this node is not selected, deselect the event
				if(!isSelected && _selectedSubItem !=null)
				{
					_selectedSubItem.IsSelected= false;
					_selectedSubItem= null;
				}

				if(_subItems.Count >0)
				{
					Region prevreg= graphics.Clip;

					// draw non parallel subitems first
					for(int i= 0; i <_subItems.Count; ++i)
					{
						if(!_subItems[i].ShowParallelToLabel)
						{
							// get the bounding box of the event
							RectangleF newclip= GetSubItemBoundingBox(boundingBox, i);
							graphics.Clip= new Region(newclip);

							_subItems[i].Draw(graphics, nvd, newclip);
						}
					}

					// draw parallel subitems second
					for(int i= 0; i <_subItems.Count; ++i)
					{
						if(_subItems[i].ShowParallelToLabel)
						{
							// get the bounding box of the event
							RectangleF newclip= GetSubItemBoundingBox(boundingBox, i);
							graphics.Clip= new Region(newclip);

							_subItems[i].Draw(graphics, nvd, newclip);
						}
					}

					// restore rendering area
					graphics.Clip= prevreg;
				}

				// draw the label of the node
				if(style.Label !=null)
				{
					// calculate the height of all non-parallel subitems so we can correctly center the label
					float subItemsHeight= 0.0f;
					foreach(SubItem sub in _subItems)
					{
						if(!sub.ShowParallelToLabel)
							subItemsHeight+= sub.Height;
					}

					float x= boundingBox.Left + (boundingBox.Width - _subItemParallelWidth) *0.5f - _realLabelSize.Width *0.5f;
					float y= boundingBox.Top + boundingBox.Height *0.5f - subItemsHeight *0.5f - _realLabelSize.Height *0.5f;
					graphics.DrawString(_label, _font, style.Label, x, y);

					//graphics.DrawRectangle(Pens.Red, boundingBox.X, boundingBox.Y, boundingBox.Width, boundingBox.Height);
					//graphics.DrawRectangle(Pens.Red, x, y, _realLabelSize.Width, _realLabelSize.Height);
					//graphics.DrawRectangle(Pens.Green, x, y, _labelSize.Width, _labelSize.Height);
				}
			}

			// draw the nodes border
			if(style.Border !=null)
				DrawShapeBorder(graphics, boundingBox, style.Border);

			//graphics.DrawRectangle(Pens.Red, nvd.LayoutRectangle.X, nvd.LayoutRectangle.Y, nvd.LayoutRectangle.Width, nvd.LayoutRectangle.Height);
		}
Exemple #30
0
 // Добавить информацию о вышележащих элементах
 internal void AddHighLevelInfo(DecreePartReferent dp)
 {
     if (dp.Addagree != null && Addagree == null)
     {
         Addagree = dp.Addagree;
     }
     else if (dp.Addagree != Addagree)
     {
         return;
     }
     if (dp.Appendix != null && Appendix == null)
     {
         Appendix = dp.Appendix;
     }
     else if (Appendix != dp.Appendix)
     {
         return;
     }
     if (dp.DocPart != null && DocPart == null)
     {
         DocPart = dp.DocPart;
     }
     else if (DocPart != dp.DocPart)
     {
         return;
     }
     if (dp.Section != null && Section == null && this._hasLessLevelAttr(ATTR_SECTION))
     {
         Section = dp.Section;
     }
     else if (Section != dp.Section)
     {
         return;
     }
     if (dp.SubSection != null && SubSection == null && this._hasLessLevelAttr(ATTR_SUBSECTION))
     {
         SubSection = dp.SubSection;
     }
     else if (SubSection != dp.SubSection)
     {
         return;
     }
     if (dp.Chapter != null && Chapter == null && this._hasLessLevelAttr(ATTR_CHAPTER))
     {
         Chapter = dp.Chapter;
     }
     else if (dp.Chapter != Chapter)
     {
         return;
     }
     if (dp.Paragraph != null && Paragraph == null && this._hasLessLevelAttr(ATTR_PARAGRAPH))
     {
         Paragraph = dp.Paragraph;
     }
     else if (Paragraph != dp.Paragraph)
     {
         return;
     }
     if (dp.SubParagraph != null && SubParagraph == null && this._hasLessLevelAttr(ATTR_SUBPARAGRAPH))
     {
         SubParagraph = dp.SubParagraph;
     }
     else if (SubParagraph != dp.SubParagraph)
     {
         return;
     }
     if (dp.Clause != null && Clause == null && this._hasLessLevelAttr(ATTR_CLAUSE))
     {
         Clause = dp.Clause;
     }
     else if (dp.Clause != Clause)
     {
         return;
     }
     if (dp.Part != null && Part == null && this._hasLessLevelAttr(ATTR_PART))
     {
         Part = dp.Part;
     }
     else if (dp.Part != Part)
     {
         return;
     }
     if (dp.Item != null && Item == null && this._hasLessLevelAttr(ATTR_ITEM))
     {
         if (SubItem != null && SubItem.IndexOf('.') > 0)
         {
         }
         else
         {
             Item = dp.Item;
         }
     }
     else if (dp.Item != Item)
     {
         return;
     }
     if (dp.SubItem != null && SubItem == null && this._hasLessLevelAttr(ATTR_SUBITEM))
     {
         SubItem = dp.SubItem;
     }
     else if (dp.SubItem != SubItem)
     {
         return;
     }
     if (dp.Indention != null && Indention == null && this._hasLessLevelAttr(ATTR_INDENTION))
     {
         Indention = dp.Indention;
     }
 }
        public void ShouldCreateATopicFromAContentfulTopic()
        {
            //Arrange
            var crumb = new Crumb("title", "slug", "type");

            _crumbFactory.Setup(_ => _.ToModel(_contentfulTopic.Breadcrumbs.First())).Returns(crumb);

            var subItem = new SubItem("slug1", "title", "teaser", "icon", "type", DateTime.MinValue, DateTime.MaxValue, "image", new List <SubItem>());

            _subItemFactory.Setup(_ => _.ToModel(_contentfulTopic.SubItems.First())).Returns(subItem);

            var secondaryItem = new SubItem("slug2", "title", "teaser", "icon", "type", DateTime.MinValue, DateTime.MaxValue, "image", new List <SubItem>());

            _subItemFactory.Setup(_ => _.ToModel(_contentfulTopic.SecondaryItems.First())).Returns(secondaryItem);

            var tertiaryItem = new SubItem("slug3", "title", "teaser", "icon", "type", DateTime.MinValue, DateTime.MaxValue, "image", new List <SubItem>());

            _subItemFactory.Setup(_ => _.ToModel(_contentfulTopic.TertiaryItems.First())).Returns(tertiaryItem);

            var eventBanner = new EventBanner("Title", "Teaser", "Icon", "Link");

            _eventBannerFactory.Setup(_ => _.ToModel(_contentfulTopic.EventBanner)).Returns(eventBanner);

            var alert = new Alert("title", "subheading", "body", "test", new DateTime(2017, 01, 01), new DateTime(2017, 04, 10), string.Empty, false);

            _alertFactory.Setup(_ => _.ToModel(_contentfulTopic.Alerts.First())).Returns(alert);

            var expandingLinkBox = new ExpandingLinkBox("title", new List <SubItem>());

            _expandingLinkBoxFactory.Setup(_ => _.ToModel(It.IsAny <ContentfulExpandingLinkBox>()))
            .Returns(expandingLinkBox);

            //Act
            var result = _topicContentfulFactory.ToModel(_contentfulTopic);

            //Assert
            result.SubItems.Count().Should().Be(1);
            result.SubItems.First().Should().BeEquivalentTo(subItem);
            result.SecondaryItems.Count().Should().Be(1);
            result.SecondaryItems.First().Should().BeEquivalentTo(secondaryItem);
            result.TertiaryItems.Count().Should().Be(1);
            result.TertiaryItems.First().Should().BeEquivalentTo(tertiaryItem);
            result.EventBanner.Should().BeEquivalentTo(eventBanner);
            result.Alerts.Count().Should().Be(1);
            result.Alerts.First().Should().BeEquivalentTo(alert);
            result.BackgroundImage.Should().BeEquivalentTo("background-image-url.jpg");
            result.Breadcrumbs.Count().Should().Be(1);
            result.Breadcrumbs.First().Should().BeEquivalentTo(crumb);
            result.EmailAlerts.Should().Be(false);
            result.EmailAlertsTopicId.Should().BeEquivalentTo("id");
            result.ExpandingLinkBoxes.Count().Should().Be(1);
            result.ExpandingLinkBoxes.First().Should().BeEquivalentTo(expandingLinkBox);
            result.ExpandingLinkTitle.Should().BeEquivalentTo("expandingLinkTitle");
            result.Icon.Should().BeEquivalentTo("icon");
            result.Image.Should().BeEquivalentTo("background-image-url.jpg");
            result.Slug.Should().BeEquivalentTo("slug");
            result.Name.Should().BeEquivalentTo("name");
            result.Summary.Should().BeEquivalentTo("summary");
            result.SunriseDate.Should().Be(DateTime.MinValue);
            result.SunsetDate.Should().Be(DateTime.MaxValue);
            result.Teaser.Should().BeEquivalentTo("teaser");
            result.MetaDescription.Should().BeEquivalentTo("metaDescription");
            result.DisplayContactUs.Should().Be(false);
        }
Exemple #32
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseUp(MouseEventArgs e)
        {
            try
            {
                // Hide the controls
                this.textBox.Visible = this.combo.Visible = false;

                // If no mouse down happened in this listview,
                // no need to show anything
                if (!mouseDown)
                {
                    return;
                }

                // The listview should be having the following properties enabled
                // 1. FullRowSelect = true
                // 2. View should be Detail;
                if (!this.FullRowSelect || this.View != View.Details)
                {
                    return;
                }

                // Reset the mouse down flag
                mouseDown = false;

                // Get the subitem rect at the mouse point.
                // Remember that the current row index and column index will also be
                // Modified within the same method
                Rectangle rect = this.GetSubItemRect(new Point(e.X, e.Y));

                // If the above method is executed with any error,
                // The row index and column index will be -1;
                if (this.row != -1 && this.col != -1)
                {
                    // Check whether combobox or text box is set for the current cell
                    SubItem cell = GetKey(new SubItem(this.row, this.col));

                    if (cell != null)
                    {
                        // Set the size of the control(combobox/editbox)
                        // This should be composed of the height of the current items and
                        // width of the current column
                        Size sz = new Size(this.Columns[col].Width, Items[row].Bounds.Height);

                        // Determine the location where the control(combobox/editbox) to be placed
                        Point location = col == 0 ? new Point(0, rect.Top) : new Point(rect.Left, rect.Top);

                        ValidateAndAddSubItems();

                        // Decide which control to be displayed.
                        if (this.customCells[cell] == null)
                        {
                            this.ShowTextBox(location, sz);
                        }
                        else
                        {
                            this.ShowComboBox(location, sz, (StringCollection)this.customCells[cell]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("EXCEPTION !!" + ex.ToString());
                Trace.WriteLine(ex.ToString());
            }
        }
Exemple #33
0
        // Todo : こちらの文字描画に切り替えたいのだが...
        private void _TextSprite_Separation(string text, Font efont, Emugen.Image.Primitive.Vector2D position, Emugen.OpenTK.View.IView view = null, int fadeTimer = -1, int fadeTimerAdd = 100)
        {
            //this.position = position;
            //this.fadeTimer = fadeTimer;
            //this.fadeTimerAdd = fadeTimerAdd;
            this.lineTextMargin = efont.lineTextMargin;

            var frameSize    = 0.0;
            var frameSizeMax = 0.0;
            var rfontFrames  = new List <Font.FontFrame>();

            foreach (var frame in efont.fontFrames)
            {
                frameSizeMax += frame.size / 2;
                rfontFrames.Insert(0, frame);
            }
            frameSize = frameSizeMax;

            // Todo : フォントフレームの幅分だけマージンの対応が必要
            margin = (int)System.Math.Floor(frameSize);
            var saveMargin = 2;

            // Todo : Test用
            //lineTextMargin = 50;

            var k   = 0;
            var tmp = "";

            var subItems = new List <SubItem>();

            foreach (var t in text)
            {
                tmp += t;
                var subItem = new SubItem();
                var a       = Emugen.Image.Drawing.DrawText.Rect(t.ToString(), efont, new System.Drawing.PointF(0, 0));
                var b       = Emugen.Image.Drawing.DrawText.Rect(tmp, efont, new System.Drawing.PointF(0, 0));
                var x2      = b.Position.X + b.Size.X;
                var y2      = b.Position.Y + b.Size.Y;
                subItem.Rect       = new Rect(new Vector2D(x2 - a.Size.X, a.Position.Y), new Vector2D(a.Size.X, a.Size.Y));
                subItem.SingleRect = new Rect(a);
                subItems.Add(subItem);
            }

            k   = 0;
            tmp = "";
            var tmpX = 0;

            foreach (var t in text)
            {
                var subItem = subItems[k];
                tmp += t;
                var rectB = Emugen.Image.Drawing.DrawText.Rect(t.ToString(), efont, new System.Drawing.PointF(0, 0));

                var item = new Item();
                item.text = t.ToString();
                //item.bmp = new System.Drawing.Bitmap((int)(rectB.Position.X+rectB.Size.X + margin * 2), (int)(rectB.Position.Y+rectB.Size.Y + margin * 2));
                item.bmp = new System.Drawing.Bitmap((int)(subItem.Rect.Size.X + margin * 2 + saveMargin), (int)(subItem.Rect.Size.Y + margin * 2 + saveMargin));
                //item.bmp = new System.Drawing.Bitmap((int)(rectB.Position.X + rectB.Size.X), (int)(rectB.Position.Y + rectB.Size.Y));


                if (k == 0)
                {
                    var rectA = Emugen.Image.Drawing.DrawText.Rect(tmp, efont, new System.Drawing.PointF(0, 0));
                    //item.defaultRect = new Rect(new Vector2D(0, 0), new Vector2D(128, 128));
                    //item.defaultRect = new Rect(new Vector2D(rectA.Position.X, rectA.Position.Y), new Vector2D(rectA.Size.X, rectA.Size.Y));
                    item.defaultRect = new Rect(new Vector2D(subItem.Rect.Position.X, subItem.Rect.Position.Y), new Vector2D(item.bmp.Width, item.bmp.Height));
                }
                else
                {
                    var rectA = Emugen.Image.Drawing.DrawText.Rect(tmp, efont, new System.Drawing.PointF(0, 0));
                    item.defaultRect = new Rect(new Vector2D(subItem.Rect.Position.X, subItem.Rect.Position.Y), new Vector2D(item.bmp.Width, item.bmp.Height));
                    //item.defaultRect = new Rect(new Vector2D( margin + rectA.Position.X + rectA.Size.X - rectB.Size.X, margin), new Vector2D(item.bmp.Width, item.bmp.Height));
                    //item.defaultRect = new Rect(new Vector2D( margin, margin), new Vector2D(item.bmp.Width, item.bmp.Height));
                    //item.defaultRect = new Rect(new Vector2D(rectA.Position.X + rectA.Size.X - rectA.Size.X, 10), new Vector2D(128, 128));
                    //item.defaultRect = new Rect(new Vector2D(bB.X + bB.Width - bA.Width, bA.Y), new Vector2D(System.Math.Ceiling(bA.Width), System.Math.Ceiling(bA.Height)));
                    //item.defaultRect = new Rect(new Vector2D(rectB.Position.X + rectB.Size.X - rectA.Size.X, rectA.Position.Y), new Vector2D(rectA.Size.X, rectA.Size.Y));
                }
                //item.singleRect = new Rect(new Vector2D(0, 0), new Vector2D(128, 128));
                using (var g = System.Drawing.Graphics.FromImage(item.bmp))
                {
                    if (false)
                    {
                        g.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 255, 0, 0)), 0, 0, 1000, 1000);
                    }

                    Emugen.Image.Drawing.DrawText.Do(item.text, efont, g, new System.Drawing.PointF((float)(margin - subItem.SingleRect.Position.X), (float)(margin - subItem.SingleRect.Position.Y)));


                    if (false)
                    {
                        g.DrawRectangle(new System.Drawing.Pen(System.Drawing.Color.FromArgb(255, 255, 255, 255)),
                                        (float)rectB.Position.X, (float)rectB.Position.Y, (float)(rectB.Position.X + rectB.Size.X), (float)(rectB.Position.Y + rectB.Size.Y));
                    }
                    //Emugen.Image.Drawing.DrawText.Do(item.text, efont, g, new System.Drawing.PointF((float)-rectB.Size.X+margin, (float)-rectB.Size.Y + margin));
                    //Emugen.Image.Drawing.DrawText.Do(item.text, efont, g, new System.Drawing.PointF((float)-rectB.Position.X, (float)-rectB.Position.Y));
                    //Emugen.Image.Drawing.DrawText.Do(item.text, efont, g, new System.Drawing.PointF((float)-rectB.Position.X, (float)-rectB.Position.Y));
                }
                var texture = new Texture(item.bmp);
                var w       = item.bmp.Width;
                var h       = item.bmp.Height;
                //var x = item.defaultRect.Position.X + position.X - margin + lineTextMargin * i;
                //var y = item.defaultRect.Position.Y + position.Y - margin;
                var x = item.defaultRect.Position.X + position.X - margin + lineTextMargin * k;
                var y = item.defaultRect.Position.Y + position.Y - margin;

                item.imageSprite = new ImageSprite(texture, new Rect(new Vector2D(x, y), new Vector2D(w, h)), new Color(1, 1, 1, 1));

                items.Add(item);
                layer.Add(item.imageSprite, 10);
                k++;
                //tmpX += item.bmp.Width - efont.lineTextMargin;
                tmpX += item.bmp.Width;
            }

            // Todo : あとで、文字送りするときだけするように変更する
            if (this.fadeTimer != -1)
            {
                foreach (var item in items)
                {
                    item.color.A = 0;
                }
            }
        }
        /// <summary>
        /// Returns the Text from a ListViewItem.SubItems object
        /// </summary>
        private string GetSubItemText(SubItem SubItem)
        {
            switch (SubItem)
            {
                case SubItem.SkippedBy:
                case SubItem.SkippedReason:
                    if (HaveSkipInfo)
                        return base.SubItems[GetSubItemNumber(SubItem)].Text;
                    else
                        return "";

                case SubItem.TimeStamp:
                    if (Datestamped)
                        return base.SubItems[1].Text;
                    else
                        return "";

                default:
                    return base.SubItems[GetSubItemNumber(SubItem)].Text;
            }
        }
        /// <summary>
        /// Returns the ListViewItem.SubItems number for a specified piece of information
        /// </summary>
        /// <param name="SubItem"></param>
        /// <returns>-1 if the SubItem doesn't exist</returns>
        private int GetSubItemNumber(SubItem SubItem)
        {
            switch (SubItem)
            {
                case SubItem.SkippedBy:
                    if (Datestamped)
                        return 2;
                    else
                        return 1;

                case SubItem.SkippedReason:
                    if (Datestamped)
                        return 3;
                    else
                        return 2;

                case SubItem.TimeStamp:
                    if (Datestamped)
                        return 1;
                    else
                        return -1;

                default:
                    throw new ArgumentOutOfRangeException("SubItem");
            }
        }
Exemple #36
0
 /// <summary>
 /// For this method, we will get a Subitem. 
 /// Then we will iterate thru each of the keys and will 
 /// check whther any key contains the given cells row/column.
 /// If it is not found we will check for -1 in any one
 /// </summary>
 /// <param name="cell"></param>
 /// <returns></returns>
 private SubItem GetKey( SubItem cell )
 {
     try
     {
         foreach( SubItem key in this.customCells.Keys )
         {
             // Case 1: Any particular cells is  enabled for a control(Textbox/combobox)
             if( key.row == cell.row && key.col == cell.col )
             {
                 return key;
             }
                 // Case 2: Any particular column is  enabled for a control(Textbox/combobox)
             else if( key.row == -1 && key.col == cell.col )
             {
                 return key;
             }
                 // Entire col for a row is is  enabled for a control(Textbox/combobox)
             else if( key.row == cell.row && key.col == -1 )
             {
                 return key;
             }
                 // All cells are enabled for a control(Textbox/combobox)
             else if( key.row == -1 && key.col == -1 )
             {
                 return key;
             }
         }
     }
     catch( Exception ex )
     {
         Trace.WriteLine( ex.ToString());
     }
     return null;
 }
 void ItemUpdate(SubItem item, string data, int index)
 {
     item.Text.text = data;
 }
 public override void ReadContentFrom(BinaryDataReader dataReader)
 {
     SubItem.ReadSubItems(dataReader, SubItems);
 }
Exemple #39
0
 private bool ValidateSubItem(SubItem subItem)
 {
     return(true);
 }
 public Item(string name, SubItem subItem)
 {
     _name    = name;
     _subItem = subItem;
 }
        /// <summary>
        /// Returns the ListViewItem.SubItems number for a specified piece of information
        /// </summary>
        /// <param name="subItem"></param>
        /// <returns>-1 if the SubItem doesn't exist</returns>
        private int GetSubItemNumber(SubItem subItem)
        {
            switch (subItem)
            {
                case SubItem.SkippedBy:
                    return Datestamped ? 2 : 1;

                case SubItem.SkippedReason:
                    return Datestamped ? 3 : 2;

                case SubItem.TimeStamp:
                    return (Datestamped) ? 1 : -1;

                default:
                    throw new ArgumentOutOfRangeException("subItem");
            }
        }
Exemple #42
0
		/// <summary>
		/// Attaches a subitem to this node.
		/// </summary>
		/// <param name="sub">The node subitem we want to attach.</param>
		public void AddSubItem(SubItem sub)
		{
			_subItems.Add(sub);

			SortSubItems();

			_labelChanged= true;
		}
        private void SetSubItemText(SubItem subItem, string value)
        {
            if ((subItem == SubItem.SkippedBy || subItem == SubItem.SkippedReason) &! (HaveSkipInfo))
            {
                base.SubItems.Add("SkippedBy");
                base.SubItems.Add("SkipReason");
                HaveSkipInfo = true;
            }

            base.SubItems[GetSubItemNumber(subItem)].Text = value;
        }
Exemple #44
0
		/// <summary>
		/// Attaches a subitem to this node.
		/// </summary>
		/// <param name="sub">The node subitem we want to attach.</param>
		/// <param name="index">The index where you want to insert the subitem.</param>
		public void AddSubItem(SubItem sub, int index)
		{
			_subItems.Insert(index, sub);

			SortSubItems();

			_labelChanged= true;
		}
Exemple #45
0
		/// <summary>
		/// Removes a subitem from the node.
		/// </summary>
		/// <param name="sub">The subitem which will be removed.</param>
		public void RemoveSubItem(SubItem sub)
		{
			int index= _subItems.IndexOf(sub);

			if(sub ==_selectedSubItem)
			{
				_selectedSubItem.IsSelected= false;
				_selectedSubItem= null;
			}

			if(index <0)
				throw new Exception(Resources.ExceptionSubItemIsNoChild);

			_subItems.RemoveAt(index);
		}
 public Item(string name, SubItem subItem)
 {
     _name = name;
     _subItem = subItem;
 }