Add() 공개 메소드

public Add ( Item, item ) : void
item Item,
리턴 void
 public ItemCollection GetValues()
 {
     ItemCollection sizes = new ItemCollection();
     sizes.Add(Smile.INNERBRACE,"Inner");
     sizes.Add(Smile.OUTERBRACE, "Outer");
     return sizes;
 }
예제 #2
0
        public void AddItemOfSameType()
        {
            var collection = new ItemCollection();
            collection.Add(Item());
            collection.Add(Item(quantity:2));

            Assert.That(collection.ItemCount, Is.EqualTo(3));
        }
예제 #3
0
        public void AddItem()
        {
            var collection = new ItemCollection();
            collection.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));

            Assert.That(collection.Count, Is.EqualTo(1));
        }
		public override void Initialize (OptionsDialog dialog, object dataObject)
		{
			base.Initialize (dialog, dataObject);

			config = (SolutionRunConfigInfo)dataObject;

			store = new ListStore (selectedField, projectNameField, projectField, runConfigField, projectRunConfigsField);
			listView = new ListView (store);

			var col1 = new ListViewColumn (GettextCatalog.GetString ("Solution Item"));
			var cb = new CheckBoxCellView (selectedField);
			cb.Toggled += SelectionChanged;
			cb.Editable = true;
			col1.Views.Add (cb);
			col1.Views.Add (new TextCellView (projectNameField));
			listView.Columns.Add (col1);

			var configSelView = new ComboBoxCellView (runConfigField);
			configSelView.Editable = true;
			configSelView.ItemsField = projectRunConfigsField;
			var col2 = new ListViewColumn (GettextCatalog.GetString ("Run Configuration"), configSelView);
			listView.Columns.Add (col2);

			foreach (var it in config.Solution.GetAllSolutionItems ().Where (si => si.SupportsExecute ()).OrderBy (si => si.Name)) {
				var row = store.AddRow ();
				var si = config.EditedConfig.Items.FirstOrDefault (i => i.SolutionItem == it);
				var sc = si?.RunConfiguration?.Name ?? it.GetDefaultRunConfiguration ()?.Name;
				var configs = new ItemCollection ();
				foreach (var pc in it.GetRunConfigurations ())
					configs.Add (pc.Name);
				store.SetValues (row, selectedField, si != null, projectNameField, it.Name, projectField, it, runConfigField, sc, projectRunConfigsField, configs);
			}
		}
예제 #5
0
        public ListViewCombos()
        {
            ListView list = new ListView ();
            var indexField = new DataField<int> ();

            var indexField2 = new DataField<int> ();
            var itemsField = new DataField<ItemCollection> ();

            ListStore store = new ListStore (indexField, indexField2, itemsField);
            list.DataSource = store;
            list.GridLinesVisible = GridLines.Horizontal;

            var comboCellView = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField };
            comboCellView.Items.Add (1, "one");
            comboCellView.Items.Add (2, "two");
            comboCellView.Items.Add (3, "three");

            list.Columns.Add (new ListViewColumn ("List 1", comboCellView));

            var comboCellView2 = new ComboBoxCellView { Editable = true, SelectedIndexField = indexField2, ItemsField = itemsField };
            list.Columns.Add (new ListViewColumn ("List 2", comboCellView2));

            int p = 0;
            for (int n = 0; n < 10; n++) {
                var r = store.AddRow ();
                store.SetValue (r, indexField, n % 3);
                var col = new ItemCollection ();
                for (int i = 0; i < 3; i++) {
                    col.Add (p, "p" + p);
                    p++;
                }
                store.SetValues (r, indexField2, n % 3, itemsField, col);
            }
            PackStart (list, true);
        }
 public ItemCollection GetValues()
 {
     ItemCollection sizes = new ItemCollection();
     for(var i = 1; i < 33; i++){
     sizes.Add(""+i);
     }
     return sizes;
 }
예제 #7
0
		public ItemCollection GetValues()
		{
			var items = new ItemCollection();

			foreach (var s in Enumerator.GetNames<ProxyTypes>())
				items.Add(s);

			return items;
		}
예제 #8
0
        public void AddItemGetOwner()
        {
            var collection = new ItemCollection(_owner);
            collection.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));

            Assert.That(collection.Count, Is.EqualTo(1));

            var item = collection.First();
            Assert.That(item.Owner, Is.EqualTo(_owner));
        }
예제 #9
0
        public void AddSubItemGetOwner()
        {
            var collection = new ItemCollection(_owner);
            var hangar = new ItemCollection(collection);

            hangar.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));

            var item = hangar.First();
            Assert.That(item.Owner, Is.EqualTo(_owner));
        }
예제 #10
0
        public void AddSubItemWithLocation()
        {
            var collection = new ItemCollection(_owner);
            var hangar = new ItemCollection(collection, location:_manufactory);

            hangar.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));

            var item = hangar.First();
            Assert.That(item.Location, Is.EqualTo(_manufactory));
        }
예제 #11
0
        public ItemCollection GetValues()
        {
            ItemCollection listscenes = new ItemCollection();
            List <Scene>   list       = BridgesManager.Instance.SelectedBridge.GetListObjects <Scene>();

            foreach (Scene s in list)
            {
                listscenes.Add(s.Id);
            }
            return(listscenes);
        }
