Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int iDx = lbxPrims.SelectedIndex;

            if (iDx != -1)
            {
                AttachmentsListItem item = (AttachmentsListItem)lbxPrims.Items[iDx];

                if (item == null)
                {
                    return;
                }

                UUID itmid = GetItemID(item.Prim);

                if (itmid == UUID.Zero)
                {
                    return;
                }

                InventoryItem attid = client.Inventory.Store[itmid] as InventoryItem;

                //client.Appearance.Detach(attid);

                //List<UUID> remclothing = new List<UUID>();
                //remclothing.Add(attid.UUID);

                List <InventoryBase> contents    = client.Inventory.Store.GetContents(instance.CoF.UUID);
                List <UUID>          remclothing = new List <UUID>();

                foreach (InventoryItem ritem in contents)
                {
                    if (ritem.AssetUUID == attid.UUID)
                    {
                        remclothing.Add(ritem.UUID);
                    }
                }

                client.Inventory.Remove(remclothing, null);
                client.Appearance.Detach(attid);

                lock (listItems)
                {
                    listItems.Clear();
                }

                pBar3.Visible = true;
                lbxPrims.Items.Clear();
                lbxPrimGroup.Items.Clear();

                WorkPool.QueueUserWorkItem(delegate(object sync)
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Thread.Sleep(2000);
                    ReLoadItems();
                    //GetAttachments();
                    Cursor.Current = Cursors.Default;
                });
            }
        }
Beispiel #2
0
        private void lbxPrimGroup_SelectedIndexChanged(object sender, EventArgs e)
        {
            label4.Text = string.Empty;

            int iDx = lbxPrimGroup.SelectedIndex;

            if (iDx < 0)
            {
                btnTouch.Enabled = false;
                button2.Enabled  = false;
                return;
            }
            else
            {
                button2.Enabled = true;
            }

            AttachmentsListItem item = (AttachmentsListItem)lbxPrimGroup.Items[iDx];

            if ((item.Prim.Flags & PrimFlags.Touch) == PrimFlags.Touch)
            {
                btnTouch.Enabled = true;
            }
            else
            {
                btnTouch.Enabled = false;
            }

            label5.Text = item.Prim.Text;
        }
Beispiel #3
0
        private void gitem_PropertiesReceived(object sender, EventArgs e)
        {
            BeginInvoke(new MethodInvoker(delegate()
            {
                AttachmentsListItem item = (AttachmentsListItem)sender;

                lbxPrimGroup.Items.Add(item);

                label2.Text = "Ttl: " + lbxPrimGroup.Items.Count.ToString(CultureInfo.CurrentCulture) + " linked objects";
            }));
        }
Beispiel #4
0
        private void GetAttachments()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    GetAttachments();
                }));

                return;
            }

            List <Primitive> prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                new Predicate <Primitive>(delegate(Primitive prim)
            {
                try
                {
                    return(prim.ParentID == av.LocalID);
                }
                catch { return(false); }
            }));

            lbxPrims.BeginUpdate();
            lbxPrims.Items.Clear();

            foreach (Primitive prim in prims)
            {
                try
                {
                    AttachmentsListItem item = new AttachmentsListItem(prim, client, lbxPrims);

                    if (!listItems.ContainsKey(prim.LocalID))
                    {
                        listItems.Add(prim.LocalID, item);

                        item.PropertiesReceived += new EventHandler(item_PropertiesReceived);
                        item.RequestProperties();
                    }
                }
                catch
                {
                    ;
                }
            }

            lbxPrims.EndUpdate();
            lbxPrims.Visible = true;
        }
Beispiel #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int iDx = lbxPrims.SelectedIndex;
            AttachmentsListItem item = (AttachmentsListItem)lbxPrims.Items[iDx];

            if (item == null)
            {
                return;
            }
            (new META3D(instance, item.Prim.LocalID, item.Prim)).Show();

            //using (META3D frm = new META3D(instance, item.Prim.LocalID, item.Prim))
            //{
            //    frm.Show();
            //}
        }
