Exemple #1
0
 public static void InsertObjects(LevelArea area, List <Managed3DObject> objList, ListView.ListViewItemCollection lvic, Dictionary <int, Managed3DObject> removedObjs, Dictionary <int, ListViewItem> removedlvis, Dictionary <int, LevelscriptCommand> removedCmds)
 {
     foreach (KeyValuePair <int, Managed3DObject> kvp in removedObjs.OrderBy(n => n.Key))
     {
         objList.Insert(kvp.Key, kvp.Value);
     }
     foreach (KeyValuePair <int, LevelscriptCommand> kvp in removedCmds.OrderBy(n => n.Key))
     {
         area.Objects.Insert(kvp.Key, kvp.Value);
     }
     foreach (KeyValuePair <int, ListViewItem> kvp in removedlvis.OrderBy(n => n.Key))
     {
         lvic.Insert(kvp.Key, kvp.Value);
     }
 }
Exemple #2
0
 public static void InsertWarps(LevelArea area, List <IManagedLevelscriptCommand> objList, ListView.ListViewItemCollection lvic, Dictionary <int, IManagedLevelscriptCommand> removedObjs, Dictionary <int, ListViewItem> removedlvis, Dictionary <int, LevelscriptCommand> removedCmds, Dictionary <ListViewItem, ListViewGroup> lviGroups)
 {
     foreach (KeyValuePair <int, IManagedLevelscriptCommand> kvp in removedObjs.OrderBy(n => n.Key))
     {
         objList.Insert(kvp.Key, kvp.Value);
     }
     foreach (KeyValuePair <int, LevelscriptCommand> kvp in removedCmds.OrderBy(n => n.Key))
     {
         area.Warps.Insert(kvp.Key, kvp.Value);
     }
     foreach (KeyValuePair <int, ListViewItem> kvp in removedlvis.OrderBy(n => n.Key))
     {
         kvp.Value.Group = lviGroups[kvp.Value];
         lvic.Insert(kvp.Key, kvp.Value);
     }
 }
Exemple #3
0
        private void InsertLogMessageByDate(ListView.ListViewItemCollection items, LogMessageItem refItem)
        {
            // Get previous item
            var prevItem = refItem;

            while ((prevItem != null) && !prevItem.Enabled)
            {
                prevItem = prevItem.Previous;
            }

            var pos = 0;

            if ((prevItem != null) && (prevItem.Item != null))
            {
                pos = items.IndexOf(prevItem.Item) + 1;
            }

            items.Insert(pos, refItem.Item);

            // Mark the item as enabled
            refItem.Enabled = true;
        }
 public void Insert(int index, ListViewItem item)
 {
     _collection.Insert(index, item);
 }
Exemple #5
0
        public void leerProductos(ListView obj)
        {
            ListView.ListViewItemCollection d = new ListView.ListViewItemCollection(obj);
            try
            {
                conexionstring.Open();
                OleDbCommand    comando = new OleDbCommand("SELECT * FROM Productos", conexionstring);
                OleDbDataReader lector;
                lector = comando.ExecuteReader();
                lector.Read();
                if (lector.HasRows)
                {
                    Boolean color      = true;
                    string  textocolor = "";
                    do
                    {
                        if (color)
                        {
                            textocolor = "ActiveCaption";
                        }
                        else
                        {
                            textocolor = "Window";
                        }
                        int          index       = lector.GetInt32(0);
                        string       nombre      = lector.GetString(1);
                        int          costo       = int.Parse(lector.GetValue(2).ToString());
                        int          stock       = lector.GetInt32(3);
                        int          precioVenta = int.Parse(lector.GetValue(4).ToString());
                        string       descripcion = lector.GetString(5);
                        ListViewItem x           = new ListViewItem();
                        x.Text      = index + "";
                        x.BackColor = Color.FromName(textocolor);
                        ListViewItem.ListViewSubItem nombre1 = new ListViewItem.ListViewSubItem();
                        nombre1.Text = nombre;
                        ListViewItem.ListViewSubItem costo1 = new ListViewItem.ListViewSubItem();
                        costo1.Text = costo + "";
                        ListViewItem.ListViewSubItem stock1 = new ListViewItem.ListViewSubItem();
                        stock1.Text = stock + "";
                        ListViewItem.ListViewSubItem precioVenta1 = new ListViewItem.ListViewSubItem();
                        precioVenta1.Text = precioVenta + "";
                        ListViewItem.ListViewSubItem descripcion1 = new ListViewItem.ListViewSubItem();
                        descripcion1.Text = descripcion;

                        x.SubItems.Add(nombre1);
                        x.SubItems.Add(costo1);
                        x.SubItems.Add(stock1);
                        x.SubItems.Add(precioVenta1);
                        x.SubItems.Add(descripcion1);
                        d.Insert(index - 1, x);
                        color = !color;
                        //MessageBox.Show("Se inserto el valor: "+lector.GetValue(1).ToString());
                    } while (lector.Read());
                }
                lector.Close();
                conexionstring.Close();
            }
            catch (System.Exception error)
            {
                MessageBox.Show("Ha habido un error en su conexión, intentelo más tarde" + error.Message);
            }
            finally
            {
                conexionstring.Close();
            }
        }
Exemple #6
0
 public void Insert(Int32 index, GenericListViewItem <T> item)
 {
     _items.Insert(index, item ?? throw new ArgumentNullException(nameof(item)));
     OnInsert?.Invoke(index, ref item);
     ItemsChanged?.Invoke();
 }