public void Init2() { if (instance.MainForm.InvokeRequired) { instance.MainForm.BeginInvoke(new MethodInvoker(() => Init2())); return; } AddFolderFromStore(invRootNode, Inventory.RootFolder); sorter = new InvNodeSorter(); if (!instance.GlobalSettings.ContainsKey("inv_sort_bydate")) instance.GlobalSettings["inv_sort_bydate"] = OSD.FromBoolean(true); if (!instance.GlobalSettings.ContainsKey("inv_sort_sysfirst")) instance.GlobalSettings["inv_sort_sysfirst"] = OSD.FromBoolean(true); sorter.ByDate = instance.GlobalSettings["inv_sort_bydate"].AsBoolean(); sorter.SystemFoldersFirst = instance.GlobalSettings["inv_sort_sysfirst"].AsBoolean(); tbtnSortByDate.Checked = sorter.ByDate; tbtbSortByName.Checked = !sorter.ByDate; tbtnSystemFoldersFirst.Checked = sorter.SystemFoldersFirst; invTree.TreeViewNodeSorter = sorter; if (instance.MonoRuntime) { invTree.BackColor = Color.FromKnownColor(KnownColor.Window); invTree.ForeColor = invTree.LineColor = Color.FromKnownColor(KnownColor.WindowText); InventoryFolder f = new InventoryFolder(UUID.Random()); f.Name = ""; f.ParentUUID = UUID.Zero; f.PreferredType = AssetType.Unknown; TreeNode dirNode = new TreeNode(); dirNode.Name = f.UUID.ToString(); dirNode.Text = f.Name; dirNode.Tag = f; dirNode.ImageIndex = GetDirImageIndex(f.PreferredType.ToString().ToLower()); dirNode.SelectedImageIndex = dirNode.ImageIndex; invTree.Nodes.Add(dirNode); invTree.Sort(); } saveAllTToolStripMenuItem.Enabled = false; InventoryUpdate = new Thread(new ThreadStart(StartTraverseNodes)); InventoryUpdate.Name = "InventoryUpdate"; InventoryUpdate.IsBackground = true; InventoryUpdate.Start(); invRootNode.Expand(); invTree.AfterExpand += new TreeViewEventHandler(TreeView_AfterExpand); invTree.NodeMouseClick += new TreeNodeMouseClickEventHandler(invTree_MouseClick); invTree.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(invTree_NodeMouseDoubleClick); _EditTimer = new System.Threading.Timer(OnLabelEditTimer, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); // Callbacks Inventory.InventoryObjectAdded += new EventHandler<InventoryObjectAddedEventArgs>(Inventory_InventoryObjectAdded); Inventory.InventoryObjectUpdated += new EventHandler<InventoryObjectUpdatedEventArgs>(Inventory_InventoryObjectUpdated); Inventory.InventoryObjectRemoved += new EventHandler<InventoryObjectRemovedEventArgs>(Inventory_InventoryObjectRemoved); client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_AttachmentUpdate); client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject); client.Appearance.AppearanceSet += new EventHandler<AppearanceSetEventArgs>(Appearance_AppearanceSet); }
public InventoryConsole(RadegastInstance instance) { InitializeComponent(); Disposed += new EventHandler(InventoryConsole_Disposed); TreeUpdateTimer = new System.Timers.Timer() { Interval = updateInterval, Enabled = false, SynchronizingObject = invTree }; TreeUpdateTimer.Elapsed += TreeUpdateTimerTick; this.instance = instance; Manager = client.Inventory; Inventory = Manager.Store; Inventory.RootFolder.OwnerID = client.Self.AgentID; invTree.ImageList = frmMain.ResourceImages; invRootNode = AddDir(null, Inventory.RootFolder); Logger.Log("Reading inventory cache from " + instance.InventoryCacheFileName, Helpers.LogLevel.Debug, client); Inventory.RestoreFromDisk(instance.InventoryCacheFileName); AddFolderFromStore(invRootNode, Inventory.RootFolder); sorter = new InvNodeSorter(); if (!instance.GlobalSettings.ContainsKey("inv_sort_bydate")) instance.GlobalSettings["inv_sort_bydate"] = OSD.FromBoolean(true); if (!instance.GlobalSettings.ContainsKey("inv_sort_sysfirst")) instance.GlobalSettings["inv_sort_sysfirst"] = OSD.FromBoolean(true); sorter.ByDate = instance.GlobalSettings["inv_sort_bydate"].AsBoolean(); sorter.SystemFoldersFirst = instance.GlobalSettings["inv_sort_sysfirst"].AsBoolean(); tbtnSortByDate.Checked = sorter.ByDate; tbtbSortByName.Checked = !sorter.ByDate; tbtnSystemFoldersFirst.Checked = sorter.SystemFoldersFirst; invTree.TreeViewNodeSorter = sorter; if (instance.MonoRuntime) { invTree.BackColor = Color.FromKnownColor(KnownColor.Window); invTree.ForeColor = invTree.LineColor = Color.FromKnownColor(KnownColor.WindowText); InventoryFolder f = new InventoryFolder(UUID.Random()); f.Name = ""; f.ParentUUID = UUID.Zero; f.PreferredType = AssetType.Unknown; TreeNode dirNode = new TreeNode(); dirNode.Name = f.UUID.ToString(); dirNode.Text = f.Name; dirNode.Tag = f; dirNode.ImageIndex = GetDirImageIndex(f.PreferredType.ToString().ToLower()); dirNode.SelectedImageIndex = dirNode.ImageIndex; invTree.Nodes.Add(dirNode); invTree.Sort(); } saveAllTToolStripMenuItem.Enabled = false; InventoryUpdate = new Thread(new ThreadStart(StartTraverseNodes)); InventoryUpdate.Name = "InventoryUpdate"; InventoryUpdate.IsBackground = true; InventoryUpdate.Start(); invRootNode.Expand(); invTree.AfterExpand += new TreeViewEventHandler(TreeView_AfterExpand); invTree.NodeMouseClick += new TreeNodeMouseClickEventHandler(invTree_MouseClick); invTree.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(invTree_NodeMouseDoubleClick); _EditTimer = new System.Threading.Timer(OnLabelEditTimer, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); // Callbacks Inventory.InventoryObjectAdded += new EventHandler<InventoryObjectAddedEventArgs>(Inventory_InventoryObjectAdded); Inventory.InventoryObjectUpdated += new EventHandler<InventoryObjectUpdatedEventArgs>(Inventory_InventoryObjectUpdated); Inventory.InventoryObjectRemoved += new EventHandler<InventoryObjectRemovedEventArgs>(Inventory_InventoryObjectRemoved); client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_AttachmentUpdate); client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject); client.Appearance.AppearanceSet += new EventHandler<AppearanceSetEventArgs>(Appearance_AppearanceSet); }