Beispiel #6
0
        private void item_PropertiesReceived(object sender, EventArgs e)
        {
            BeginInvoke(new MethodInvoker(delegate()
            {
                AttachmentsListItem item = (AttachmentsListItem)sender;

                if (listItems.ContainsKey(item.Prim.LocalID))
                {
                    lbxPrims.BeginUpdate();
                    lbxPrims.Items.Add(item);
                    lbxPrims.EndUpdate();

                    label1.Text = "Ttl: " + lbxPrims.Items.Count.ToString(CultureInfo.CurrentCulture) + " attachments";
                }
            }));
        }
Beispiel #7
0
        private void btnTouch_Click(object sender, EventArgs e)
        {
            try
            {
                int iGx = lbxPrimGroup.SelectedIndex;

                if (iGx == -1)
                {
                    int iDx = lbxPrims.SelectedIndex;

                    if (iDx != -1)
                    {
                        AttachmentsListItem item = (AttachmentsListItem)lbxPrims.Items[iDx];

                        if (item == null)
                        {
                            return;
                        }

                        client.Self.Touch(item.Prim.LocalID);
                        label4.Text = "Touched " + item.Prim.Properties.Name;
                    }
                    else
                    {
                        MessageBox.Show("You must select an attachment first", "METAbolt", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    AttachmentsListItem gitem = (AttachmentsListItem)lbxPrimGroup.Items[iGx];
                    client.Self.Touch(gitem.Prim.LocalID);
                    label4.Text = "Touched " + gitem.Prim.Properties.Name;
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Worn Attachments: " + ex.Message, Helpers.LogLevel.Error);
            }
        }
        //private void Self_TeleportProgress(object sender, TeleportEventArgs e)
        //{
        //    if (!this.IsHandleCreated) return;
        //    switch (e.Status)
        //    {
        //        case TeleportStatus.Start:
        //        case TeleportStatus.Progress:
        //        case TeleportStatus.Failed:
        //        case TeleportStatus.Cancelled:
        //            return;
        //        case TeleportStatus.Finished:
        //            WorkPool.QueueUserWorkItem(delegate(object sync)
        //            {
        //                Cursor.Current = Cursors.WaitCursor;
        //                Thread.Sleep(6000);
        //                ReLoadItems();
        //                //GetAttachments();
        //                Cursor.Current = Cursors.Default;
        //            });
        //            return;
        //    }
        //}
        private void ReLoadItems()
        {
            try
            {
                Avatar sav = client.Network.CurrentSim.ObjectsAvatars.Find(delegate(Avatar fa)
                {
                    return fa.ID == av.ID;
                }
                );

                if (sav != null)
                {
                    List<Primitive> prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                            new Predicate<Primitive>(delegate(Primitive prim)
                            {
                                try
                                {
                                    return (prim.ParentID == sav.LocalID);
                                }
                                catch { return false; }
                            }));

                    this.BeginInvoke(new MethodInvoker(delegate()
                    {
                        lbxPrims.BeginUpdate();
                        lbxPrims.Items.Clear();

                        foreach (Primitive prim in prims)
                        {
                            try
                            {
                                AttachmentsListItem item = new AttachmentsListItem(prim, client, lbxPrims);

                                if (!listItems.ContainsKey(prim.LocalID))
                                {
                                    listItems.Add(prim.LocalID, item);

                                    item.PropertiesReceived += new EventHandler(item_PropertiesReceived);
                                    item.RequestProperties();
                                }
                            }
                            catch
                            {
                                ;
                            }
                        }

                        lbxPrims.EndUpdate();
                        lbxPrims.Visible = true;

                        pBar3.Visible = false;
                    }));
                }
                else
                {
                    //this.Close();
                    this.Dispose();
                }
            }
            catch { ; }
        }
        private void lbxPrims_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtUUID.Text = string.Empty;
            txtPoint.Text = string.Empty;

            label4.Text = string.Empty;

            lbxPrimGroup.BeginUpdate();

            int iDx = lbxPrims.SelectedIndex;
            lbxPrimGroup.Items.Clear();
            label2.Text = string.Empty;

            if (iDx < 0)
            {
                btnTouch.Enabled = false;
                button2.Enabled = false;

                if (av.ID == client.Self.AgentID) button1.Enabled = false;
                return;
            }
            else
            {
                button2.Enabled = true;
                if (av.ID == client.Self.AgentID) button1.Enabled = true;
            }

            AttachmentsListItem item = (AttachmentsListItem)lbxPrims.Items[iDx];

            if ((item.Prim.Flags & PrimFlags.Touch) == PrimFlags.Touch)
            {
                btnTouch.Enabled = true;
            }
            else
            {
                btnTouch.Enabled = false;
            }

            txtUUID.Text = item.Prim.ID.ToString();
            txtPoint.Text = item.Prim.PrimData.AttachmentPoint.ToString();

            List<Primitive> group = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                delegate(Primitive prim)
                {
                    return (prim.ParentID == item.Prim.LocalID);
                }
            );

            label5.Text = item.Prim.Text;

            foreach (Primitive gprim in group)
            {
                try
                {
                    AttachmentsListItem gitem = new AttachmentsListItem(gprim, client, lbxPrimGroup);

                    gitem.PropertiesReceived += new EventHandler(gitem_PropertiesReceived);
                    gitem.RequestProperties();
                }
                catch
                {
                    ;
                }
            }

            lbxPrimGroup.EndUpdate();
        }
        private void GetAttachments()
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new MethodInvoker(delegate()
                {
                    GetAttachments();
                }));

                return;
            }

            List<Primitive> prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                new Predicate<Primitive>(delegate(Primitive prim)
                {
                    try
                    {
                        return (prim.ParentID == av.LocalID);
                    }
                    catch { return false; }
                }));

            lbxPrims.BeginUpdate();
            lbxPrims.Items.Clear();

            foreach (Primitive prim in prims)
            {
                try
                {
                    AttachmentsListItem item = new AttachmentsListItem(prim, client, lbxPrims);

                    if (!listItems.ContainsKey(prim.LocalID))
                    {
                        listItems.Add(prim.LocalID, item);

                        item.PropertiesReceived += new EventHandler(item_PropertiesReceived);
                        item.RequestProperties();
                    }
                }
                catch
                {
                    ;
                }
            }

            lbxPrims.EndUpdate();
            lbxPrims.Visible = true;
        }