예제 #12
0
        public ItemCollection GetValues()
        {
            var items = new ItemCollection();

            foreach (var sqlDefinedType in DbTypeToCsType.SqlDefinedTypes)
            {
                items.Add(sqlDefinedType.Value, string.Format("{0} - ({1})", sqlDefinedType.Key, sqlDefinedType.Value.Name));
            }

            return(items);
        }
예제 #13
0
		public ItemCollection GetValues()
		{
			var items = new ItemCollection();

			foreach (var s in Enum.GetNames(typeof (ProxyTypes)))
			{
				items.Add(s);
			}

			return items;
		}
예제 #14
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string tag = tagTextBox.Text;

            if (tag == "")
            {
                MessageBox.Show("Введите тег");
                return;
            }
            temp.Add(new TagClass(tag));
        }
예제 #15
0
 public AddTagWindow(ProjectBase myBase)
 {
     InitializeComponent();
     _base = myBase;
     temp  = new ItemCollection <TagClass>();
     foreach (TagClass tag in myBase.tags)
     {
         temp.Add(tag);
     }
     tagsPanel.ItemsSource = temp;
 }
예제 #16
0
        public void AddTest()
        {
            var newGame = new Game("TestGame");

            using (var temp = TempDirectory.Create())
                using (var col = new ItemCollection <Game>(Path.Combine(temp.TempPath, "db"), null))
                {
                    col.Add(newGame);
                    Assert.AreEqual(1, col.Count);
                }
        }
예제 #17
0
		public ItemCollection GetValues()
		{
			var items = new ItemCollection();

			foreach (SqlDbType sqlType in Enum.GetValues(typeof(SqlDbType)))
			{
				items.Add(sqlType.ToString());
			}

			return items;
		}
예제 #18
0
            /// <summary>
            /// Removes any nested groups under this item and replaces
            /// them with their child items.
            /// </summary>
            public void FlattenChildItems()
            {
                ItemCollection flattenedChildItems = new ItemCollection();

                foreach (Item childItem in this.ChildItems)
                {
                    if (0 == childItem.ChildItems.Count)
                    {
                        flattenedChildItems.Add(childItem);
                    }
                    else
                    {
                        childItem.FlattenChildItems();
                        flattenedChildItems.Add(childItem.ChildItems);
                    }
                }

                this.ChildItems.Clear();
                this.ChildItems.Add(flattenedChildItems);
            }
예제 #19
0
        public ItemCollection GetValues()
        {
            var items = new ItemCollection();

            foreach (var s in Enum.GetNames(typeof(ProxyTypes)))
            {
                items.Add(s);
            }

            return(items);
        }
예제 #20
0
        public ItemCollection GetValues()
        {
            var sizes = new ItemCollection();

            foreach (var profession in ProfessionInfo.GetAll())
            {
                sizes.Add(profession, profession.Name);
            }

            return(sizes);
        }
예제 #21
0
        public ItemCollection GetValues()
        {
            var sizes = new ItemCollection();

            foreach (var direction in Direction.Cardinal)
            {
                sizes.Add(direction, direction.GetAlias(0));
            }

            return(sizes);
        }
예제 #22
0
        public static ItemCollection <T> ToItemCollection <T>(this IEnumerable <T> source) where T : IEquatable <T>
        {
            ItemCollection <T> collection = new ItemCollection <T>();

            T[] array = source.ToArray();
            for (int i = 0; i < array.Count(); i++)
            {
                collection.Add(array[i]);
            }
            return(collection);
        }
        private RadTreeViewItem AddRelationshipNode(ItemCollection collection, RelationshipDTO relationship)
        {
            var node = GetNode();

            node.DataContext = relationship;
            node.Header      = GetNodeHeader(relationship.Entity2, DatabaseObjectCategory.Relationship);
            node.ToolTip     = relationship.ID + "_" + (string.IsNullOrEmpty(relationship.Alias) ? relationship.Name : relationship.Alias);
            collection.Add(node);
            _AllItems.Add(node);
            return(node);
        }
예제 #24
0
        public void RemoveFromLocalRemoveFromParent()
        {
            var global = new ItemCollection();
            var local = new ItemCollection(global);

            local.Add(Item());
            local.Remove(Item());

            Assert.That(local, Is.Empty);
            Assert.That(global, Is.Empty);
        }
예제 #25
0
    static void Main()
    {
        ItemCollection collection = new ItemCollection();
        Item           item       = new Item();

        item.ID   = 1;
        item.Name = "John";
        collection.Add(item);
        List <Item>    list             = collection.FindAll(x => x.ID == 1 && x.Name == "John");
        ItemCollection resultCollection = new ItemCollection(list);
    }
예제 #26
0
        public ItemCollection GetValues()
        {
            var sizes = new ItemCollection();

            foreach (var phase in Moonphase.All)
            {
                sizes.Add(phase, phase.Name);
            }

            return(sizes);
        }
예제 #27
0
        private void Move(ItemCollection source, ItemCollection target)
        {
            var items = source.Cast <object>().ToList();

            source.Clear();

            foreach (var item in items)
            {
                target.Add(item);
            }
        }
