Exemplo n.º 1
0
        public static void UpdateFOLV_add(FastObjectListView olv, ICollection Collection, bool ResizeCols = false, bool Follow = false)
        {
            Global_GUI.InvokeIFRequired(olv, () =>
            {
                try
                {
                    if (olv.Items.Count == 0)
                    {
                        olv.EmptyListMsg = "Loading...";
                    }

                    olv.Freeze();

                    olv.UpdateObjects(Collection);

                    if (olv.Items.Count > 0)
                    {
                        if (Follow)
                        {
                            olv.SelectedIndex = 0;                              //olv.Items.Count - 1;
                            olv.EnsureModelVisible(olv.SelectedObject);
                        }

                        //update column size only if did not restore folv state file or forced
                        if (olv.Tag == null || ResizeCols)
                        {
                            olv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                            olv.Tag = "resizedcols";
                        }
                    }
                    else
                    {
                        olv.EmptyListMsg = "Empty";
                    }
                }
                catch (Exception ex)
                {
                    Global.Log("Error: " + Global.ExMsg(ex));
                }
                finally
                {
                    olv.Unfreeze();
                }
            });
        }