Esempio n. 1
0
        void Avatars_AvatarPropertiesReply(object sender, AvatarPropertiesReplyEventArgs e)
        {
            if (e.AvatarID != agentID)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => Avatars_AvatarPropertiesReply(sender, e)));
                return;
            }
            Profile = e.Properties;

            FLImageID = e.Properties.FirstLifeImage;
            SLImageID = e.Properties.ProfileImage;

            if (agentID == client.Self.AgentID || SLImageID != UUID.Zero)
            {
                SLImageHandler pic = new SLImageHandler(instance, SLImageID, "");

                if (agentID == client.Self.AgentID)
                {
                    pic.AllowUpdateImage = true;
                    pic.ImageUpdated    += (usender, ue) =>
                    {
                        Profile.ProfileImage = ue.NewImageID;
                        pic.UpdateImage(ue.NewImageID);
                        client.Self.UpdateProfile(Profile);
                    };
                }

                pic.Dock     = DockStyle.Fill;
                pic.SizeMode = PictureBoxSizeMode.StretchImage;
                slPicPanel.Controls.Add(pic);
                slPicPanel.Show();
            }
            else
            {
                slPicPanel.Hide();
            }

            if (agentID == client.Self.AgentID || FLImageID != UUID.Zero)
            {
                SLImageHandler pic = new SLImageHandler(instance, FLImageID, "");
                pic.Dock = DockStyle.Fill;

                if (agentID == client.Self.AgentID)
                {
                    pic.AllowUpdateImage = true;
                    pic.ImageUpdated    += (usender, ue) =>
                    {
                        Profile.FirstLifeImage = ue.NewImageID;
                        pic.UpdateImage(ue.NewImageID);
                        client.Self.UpdateProfile(Profile);
                    };
                }

                rlPicPanel.Controls.Add(pic);
                rlPicPanel.Show();
            }
            else
            {
                rlPicPanel.Hide();
            }

            this.BeginInvoke(
                new OnSetProfileProperties(SetProfileProperties),
                new object[] { e.Properties });
        }
Esempio n. 2
0
        void Avatars_PickInfoReply(object sender, PickInfoReplyEventArgs e)
        {
            if (e.PickID != requestedPick)
            {
                return;
            }

            if (InvokeRequired)
            {
                BeginInvoke(new MethodInvoker(() => Avatars_PickInfoReply(sender, e)));
                return;
            }

            lock (pickCache)
            {
                if (!pickCache.ContainsKey(e.PickID))
                {
                    pickCache.Add(e.PickID, e.Pick);
                }
            }

            currentPick = e.Pick;

            if (pickPicturePanel.Controls.Count > 0)
            {
                pickPicturePanel.Controls[0].Dispose();
            }
            pickPicturePanel.Controls.Clear();

            if (agentID == client.Self.AgentID || e.Pick.SnapshotID != UUID.Zero)
            {
                SLImageHandler img = new SLImageHandler(instance, e.Pick.SnapshotID, string.Empty);
                img.Dock     = DockStyle.Fill;
                img.SizeMode = PictureBoxSizeMode.StretchImage;
                pickPicturePanel.Controls.Add(img);

                if (agentID == client.Self.AgentID)
                {
                    img.AllowUpdateImage = true;
                    ProfilePick p = e.Pick;
                    img.ImageUpdated += (psender, pe) =>
                    {
                        img.UpdateImage(pe.NewImageID);
                        p.SnapshotID = pe.NewImageID;
                        client.Self.PickInfoUpdate(p.PickID, p.TopPick, p.ParcelID, p.Name, p.PosGlobal, p.SnapshotID, p.Desc);
                    };
                }
            }

            pickTitle.Text = e.Pick.Name;

            pickDetail.Text = e.Pick.Desc;

            if (!parcelCache.ContainsKey(e.Pick.ParcelID))
            {
                pickLocation.Text = string.Format("Unkown parcel, {0} ({1}, {2}, {3})",
                                                  e.Pick.SimName,
                                                  ((int)e.Pick.PosGlobal.X) % 256,
                                                  ((int)e.Pick.PosGlobal.Y) % 256,
                                                  ((int)e.Pick.PosGlobal.Z) % 256
                                                  );
                client.Parcels.RequestParcelInfo(e.Pick.ParcelID);
            }
            else
            {
                Parcels_ParcelInfoReply(this, new ParcelInfoReplyEventArgs(parcelCache[e.Pick.ParcelID]));
            }
        }