예제 #28
0
 /// <summary>
 /// Adds or inserts an item in an itemcollection.
 /// </summary>
 /// <param name="itemCollection"></param>
 /// <param name="item"></param>
 /// <param name="index"></param>
 private static void AddOrInsert(ItemCollection itemCollection, TreeViewItem item, int?index = null)
 {
     if (index == null)
     {
         itemCollection.Add(item);
     }
     else
     {
         itemCollection.Insert(index.Value, item);
     }
 }
        public ItemCollection GetValues()
        {
            if (s_Items == null)
            {
                List <FontFamily> fonts = SystemFonts;
                s_Items = new ItemCollection();
                fonts.ForEach(x => s_Items.Add(x));
            }

            return(s_Items);
        }
예제 #30
0
 /// <summary>
 /// 将指定集合的元素添加到 ItemCollection 的末尾。
 /// </summary>
 public static void AddRange <T>(this ItemCollection obj, IEnumerable <T> newitem)
 {
     if (newitem == null)
     {
         return;
     }
     foreach (var item in newitem)
     {
         obj.Add(item);
     }
 }
예제 #31
0
        void RefreshCategories()
        {
            ItemCollection items = this.comboBoxCategory.Items;

            items.Clear();

            foreach (Category c in this.categories.GetCategories())
            {
                items.Add(new IntelliComboBoxItem(GetListLabel(c), c.Name, c));
            }

            foreach (Account a in this.money.Accounts.GetAccounts())
            {
                if (!a.IsClosed && !a.IsDeleted)
                {
                    string s = "Transfer to/from: " + a.Name;
                    items.Add(new IntelliComboBoxItem(s, s, a));
                }
            }
        }
        private static void AddSeparator([NotNull] ItemCollection items, ref bool isSeparator)
        {
            Debug.ArgumentNotNull(items, nameof(items));

            if (!isSeparator)
            {
                items.Add(new Separator());
            }

            isSeparator = true;
        }
예제 #33
0
        private void AddTreeItem(ItemCollection items, ChildRelationshipInfo child)
        {
            RadTreeViewItem node = new RadTreeViewItem();

            node.Header = child.Relationship.Alias;
            items.Add(node);
            foreach (var data in child.RelatedData)
            {
                AddTreeItem(node.Items, data);
            }
        }
예제 #34
0
        public override void Load(Call call, TabModel model)
        {
            var items = new ItemCollection <ListItem>();

            string extension = System.IO.Path.GetExtension(Tab.Path);

            if (extension == ".json")
            {
                items.Add(new ListItem("Contents", LazyJsonNode.LoadPath(Tab.Path)));
                //items.Add(new ListItem("Contents", JsonValue.Parse(File.ReadAllText(path))));
            }
            else
            {
                bool isText = TextExtensions.Contains(extension);
                if (!isText)
                {
                    try
                    {
                        // doesn't work
                        using StreamReader streamReader = File.OpenText(Tab.Path);

                        var buffer = new char[100];
                        streamReader.Read(buffer, 0, buffer.Length);
                        isText = true;
                    }
                    catch (Exception)
                    {
                    }
                }

                if (isText)
                {
                    items.Add(new ListItem("Contents", new FilePath(Tab.Path)));
                }
                else
                {
                    items.Add(new ListItem("Contents", null));
                }
            }
            model.Items = items;
        }
예제 #35
0
        /// <summary>
        /// Adds the elements from the specified collection - <paramref name="items"/> to the end of the target <paramref name="list"/>.
        /// </summary>
        /// <param name="list">The list that will be extended.</param>
        /// <param name="items">The items that will be added.</param>
        /// <exception cref="ArgumentNullException"><paramref name="items"/> is null</exception>
        public static void AddRange(this ItemCollection list, IEnumerable items)
        {
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            foreach (object item in items)
            {
                list.Add(item);
            }
        }
예제 #36
0
        public override void Load(Call call, TabModel model)
        {
            var items = new ItemCollection <ListItem>();

            listItemTasks = new ListItem("Tasks", Tab.Tasks);

            items.Add(listItemTasks);
            //list.Add(listItemActive);
            //list.Add(listItemFinished);

            model.Items = items;

            var actions = new ItemCollection <TaskCreator>();

            listItemStart = new TaskDelegate("Start", Start);
            listItemStop  = new TaskDelegate("Stop", Stop);
            actions.Add(listItemStart);
            actions.Add(listItemStop);

            model.Actions = actions;
        }
        private TreeViewItem GetTreeViewItem([NotNull] ItemCollection items, [NotNull] Tuple <string, string> value)
        {
            Debug.ArgumentNotNull(items, nameof(items));
            Debug.ArgumentNotNull(value, nameof(value));

            var index = -1;

            for (var i = 0; i < items.Count; i++)
            {
                var treeViewItem = items[i] as TreeViewItem;
                if (treeViewItem == null)
                {
                    continue;
                }

                var v = treeViewItem.Tag as string ?? string.Empty;

                var compare = string.Compare(v, value.Item1, StringComparison.InvariantCultureIgnoreCase);
                if (compare == 0)
                {
                    var header = (SearchHeader)treeViewItem.Header;
                    header.ItemCount++;
                    return(treeViewItem);
                }

                if (compare > 0)
                {
                    index = i;
                    break;
                }
            }

            var item = new TreeViewItem
            {
                Header = new SearchHeader
                {
                    Text      = value.Item2,
                    ItemCount = 1
                },
                Tag = value.Item1
            };

            if (index < 0)
            {
                items.Add(item);
            }
            else
            {
                items.Insert(index, item);
            }

            return(item);
        }