Beispiel #11
0
        private void lbxPrims_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtUUID.Text  = string.Empty;
            txtPoint.Text = string.Empty;

            label4.Text = string.Empty;

            lbxPrimGroup.BeginUpdate();

            int iDx = lbxPrims.SelectedIndex;

            lbxPrimGroup.Items.Clear();
            label2.Text = string.Empty;

            if (iDx < 0)
            {
                btnTouch.Enabled = false;
                button2.Enabled  = false;

                if (av.ID == client.Self.AgentID)
                {
                    button1.Enabled = false;
                }
                return;
            }
            else
            {
                button2.Enabled = true;
                if (av.ID == client.Self.AgentID)
                {
                    button1.Enabled = true;
                }
            }

            AttachmentsListItem item = (AttachmentsListItem)lbxPrims.Items[iDx];

            if ((item.Prim.Flags & PrimFlags.Touch) == PrimFlags.Touch)
            {
                btnTouch.Enabled = true;
            }
            else
            {
                btnTouch.Enabled = false;
            }

            txtUUID.Text  = item.Prim.ID.ToString();
            txtPoint.Text = item.Prim.PrimData.AttachmentPoint.ToString();

            List <Primitive> group = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                delegate(Primitive prim)
            {
                return(prim.ParentID == item.Prim.LocalID);
            }
                );

            label5.Text = item.Prim.Text;

            foreach (Primitive gprim in group)
            {
                try
                {
                    AttachmentsListItem gitem = new AttachmentsListItem(gprim, client, lbxPrimGroup);

                    gitem.PropertiesReceived += new EventHandler(gitem_PropertiesReceived);
                    gitem.RequestProperties();
                }
                catch
                {
                    ;
                }
            }

            lbxPrimGroup.EndUpdate();
        }
