Exemple #1
0
        private void FillItemProperties()
        {
            txtItemName.Text = item.Name;

            if (item.AssetUUID != UUID.Zero)
            {
                txtUUID.Text = item.AssetUUID.ToString();
            }
            else
            {
                txtUUID.Text     = item.UUID.ToString();
                txtItemUUID.Text = item.UUID.ToString();
            }

            if (item.UUID != UUID.Zero)
            {
                txtItemUUID.Text = item.UUID.ToString();
            }

            txtItemCreator.Text     = txtItemOwner.Text = "Retreiving name...";
            txtItemDescription.Text = item.Description;

            List <UUID> avIDs = new List <UUID>();

            avIDs.Add(item.CreatorID);
            avIDs.Add(item.OwnerID);
            client.Avatars.RequestAvatarNames(avIDs);

            // Get permissions
            if ((item.Permissions.NextOwnerMask & PermissionMask.Modify) == PermissionMask.Modify)
            {
                checkBox1.Checked           = true;
                txtItemDescription.ReadOnly = false;
            }
            else
            {
                checkBox1.Checked           = false;
                txtItemDescription.ReadOnly = true;
            }

            if ((item.Permissions.NextOwnerMask & PermissionMask.Copy) == PermissionMask.Copy)
            {
                checkBox2.Checked = true;
            }
            else
            {
                checkBox2.Checked = false;
            }

            if ((item.Permissions.NextOwnerMask & PermissionMask.Transfer) == PermissionMask.Transfer)
            {
                checkBox3.Checked = true;
            }
            else
            {
                checkBox3.Checked = false;
            }

            // Set permission checboxes
            if ((item.Permissions.OwnerMask & PermissionMask.Modify) == PermissionMask.Modify)
            {
                checkBox1.Enabled           = true;
                txtItemDescription.ReadOnly = false;
            }
            else
            {
                checkBox1.Enabled           = false;
                txtItemDescription.ReadOnly = true;
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Copy) == PermissionMask.Copy)
            {
                checkBox2.Enabled = true;
            }
            else
            {
                checkBox2.Enabled = false;
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Transfer) == PermissionMask.Transfer)
            {
                checkBox3.Enabled = true;
                btnGive.Enabled   = true;
            }
            else
            {
                checkBox3.Enabled = false;
                btnGive.Enabled   = false;
            }

            label11.Visible = true;

            switch (item.InventoryType)
            {
            case InventoryType.Object:
                InventoryObjectConsole objectConsole = new InventoryObjectConsole(instance, item);
                btnDetach.Text     = "Detach";
                objectConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(objectConsole);

                //objectConsole.Dispose();
                break;

            case InventoryType.Notecard:
                InventoryNotecardConsole notecardConsole = new InventoryNotecardConsole(instance, item);
                notecardConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(notecardConsole);
                label11.Visible = false;

                //notecardConsole.Dispose();
                break;

            case InventoryType.LSL:
                InventoryScriptConsole scriptConsole = new InventoryScriptConsole(instance, item);
                scriptConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(scriptConsole);
                label11.Visible = false;

                //scriptConsole.Dispose();
                break;

            case InventoryType.Snapshot:
                InventoryImageConsole imageConsole = new InventoryImageConsole(instance, item);
                imageConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(imageConsole);
                label11.Visible = false;
                break;

            case InventoryType.Wearable:
                btnDetach.Text = "Take off";
                break;

            case InventoryType.Attachment:
                btnDetach.Text = "Detach";
                break;

            case InventoryType.Landmark:
                label11.Visible = false;
                break;

            case InventoryType.Animation:
                InventoryAnimationConsole animationConsole = new InventoryAnimationConsole(instance, item);
                animationConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(animationConsole);
                label11.Visible = false;
                break;

            case InventoryType.Texture:
                imageConsole      = new InventoryImageConsole(instance, item);
                imageConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(imageConsole);
                label11.Visible = false;
                break;

            case InventoryType.Gesture:
                InventoryGestureConsol gestureConsole = new InventoryGestureConsol(instance, item);
                gestureConsole.Dock = DockStyle.Fill;
                pnlItemTypeProp.Controls.Add(gestureConsole);
                label11.Visible = false;
                break;
            }

            if (item.InventoryType == InventoryType.Wearable)
            {
                InventoryWearable werbl = item as InventoryWearable;

                if (item.ParentUUID == instance.CoF.UUID)
                {
                    InventoryItem wItem = AInventoryItem(item);

                    werbl       = wItem as InventoryWearable;
                    label9.Text = "Wearable type: " + werbl.WearableType.ToString();
                }
                else
                {
                    label9.Text = "Wearable type: " + werbl.WearableType.ToString();
                }
            }
            else
            {
                //if (item.ParentUUID == instance.CoF.UUID)
                //{

                //}
                //else
                //{
                //    label9.Text = string.Empty;
                //}

                label9.Text = "Asset type: " + item.AssetType.ToString();
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Modify) != PermissionMask.Modify)
            {
                checkBox1.Enabled = checkBox2.Enabled = checkBox3.Enabled = false;
            }

            fLoading = false;
        }
        private void FillItemProperties()
        {
            txtItemName.Text = item.Name;

            if (item.AssetUUID != UUID.Zero)
            {
                txtUUID.Text = item.AssetUUID.ToString();
            }
            else
            {
                txtUUID.Text = item.UUID.ToString();
                txtItemUUID.Text = item.UUID.ToString();
            }

            if (item.UUID != UUID.Zero)
            {
                txtItemUUID.Text = item.UUID.ToString();
            }

            txtItemCreator.Text = txtItemOwner.Text = "Retreiving name...";
            txtItemDescription.Text = item.Description;

            List<UUID> avIDs = new List<UUID>();
            avIDs.Add(item.CreatorID);
            avIDs.Add(item.OwnerID);
            client.Avatars.RequestAvatarNames(avIDs);

            // Get permissions
            if ((item.Permissions.NextOwnerMask & PermissionMask.Modify) == PermissionMask.Modify)
            {
                checkBox1.Checked = true;
                txtItemDescription.ReadOnly = false;
            }
            else
            {
                checkBox1.Checked = false;
                txtItemDescription.ReadOnly = true;
            }

            if ((item.Permissions.NextOwnerMask & PermissionMask.Copy) == PermissionMask.Copy)
            {
                checkBox2.Checked = true;
            }
            else
            {
                checkBox2.Checked = false;
            }

            if ((item.Permissions.NextOwnerMask & PermissionMask.Transfer) == PermissionMask.Transfer)
            {
                checkBox3.Checked = true;
            }
            else
            {
                checkBox3.Checked = false;
            }

            // Set permission checboxes
            if ((item.Permissions.OwnerMask & PermissionMask.Modify) == PermissionMask.Modify)
            {
                checkBox1.Enabled = true;
                txtItemDescription.ReadOnly = false;
            }
            else
            {
                checkBox1.Enabled = false;
                txtItemDescription.ReadOnly = true;
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Copy) == PermissionMask.Copy)
            {
                checkBox2.Enabled = true;
            }
            else
            {
                checkBox2.Enabled = false;
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Transfer) == PermissionMask.Transfer)
            {
                checkBox3.Enabled = true;
                btnGive.Enabled = true;
            }
            else
            {
                checkBox3.Enabled = false;
                btnGive.Enabled = false;
            }

            label11.Visible = true;

            switch (item.InventoryType)
            {
                case InventoryType.Object:
                    InventoryObjectConsole objectConsole = new InventoryObjectConsole(instance, item);
                    btnDetach.Text = "Detach";
                    objectConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(objectConsole);

                    //objectConsole.Dispose();
                    break;

                case InventoryType.Notecard:
                    InventoryNotecardConsole notecardConsole = new InventoryNotecardConsole(instance, item);
                    notecardConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(notecardConsole);
                    label11.Visible = false;

                    //notecardConsole.Dispose();
                    break;

                case InventoryType.LSL:
                    InventoryScriptConsole scriptConsole = new InventoryScriptConsole(instance, item);
                    scriptConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(scriptConsole);
                    label11.Visible = false;

                    //scriptConsole.Dispose();
                    break;
                case InventoryType.Snapshot:
                    InventoryImageConsole imageConsole = new InventoryImageConsole(instance, item);
                    imageConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(imageConsole);
                    label11.Visible = false;
                    break;
                case InventoryType.Wearable:
                    btnDetach.Text = "Take off";
                    break;
                case InventoryType.Attachment:
                    btnDetach.Text = "Detach";
                    break;
                case InventoryType.Landmark:
                    label11.Visible = false;
                    break;
                case InventoryType.Animation:
                    InventoryAnimationConsole animationConsole = new InventoryAnimationConsole(instance, item);
                    animationConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(animationConsole);
                    label11.Visible = false;
                    break;
                case InventoryType.Texture:
                    imageConsole = new InventoryImageConsole(instance, item);
                    imageConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(imageConsole);
                    label11.Visible = false;
                    break;
                case InventoryType.Gesture:
                    InventoryGestureConsol gestureConsole = new InventoryGestureConsol(instance, item);
                    gestureConsole.Dock = DockStyle.Fill;
                    pnlItemTypeProp.Controls.Add(gestureConsole);
                    label11.Visible = false;
                    break;
            }

            if (item.InventoryType == InventoryType.Wearable)
            {
                InventoryWearable werbl = item as InventoryWearable;

                if (item.ParentUUID == instance.CoF.UUID)
                {
                    InventoryItem wItem = AInventoryItem(item);

                    werbl = wItem as InventoryWearable;
                    label9.Text = "Wearable type: " + werbl.WearableType.ToString();
                }
                else
                {
                    label9.Text = "Wearable type: " + werbl.WearableType.ToString();
                }
            }
            else
            {
                //if (item.ParentUUID == instance.CoF.UUID)
                //{

                //}
                //else
                //{
                //    label9.Text = string.Empty;
                //}

                label9.Text = "Asset type: " + item.AssetType.ToString();
            }

            if ((item.Permissions.OwnerMask & PermissionMask.Modify) != PermissionMask.Modify)
            {
                checkBox1.Enabled = checkBox2.Enabled = checkBox3.Enabled = false;
            }

            fLoading = false;
        }