예제 #38
0
 // this is an odd usage.. not returning task being problem #1 and using the delegate in a non-async maner being problem #2
 private async void ExecuteFetchAsync1()
 {
     ItemCollection.Clear();
     var countries = await this.GetListOfCountries().ConfigureAwait(false);
     foreach (var country in countries)
     {
         lock (_syncLock)
         {
             ItemCollection.Add(country);
         }
     }
 }
예제 #39
0
        private void PopulateTree(ItemCollection items, Node node)
        {
            TreeViewItem newItem = new TreeViewItem();

            newItem.Header = new ProductTreeNode(node);
            items.Add(newItem);

            foreach (Node childNode in node.Nodes)
            {
                PopulateTree(newItem.Items, childNode);
            }
        }
예제 #40
0
        public override void Load(Call call, TabModel model)
        {
            var items = new ItemCollection <ParentClass>();

            for (int i = 0; i < 1; i++)
            {
                items.Add(new ParentClass());
            }

            //items.Add(new ListItem("Long Text", reallyLongText));
            model.Items = items;
        }
예제 #41
0
 private void CreateNodes(ItemCollection treeNodeItems, Item[] items)
 {
     treeNodeItems.Clear();
     for (int i = 0; i < items.Length; i++)
     {
         Item dataItem = items[i];
         EO.Wpf.TreeViewItem treeViewItem = new EO.Wpf.TreeViewItem();
         treeViewItem.Header = dataItem;
         treeViewItem.LoadChildrenOnExpand = dataItem.MayHaveChildItems;
         treeNodeItems.Add(treeViewItem);
     }
 }
 public void Execute(HiveTask item, HiveTask parentItem)
 {
     if (item != null)
     {
         var experiment = item.ItemTask.Item as Experiment;
         experiment.Optimizers.Add(new Experiment());
     }
     else
     {
         hiveJobs.Add(new OptimizerHiveTask(new Experiment()));
     }
 }
예제 #43
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// Internal worker for PopulateTree.
        /// </summary>
        //------------------------------------------------------------------------------------
        void PopulateUITree(ItemCollection items, ProductTreeNode node)
        {
            TreeViewItem newItem = new TreeViewItem();

            newItem.Header = node;
            items.Add(newItem);

            foreach (ProductTreeNode childNode in node.ChildNodes)
            {
                PopulateUITree(newItem.Items, childNode);
            }
        }
예제 #44
0
        /// <summary>
        /// Creates an instance of the class as root component
        /// </summary>
        /// <param name="parent">parent language</param>
        /// <param name="name">name of the component</param>
        /// <param name="controlType">component type to create an instance from</param>
        internal LocalizableCompoment(ToolLanguage parent, string name, Type controlType)
        {
            Parent = parent;
            _value = name;
            _controlType = controlType;
            ControlRessources = new ItemCollection();

            string[] names = RessourceTableAttribute.GetRessourceNames(controlType);
            Dictionary<string, string> values = RessourceTableAttribute.GetRessourceValues(Design, parent.LCID);
            foreach (var resName in names)
            {
                string resValue ="";
                values.TryGetValue(resName, out resValue);

                Control ctrl = Translator.TryGetControl(Design, resName);
                Controls.Text.AdvRichTextBox advrichText = ctrl as Controls.Text.AdvRichTextBox;
                if (null != advrichText)
                {
                    ControlRessources.Add(new LocalizableWideString(resName, resValue));
                }
                else
                {
                    RichTextBox richBox = ctrl as RichTextBox;
                    if (null != richBox)
                    {
                        ControlRessources.Add(new LocalizableRTFString(resName, resValue));
                    }
                    else
                    {
                        TextBox textBox = ctrl as TextBox;
                        if (null != textBox && textBox.Multiline)
                            ControlRessources.Add(new LocalizableWideString(resName, resValue));
                        else
                            ControlRessources.Add(new LocalizableString(resName, resValue));
                    }

                }
            }
        }
 protected override void OnPopup(ItemCollection items)
 {
   ESRI.ArcGIS.Carto.IMap map = ArcMap.Document.FocusMap;
   for (int i = 0; i < map.LayerCount; i++)
   {
     ESRI.ArcGIS.Carto.ILayer layer = map.get_Layer(i);
     Item item = new Item();
     item.Caption = layer.Name;
     item.Enabled = layer.Visible;
     item.Message = layer.Name;
     item.Tag = layer;
     items.Add(item);
   }
 }
예제 #46
0
        public void AddToLocalAndRemoteAddToParent()
        {
            var global = new ItemCollection();
            var remote = new ItemCollection(global);
            var local = new ItemCollection(global);

            var item = Item();
            local.Add(item);
            remote.Add(item);

            Assert.That(global.ItemCount, Is.EqualTo(2));
            Assert.That(remote.ItemCount, Is.EqualTo(1));
            Assert.That(local.ItemCount, Is.EqualTo(1));
        }
