Ejemplo n.º 1
0
        protected void CubeBlockPropertyChangedCallback(Object sender, PropertyChangedEventArgs e)
        {
            if (sender is CubeBlockEntityProxy)
            {
                try
                {
                    if (TRV_Entities.SelectedNode == null)
                    {
                        return;
                    }

                    TreeNode selectedNode = TRV_Entities.SelectedNode;
                    if (selectedNode.Tag == null)
                    {
                        return;
                    }
                    Object linkedObject = selectedNode.Tag;
                    if (linkedObject != sender)
                    {
                        return;
                    }

                    CubeGridEntityProxy  cubeGrid = (CubeGridEntityProxy)selectedNode.Parent.Parent.Tag;
                    CubeBlockEntityProxy entity   = (CubeBlockEntityProxy)sender;

                    m_serviceClient.UpdateCubeBlock(cubeGrid, entity);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Ejemplo n.º 2
0
        private void TRV_Entities_AfterSelect(object sender, TreeViewEventArgs e)
        {
            BTN_Entities_Export.Enabled = false;
            BTN_Entities_New.Enabled    = false;
            BTN_Entities_Delete.Enabled = false;

            TreeNode selectedNode = e.Node;

            if (selectedNode == null)
            {
                return;
            }

            TreeNode parentNode = e.Node.Parent;

            if (parentNode == null)
            {
                return;
            }

            if (selectedNode.Tag == null)
            {
                return;
            }

            var linkedObject = selectedNode.Tag;

            PG_Entities_Details.SelectedObject = linkedObject;

            if (linkedObject is CubeGridEntityProxy)
            {
                TRV_Entities.BeginUpdate();

                RenderCubeGridChildNodes((CubeGridEntityProxy)linkedObject, e.Node);

                TRV_Entities.EndUpdate();
            }

            if (linkedObject is CharacterEntityProxy)
            {
                CharacterEntityProxy character = (CharacterEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 1)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode itemsNode = e.Node.Nodes.Add("Items");
                    itemsNode.Name = itemsNode.Text;
                    //itemsNode.Tag = character.Inventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is CargoContainerEntityProxy)
            {
                CargoContainerEntityProxy container = (CargoContainerEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 1)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode itemsNode = e.Node.Nodes.Add("Items");
                    itemsNode.Name = itemsNode.Text;
                    itemsNode.Tag  = container.Inventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is ReactorEntityProxy)
            {
                ReactorEntityProxy reactor = (ReactorEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 1)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode itemsNode = e.Node.Nodes.Add("Items");
                    itemsNode.Name = itemsNode.Text;
                    itemsNode.Tag  = reactor.Inventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is ShipToolBaseEntityProxy)
            {
                ShipToolBaseEntityProxy shipTool = (ShipToolBaseEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 1)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode itemsNode = e.Node.Nodes.Add("Items");
                    itemsNode.Name = itemsNode.Text;
                    itemsNode.Tag  = shipTool.Inventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is ShipDrillEntityProxy)
            {
                ShipDrillEntityProxy shipDrill = (ShipDrillEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 1)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode itemsNode = e.Node.Nodes.Add("Items");
                    itemsNode.Name = itemsNode.Text;
                    itemsNode.Tag  = shipDrill.Inventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is ProductionBlockEntityProxy)
            {
                ProductionBlockEntityProxy productionBlock = (ProductionBlockEntityProxy)linkedObject;

                if (e.Node.Nodes.Count < 2)
                {
                    TRV_Entities.BeginUpdate();

                    e.Node.Nodes.Clear();
                    TreeNode inputNode = e.Node.Nodes.Add("Input");
                    inputNode.Name = inputNode.Text;
                    inputNode.Tag  = productionBlock.InputInventory;
                    TreeNode outputNode = e.Node.Nodes.Add("Output");
                    outputNode.Name = outputNode.Text;
                    outputNode.Tag  = productionBlock.OutputInventory;

                    TRV_Entities.EndUpdate();
                }
            }

            if (linkedObject is InventoryEntityProxy)
            {
                InventoryEntityProxy inventory = (InventoryEntityProxy)linkedObject;

                if (parentNode.Tag is CubeBlockEntityProxy && parentNode.Parent.Parent.Tag is CubeGridEntityProxy)
                {
                    CubeGridEntityProxy  cubeGrid  = (CubeGridEntityProxy)parentNode.Parent.Parent.Tag;
                    CubeBlockEntityProxy cubeBlock = (CubeBlockEntityProxy)parentNode.Tag;

                    long   cubeGridEntityId  = cubeGrid.EntityId;
                    long   cubeBlockEntityId = cubeBlock.EntityId;
                    ushort inventoryIndex    = 0;
                    List <InventoryItemEntityProxy> inventoryItems = m_serviceClient.GetInventoryItems(cubeGridEntityId, cubeBlockEntityId, inventoryIndex);

                    UpdateNodeInventoryItemBranch <InventoryItemEntityProxy>(e.Node, inventoryItems);
                }
            }
        }