Beispiel #12
0
        private void lbxPrimGroup_DrawItem(object sender, DrawItemEventArgs e)
        {
            e.DrawBackground();

            if (e.Index < 0)
            {
                return;
            }

            AttachmentsListItem itemToDraw = (AttachmentsListItem)lbxPrimGroup.Items[e.Index];

            Brush textBrush = null;
            //float fsize = 12.0f;
            Font boldFont    = new Font(e.Font, FontStyle.Bold);
            Font regularFont = new Font(e.Font, FontStyle.Regular);

            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                textBrush = new SolidBrush(Color.FromKnownColor(KnownColor.HighlightText));
            }
            else
            {
                textBrush = new SolidBrush(Color.FromKnownColor(KnownColor.ControlText));
            }

            string name   = string.Empty;
            string wornat = string.Empty;

            try
            {
                if (itemToDraw.Prim.Properties == null)
                {
                    name   = "...";
                    wornat = string.Empty;
                }
                else
                {
                    name = itemToDraw.Prim.Properties.Name;

                    if ((itemToDraw.Prim.Flags & PrimFlags.Touch) == PrimFlags.Touch)
                    {
                        wornat = "(Touch)";
                    }
                    else
                    {
                        wornat = string.Empty;
                    }
                }
            }
            catch
            {
                name   = "...";
                wornat = "...";
                //Logger.Log(ex.Message, Helpers.LogLevel.Debug, ex);
            }

            SizeF nameSize = e.Graphics.MeasureString(name, boldFont);
            float nameX    = e.Bounds.Left + 4;
            float nameY    = e.Bounds.Top + 2;

            e.Graphics.DrawString(name, boldFont, textBrush, nameX, nameY);
            e.Graphics.DrawString(wornat, regularFont, textBrush, nameX + nameSize.Width + 8, nameY);

            e.DrawFocusRectangle();

            boldFont.Dispose();
            regularFont.Dispose();
            textBrush.Dispose();
            boldFont    = null;
            regularFont = null;
            textBrush   = null;
        }
Beispiel #13
0
        //private void Self_TeleportProgress(object sender, TeleportEventArgs e)
        //{
        //    if (!this.IsHandleCreated) return;

        //    switch (e.Status)
        //    {
        //        case TeleportStatus.Start:
        //        case TeleportStatus.Progress:
        //        case TeleportStatus.Failed:
        //        case TeleportStatus.Cancelled:
        //            return;

        //        case TeleportStatus.Finished:
        //            WorkPool.QueueUserWorkItem(delegate(object sync)
        //            {
        //                Cursor.Current = Cursors.WaitCursor;
        //                Thread.Sleep(6000);
        //                ReLoadItems();
        //                //GetAttachments();
        //                Cursor.Current = Cursors.Default;
        //            });

        //            return;
        //    }
        //}

        private void ReLoadItems()
        {
            try
            {
                Avatar sav = client.Network.CurrentSim.ObjectsAvatars.Find(delegate(Avatar fa)
                {
                    return(fa.ID == av.ID);
                }
                                                                           );

                if (sav != null)
                {
                    List <Primitive> prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                        new Predicate <Primitive>(delegate(Primitive prim)
                    {
                        try
                        {
                            return(prim.ParentID == sav.LocalID);
                        }
                        catch { return(false); }
                    }));

                    this.BeginInvoke(new MethodInvoker(delegate()
                    {
                        lbxPrims.BeginUpdate();
                        lbxPrims.Items.Clear();

                        foreach (Primitive prim in prims)
                        {
                            try
                            {
                                AttachmentsListItem item = new AttachmentsListItem(prim, client, lbxPrims);

                                if (!listItems.ContainsKey(prim.LocalID))
                                {
                                    listItems.Add(prim.LocalID, item);

                                    item.PropertiesReceived += new EventHandler(item_PropertiesReceived);
                                    item.RequestProperties();
                                }
                            }
                            catch
                            {
                                ;
                            }
                        }

                        lbxPrims.EndUpdate();
                        lbxPrims.Visible = true;

                        pBar3.Visible = false;
                    }));
                }
                else
                {
                    //this.Close();
                    this.Dispose();
                }
            }
            catch {; }
        }