예제 #47
0
        public void AddToLocalAddToParent()
        {
            var global = new ItemCollection();
            var remote = new ItemCollection(global);
            var local = new ItemCollection(global);

            var item = Item();
            local.Add(item);

            Assert.That(remote, Is.Empty);
            Assert.That(local, Contains.Item(item));
            Assert.That(global, Contains.Item(item));

            Assert.That(global.ItemCount, Is.EqualTo(1));
            Assert.That(local.ItemCount, Is.EqualTo(1));
        }
        public void FullNameCorrectWhenAdded()
        {
            Enterprise enterprise = new Enterprise {name = "Company"};
            ItemCollection<Area> areas = new ItemCollection<Area>(enterprise);

            Area area1 = new Area {name = "Area 1"};

            Assert.That(area1.FullName, Is.EqualTo("Area 1"));

            areas.Add(area1);

            Assert.That(areas.Count, Is.EqualTo(1));
            Assert.That(area1.FullName, Is.EqualTo("Company.Area 1"));

            areas.Remove(area1);
            Assert.That(areas.Count, Is.EqualTo(0));
            Assert.That(area1.FullName, Is.EqualTo("Area 1"));
        }
예제 #49
0
 /// <summary>
 /// Items by category.
 /// Returns Items of all types matching category.
 /// <remarks>This can be a slow running method. 
 /// It is likely you will want to use one of the overloads
 /// to trim the result set down a bit
 /// </remarks>
 /// </summary>
 /// <param name="categoryID">The category ID.</param>
 /// <returns></returns>
 public static ItemCollection ItemsByCategory(int categoryID)
 {
     // TODO: Need overloads to limit range
     // Date range, top count, bytype, bystatus, byparenttype....
     ItemCollection items = null;
     // i.ItemId, i.ParentItemId
     ItemData id = DAL.Items;
     id.Connection = new DatabaseHelper().Connection;
     DataTable dt = id.GetItemsByCategoryandType(categoryID, Guid.Empty);
     if (dt != null && dt.Rows.Count > 0)
     {
         items = new ItemCollection();
         foreach (DataRow row in dt.Rows)
         {
             long itemID = Convert.ToInt64(row["ItemID"]);
             items.Add(new Item(itemID));
         }
     }
     return items;
 }
예제 #50
0
    /// <summary>
    /// Adds items to the collection based on the search criteria
    /// </summary>
    /// <param name="items">The collection to add items to</param>
    /// <param name="current">The current item</param>
    /// <param name="templateId">Template filter</param>
    /// <param name="branchId">Branch filter</param>
    /// <param name="start">Indicates if the item is the start item</param>
    protected virtual void ProcessItem(ItemCollection items, Item current, ID templateId, ID branchId, bool start)
    {
      if (!start)
      {
        var include = IncludeItem(current, templateId, branchId);

        if (include)
          items.Add(current);
      }

      if (Recursive || start)
      {
        // process each child
        ChildList children = current.GetChildren();
        for (int i = 0; i < children.Count; i++)
        {
          ProcessItem(items, children[i], templateId, branchId, false);
        }
      }
    }
예제 #51
0
    protected virtual void PrepareItemsOverride(bool force)
    {
      if (_panelTemplateApplied && _itemsHostPanel != null && !force)
        return;
      // Check properties which are necessary in each case
      if (ItemsPanel == null)
        return;

      ItemsPresenter presenter = FindItemsPresenter();
      if (presenter == null)
        return;

      if (!_panelTemplateApplied)
      {
        _panelTemplateApplied = true;
        presenter.ApplyTemplate(ItemsPanel);
        _itemsHostPanel = null;
      }

      if (_itemsHostPanel == null)
        _itemsHostPanel = presenter.ItemsHostPanel;
      if (_itemsHostPanel == null)
        return;

      // Albert: We cannot exit the method if one of the styles is not set because the styles
      // might be found by the SkinEngine's automatic Style assignment (FrameworkElement.CopyDefaultStyle)
      //if (ItemContainerStyle == null || ItemTemplate == null)
      //  return;

      IEnumerable itemsSource = ItemsSource;
      if (itemsSource == null)
      { // In this case, we must set up the items control using the Items property
        ItemCollection items = _items;
        ItemCollection preparedChildren = new ItemCollection();
        bool setItems = false;
        if (items == null)
        {
          // Restore items from "ItemsSource mode" where they have been set to null
          items = new ItemCollection();
          setItems = true;
        }
        foreach (object item in items)
        {
          object itemCopy = MpfCopyManager.DeepCopyWithFixedObject(item, this); // Keep this object as LogicalParent
          FrameworkElement element = itemCopy as FrameworkElement ?? PrepareItemContainer(itemCopy);
          if (element.Style == null && element is ContentControl)
            element.Style = ItemContainerStyle;
          element.LogicalParent = this;
          preparedChildren.Add(element);
        }
        presenter.SetDataStrings(BuildDataStrings(items));

        SetPreparedItems(setItems, setItems ? items : null, true, preparedChildren);
      }
      else
      {
        IList<object> l = new List<object>();
        ISynchronizable sync = itemsSource as ISynchronizable;
        if (sync != null)
          lock (sync.SyncRoot)
            CollectionUtils.AddAll(l, itemsSource);
        else
          CollectionUtils.AddAll(l, itemsSource);

        presenter.SetDataStrings(BuildDataStrings(l));

        VirtualizingStackPanel vsp = _itemsHostPanel as VirtualizingStackPanel;
        if (vsp != null)
        {
          // In this case, the VSP will generate its items by itself
          ListViewItemGenerator lvig = new ListViewItemGenerator();
          lvig.Initialize(this, l, ItemContainerStyle, ItemTemplate);
          SimplePropertyDataDescriptor dd;
          if (SimplePropertyDataDescriptor.CreateSimplePropertyDataDescriptor(this, "IsEmpty", out dd))
            SetValueInRenderThread(dd, l.Count == 0);
          vsp.SetItemProvider(lvig);

          SetPreparedItems(true, null, false, null);
        }
        else
        {
          ItemCollection preparedItems = new ItemCollection();
          preparedItems.AddAll(l.Select(PrepareItemContainer));

          SetPreparedItems(true, null, true, preparedItems);
        }
      }
    }
예제 #52
0
 public ItemCollection GetValues()
 {
     var fonts = new ItemCollection();
     AssetService.FontAssets.ForEach(fa => fonts.Add(fa.Font, fa.Font.Name));
     return fonts;
 }
예제 #53
0
 /// <summary>
 /// Items by status.
 /// </summary>
 /// <param name="statusID">The status ID.</param>
 /// <returns></returns>
 public static ItemCollection ItemsByStatus(int statusID)
 {
     throw new System.NotImplementedException("Need to implement get by status method in DAL Layer.");
     // TODO: Need to implement get by status method in DAL Layer.
     // Date range, top count, bytype, bystatus, byparenttype....
     ItemCollection items = null;
     // i.ItemId, i.ParentItemId
     ItemData id = DAL.Items;
     id.Connection = new DatabaseHelper().Connection;
     DataTable dt = id.GetItemsByCategoryandType(statusID, Guid.Empty);
     if (dt != null && dt.Rows.Count > 0)
     {
         items = new ItemCollection();
         foreach (DataRow row in dt.Rows)
         {
             long itemID = Convert.ToInt64(row["ItemID"]);
             items.Add(new Item(itemID));
         }
     }
     return items;
 }
예제 #54
0
			public ItemCollection CloneItems()
			{


				ItemCollection arrList = new ItemCollection();

				int i =0;

				while(i<this.Count)
				{
					arrList.Add((SmartListItem)this.List[i]);
					i++;
				}

				return arrList;
			}
예제 #55
0
        public ItemCollection GetValues()
        {
            var items = new ItemCollection();

            for (int waveInDevice = 0; waveInDevice < WaveIn.DeviceCount; waveInDevice++)
                items.Add(waveInDevice, WaveIn.GetCapabilities(waveInDevice).ProductName);

            return items;
        }
예제 #56
0
    public override CommandResult Run()
    {
      if (string.IsNullOrEmpty(Command) && !StatisticsOnly)
        return new CommandResult(CommandStatus.Failure, Constants.Messages.MissingRequiredParameter.FormatWith("command") + " or -so flag.");

      if (!string.IsNullOrEmpty(Command) && StatisticsOnly)
        return new CommandResult(CommandStatus.Failure, "Cannot specify a command when returning statistics only.");

      // Make sure we have the right parameters filled in
      if (string.IsNullOrEmpty(FindByField.Key) ^ string.IsNullOrEmpty(FindByField.Value))
        return new CommandResult(CommandStatus.Failure, "Field name or value is missing.");

      // Reset regexs so they get rebuilt if required, based on current parameters
      _fieldRegex = null;
      _attributeRegex = null;

      // Convert template and branch arguments to IDs
      var templateId = ID.Null;
      if(!string.IsNullOrEmpty(Template))
      {
        var templateItem = Context.CurrentDatabase.Templates[Template];
        if (templateItem == null)
          return new CommandResult(CommandStatus.Failure, "Faild to find template '{0}'".FormatWith(Template));

        templateId = templateItem.ID;
      }

      var branchId = ID.Null;
      if (!string.IsNullOrEmpty(Branch))
      {
        var branchItem = Context.CurrentDatabase.Branches[Branch];
        if (branchItem == null)
          return new CommandResult(CommandStatus.Failure, "Faild to find branch '{0}'".FormatWith(Branch));

        branchId = branchItem.ID;
      }

      var output = new StringBuilder();

      using (var cs = new ContextSwitcher(Context, Path))
      {
        if (cs.Result.Status != CommandStatus.Success)
          return cs.Result;

        var items = new ItemCollection();
        if (!string.IsNullOrEmpty(Ids))
        {
          foreach (var id in ID.ParseArray(Ids))
          {
            var item = Context.CurrentDatabase.GetItem(id);
            if (item != null)
            {
              if (IncludeItem(item, templateId, branchId))
                items.Add(item);
            }
            else
              return new CommandResult(CommandStatus.Failure, "Failed to find item with id '{0}'".FormatWith(id));
          }
        }
        else
          ProcessItem(items, Context.CurrentItem, templateId, branchId, true);

        // Return number of matched items if only returning stats
        if (StatisticsOnly)
          output.Append(items.Count);
        else
        {
          // Execute command against each found item
          var limit = items.Count;
          for (var i = 0; i < limit; i++)
          {
            var item = items[i];
            using (new ContextSwitcher(Context, item.ID.ToString()))
            {
              var result = Context.ExecuteCommand(Command, Formatter);

              // Should we check the status? Maybe abort if stoponerror is set?

              output.Append(result);
            }

            if(i < limit - 1)
              Formatter.PrintLine(string.Empty, output);
          }

          if (!NoStatistics)
          {
            Formatter.PrintLine(string.Empty, output);
            Formatter.PrintLine(string.Empty, output);
            output.Append(string.Format("Found {0} {1}", items.Count, (items.Count == 1 ? "item" : "items")));
          }
        }
      }

      return new CommandResult(CommandStatus.Success, output.ToString());
    }
예제 #57
0
        public ItemCollection GetValues()
        {
            ItemCollection icon = new ItemCollection();
            icon.Add(IconsEnum.RDicon_generic, "Generic");
            icon.Add(IconsEnum.RDicon_start, "Start");
            icon.Add(IconsEnum.RDicon_basicrocketry, "Basic rocketry");
            icon.Add(IconsEnum.RDicon_generalrocketry, "General rocketry");
            icon.Add(IconsEnum.RDicon_survivability, "Survivability");
            icon.Add(IconsEnum.RDicon_stability, "Stability");
            icon.Add(IconsEnum.RDicon_sciencetech, "Science tech");
            icon.Add(IconsEnum.RDicon_generalconstruction, "General construction");
            icon.Add(IconsEnum.RDicon_flightcontrol, "Flight control");
            icon.Add(IconsEnum.RDicon_advconstruction, "Adv construction");
            icon.Add(IconsEnum.RDicon_advflightcontrol, "Adv flight control");
            icon.Add(IconsEnum.RDicon_electrics, "Electrics");
            icon.Add(IconsEnum.RDicon_evatech, "Eva tech");
            icon.Add(IconsEnum.RDicon_advlanding, "Adv landing");
            icon.Add(IconsEnum.RDicon_heavyrocketry, "Heavy rocketry");
            icon.Add(IconsEnum.RDicon_fuelsystems, "Fuel systems");
            icon.Add(IconsEnum.RDicon_aerodynamicSystems, "Aerodynamic Systems");
            icon.Add(IconsEnum.RDicon_advexploration, "Adv exploration");
            icon.Add(IconsEnum.RDicon_emgineering101, "Emgineering101");
            icon.Add(IconsEnum.RDicon_precisionengineering, "Precision engineering");
            icon.Add(IconsEnum.RDicon_advelectrics, "Adv electrics");
            icon.Add(IconsEnum.RDicon_specializedcontrol, "Apecialized control");
            icon.Add(IconsEnum.RDicon_heavierrocketry, "Heavier rocketry");
            icon.Add(IconsEnum.RDicon_specializedconstruction, "Specialized construction");
            icon.Add(IconsEnum.RDicon_landing, "Landing");
            icon.Add(IconsEnum.RDicon_supersonicflight, "Super sonicflight");
            icon.Add(IconsEnum.RDicon_composites, "Composites");
            icon.Add(IconsEnum.RDicon_fieldscience, "Field science");
            icon.Add(IconsEnum.RDicon_nuclearpropulsion, "Nuclear propulsion");
            icon.Add(IconsEnum.RDicon_ionpropulsion, "Ion propulsion");
            icon.Add(IconsEnum.RDicon_largeelectrics, "Large electrics");
            icon.Add(IconsEnum.RDicon_electronics, "Electronics");
            icon.Add(IconsEnum.RDicon_highaltitudeflight, "High altitude flight");
            icon.Add(IconsEnum.RDicon_unmannedtech, "Unmanned tech");
            icon.Add(IconsEnum.RDicon_largecontrol, "Large control");
            icon.Add(IconsEnum.RDicon_advmetalworks, "Adv metal works");
            icon.Add(IconsEnum.RDicon_advaerodynamics, "Adv aerodynamics");
            icon.Add(IconsEnum.RDicon_metamaterials, "Meta materials");
            icon.Add(IconsEnum.RDicon_heavyaerodynamics, "Heavy aerodynamics");
            icon.Add(IconsEnum.RDicon_veryheavyrocketry, "Very heavy rocketry");
            icon.Add(IconsEnum.RDicon_advancedmotors, "Adv ancedmotors");
            icon.Add(IconsEnum.RDicon_hypersonicflight, "Hyper sonic flight");
            icon.Add(IconsEnum.RDicon_specializedelectrics, "Specialized electrics");
            icon.Add(IconsEnum.RDicon_advunmanned, "Adv unmanned");
            icon.Add(IconsEnum.RDicon_advsciencetech, "Adv science tech");
            icon.Add(IconsEnum.RDicon_experimentalrocketry, "Experimental rocketry");
            icon.Add(IconsEnum.RDicon_aerospaceTech, "Aerospace tech");
            icon.Add(IconsEnum.RDicon_experimentalelectrics, "Experimental electrics");
            icon.Add(IconsEnum.RDicon_experimentalaerodynamics, "Experimental aerodynamics");
            icon.Add(IconsEnum.RDicon_experimentalscience, "Experimental science");
            icon.Add(IconsEnum.RDicon_experimentalmotors, "Experimental motors");
            icon.Add(IconsEnum.RDicon_robotics, "Robotics");
            icon.Add(IconsEnum.RDicon_automation, "Automation");
            icon.Add(IconsEnum.RDicon_nanolathing, "Nanolathing");
            icon.Add(IconsEnum.RDicon_telescope, "Telescope");
            icon.Add(IconsEnum.RDicon_aerospaceTech2, "Aerospace tech 2");
            icon.Add(IconsEnum.RDicon_commandModules, "Command modules");
            icon.Add(IconsEnum.RDicon_advfuelSystems, "Adv fuel Systems");
            icon.Add(IconsEnum.RDicon_highPerformancefuelSystems, "High performance fuel systems");
            icon.Add(IconsEnum.RDicon_largeVolumeContainment, "Large volume containment");
            icon.Add(IconsEnum.RDicon_miniaturization, "Miniaturization");
            icon.Add(IconsEnum.RDicon_precisionpropulsion, "Precision propulsion");
            icon.Add(IconsEnum.RDicon_propulsionSystems, "Propulsion systems");
            icon.Add(IconsEnum.RDicon_basicprobes, "Basic probes");
            icon.Add(IconsEnum.RDicon_highaltitudepropulsion, "High altitude propulsion");
            icon.Add(IconsEnum.RDicon_largeprobes, "Large probes");

            return icon;
        }
예제 #58
0
 private static void OnMobileIncoming(int client, PacketReader reader)
 {
     int serial78 = reader.ReadInt32();
     ItemCollection container78 = new ItemCollection(serial78, 125);
     Mobile mob78 = new Mobile(serial78, client);
     mob78.myID = reader.ReadInt16();
     mob78.myX = reader.ReadInt16();
     mob78.myY = reader.ReadInt16();
     mob78.myZ = reader.ReadSByte();
     mob78.myDirection = reader.ReadByte() & 0x07;
     mob78.myHue = reader.ReadInt16();
     mob78.myStatus = reader.ReadByte();
     mob78.myNotoriety = reader.ReadByte();
     Item item;
     for (; ; )
     {
         int itemSerial = reader.ReadInt32();
         if (itemSerial == 0)
             break;
         item = new Item(itemSerial);
         item.Owner = serial78;
         item.ID = reader.ReadInt16();
         item.Layer = (Layer)reader.ReadByte();
         ClientInfo ci;
         ClientInfoCollection.GetClient(client, out ci);
         if (ci.UseNewMobileIncoming)
         {
             item.myHue = reader.ReadInt16();
         }
         else
         {
             if ((item.myID & 0x8000) != 0)
             {
                 item.myID ^= 0x8000;
                 item.myHue = reader.ReadInt16();
             }
         }
         container78.Add( item );
     }
     IncomingPackets.OnEquippedMobAdded(client, mob78, container78);
 }
예제 #59
0
    protected virtual void PrepareItemsOverride(bool force)
    {
      if (_panelTemplateApplied && _itemsHostPanel != null && !force)
        return;
      // Check properties which are necessary in each case
      if (ItemsPanel == null)
        return;

      ItemsPresenter presenter = FindItemsPresenter();
      if (presenter == null)
        return;

      if (!_panelTemplateApplied)
      {
        _panelTemplateApplied = true;
        presenter.ApplyTemplate(ItemsPanel);
        _itemsHostPanel = null;
      }

      if (_itemsHostPanel == null)
        _itemsHostPanel = presenter.ItemsHostPanel;
      if (_itemsHostPanel == null)
        return;

      IEnumerable itemsSource = ItemsSource;
      if (itemsSource == null)
      { // In this case, we must set up the items control using the Items property
        ItemCollection items = _items;
        ItemCollection preparedChildren = new ItemCollection();
        bool setItems = false;
        if (items == null)
        {
          // Restore items from "ItemsSource mode" where they have been set to null
          items = new ItemCollection();
          setItems = true;
        }
        foreach (object item in items)
        {
          object itemCopy = MpfCopyManager.DeepCopyWithFixedObject(item, this); // Keep this object as LogicalParent
          FrameworkElement element = itemCopy as FrameworkElement ?? PrepareItemContainer(itemCopy);
          if (element.Style == null)
            element.Style = ItemContainerStyle;
          element.LogicalParent = this;
          preparedChildren.Add(element);
        }
        presenter.SetDataStrings(BuildDataStrings(items));

        SetPreparedItems(setItems, setItems ? items : null, true, preparedChildren);
      }
      else
      {
        IList<object> l = new List<object>();
        ISynchronizable sync = itemsSource as ISynchronizable;
        if (sync != null)
          lock (sync.SyncRoot)
            CollectionUtils.AddAll(l, itemsSource);
        else
          CollectionUtils.AddAll(l, itemsSource);

        presenter.SetDataStrings(BuildDataStrings(l));

        VirtualizingStackPanel vsp = _itemsHostPanel as VirtualizingStackPanel;
        if (vsp != null)
        {
          // In this case, the VSP will generate its items by itself
          ListViewItemGenerator lvig = new ListViewItemGenerator();
          lvig.Initialize(this, l, ItemContainerStyle, ItemTemplate);
          IsEmpty = l.Count == 0;
          vsp.SetItemProvider(lvig);

          SetPreparedItems(true, null, false, null);
        }
        else
        {
          ItemCollection preparedItems = new ItemCollection();
          preparedItems.AddAll(l.Select(PrepareItemContainer));

          SetPreparedItems(true, null, true, preparedItems);
        }
      }
    }
예제 #60
0
		private bool FilterItems(string value, ItemCollection items, ItemCollection filteredItems)
		{
			bool result = false;

			//ItemCollection filteredItems = new ItemCollection();
			
			for(int i=0;i<items.Count;i++)
			{
				string item = (string)items[i].Text;
				string val = item.Substring(0, value.Length).ToLower();
				
				if (String.Compare(val, value, true) == 0)
				{
					filteredItems.Add(items[i]);

					result = true;
				}

				//result = true;
			}

			return result;
		}