/// </summary>\r
public RadegastMovement Movement { get { return movement; } }\r
\r
+ private InventoryClipboard inventoryClipboard;\r
/// <summary>\r
/// The last item that was cut or copied in the inventory, used for pasting\r
/// in a different place on the inventory, or other places like profile\r
/// that allow sending copied inventory items\r
/// </summary>\r
- public InventoryClipboard InventoryClipboard;\r
+ public InventoryClipboard InventoryClipboard\r
+ {\r
+ get { return inventoryClipboard; }\r
+ set\r
+ {\r
+ inventoryClipboard = value;\r
+ OnInventoryClipboardUpdated(EventArgs.Empty);\r
+ }\r
+ }\r
\r
#region Events\r
+\r
+ #region ClientChanged event\r
/// <summary>The event subscribers, null of no subscribers</summary>\r
private EventHandler<ClientChangedEventArgs> m_ClientChanged;\r
\r
add { lock (m_ClientChangedLock) { m_ClientChanged += value; } }\r
remove { lock (m_ClientChangedLock) { m_ClientChanged -= value; } }\r
}\r
+ #endregion ClientChanged event\r
+\r
+ #region InventoryClipboardUpdated event\r
+ /// <summary>The event subscribers, null of no subscribers</summary>\r
+ private EventHandler<EventArgs> m_InventoryClipboardUpdated;\r
+\r
+ ///<summary>Raises the InventoryClipboardUpdated Event</summary>\r
+ /// <param name="e">A EventArgs object containing\r
+ /// the old and the new client</param>\r
+ protected virtual void OnInventoryClipboardUpdated(EventArgs e)\r
+ {\r
+ EventHandler<EventArgs> handler = m_InventoryClipboardUpdated;\r
+ if (handler != null)\r
+ handler(this, e);\r
+ }\r
+\r
+ /// <summary>Thread sync lock object</summary>\r
+ private readonly object m_InventoryClipboardUpdatedLock = new object();\r
+\r
+ /// <summary>Raised when the GridClient object in the main Radegast instance is changed</summary>\r
+ public event EventHandler<EventArgs> InventoryClipboardUpdated\r
+ {\r
+ add { lock (m_InventoryClipboardUpdatedLock) { m_InventoryClipboardUpdated += value; } }\r
+ remove { lock (m_InventoryClipboardUpdatedLock) { m_InventoryClipboardUpdated -= value; } }\r
+ }\r
+ #endregion InventoryClipboardUpdated event\r
+\r
+\r
#endregion Events\r
\r
public RadegastInstance(GridClient client0)\r
this.label7 = new System.Windows.Forms.Label();\r
this.btnClose = new System.Windows.Forms.Button();\r
this.textBox1 = new System.Windows.Forms.TextBox();\r
+ this.btnGive = new System.Windows.Forms.Button();\r
this.tabProfile.SuspendLayout();\r
this.tpgProfile.SuspendLayout();\r
this.tpgWeb.SuspendLayout();\r
// \r
// tpgProfile\r
// \r
+ this.tpgProfile.Controls.Add(this.btnGive);\r
this.tpgProfile.Controls.Add(this.lvwGroups);\r
this.tpgProfile.Controls.Add(this.txtFullName);\r
this.tpgProfile.Controls.Add(this.anPartner);\r
// btnIM\r
// \r
this.btnIM.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.btnIM.Location = new System.Drawing.Point(312, 427);\r
+ this.btnIM.Location = new System.Drawing.Point(269, 427);\r
this.btnIM.Name = "btnIM";\r
- this.btnIM.Size = new System.Drawing.Size(96, 23);\r
+ this.btnIM.Size = new System.Drawing.Size(72, 23);\r
this.btnIM.TabIndex = 19;\r
this.btnIM.Text = "Start IM";\r
this.btnIM.UseVisualStyleBackColor = true;\r
// btnFriend\r
// \r
this.btnFriend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
- this.btnFriend.Location = new System.Drawing.Point(210, 427);\r
+ this.btnFriend.Location = new System.Drawing.Point(179, 427);\r
this.btnFriend.Name = "btnFriend";\r
- this.btnFriend.Size = new System.Drawing.Size(96, 23);\r
+ this.btnFriend.Size = new System.Drawing.Size(84, 23);\r
this.btnFriend.TabIndex = 18;\r
this.btnFriend.Text = "Add Friend";\r
this.btnFriend.UseVisualStyleBackColor = true;\r
this.btnPay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));\r
this.btnPay.Location = new System.Drawing.Point(108, 427);\r
this.btnPay.Name = "btnPay";\r
- this.btnPay.Size = new System.Drawing.Size(96, 23);\r
+ this.btnPay.Size = new System.Drawing.Size(65, 23);\r
this.btnPay.TabIndex = 15;\r
this.btnPay.Text = "Pay...";\r
this.btnPay.UseVisualStyleBackColor = true;\r
this.textBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.textBox1_DragDrop);\r
this.textBox1.DragEnter += new System.Windows.Forms.DragEventHandler(this.textBox1_DragEnter);\r
// \r
+ // btnGive\r
+ // \r
+ this.btnGive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+ this.btnGive.Enabled = false;\r
+ this.btnGive.Location = new System.Drawing.Point(347, 428);\r
+ this.btnGive.Name = "btnGive";\r
+ this.btnGive.Size = new System.Drawing.Size(107, 23);\r
+ this.btnGive.TabIndex = 22;\r
+ this.btnGive.Text = "&Give Inventory";\r
+ this.btnGive.UseVisualStyleBackColor = true;\r
+ this.btnGive.Click += new System.EventHandler(this.btnGive_Click);\r
+ // \r
// frmProfile\r
// \r
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
public ListViewNoFlicker lvwGroups;\r
private System.Windows.Forms.ColumnHeader clGroupName;\r
private System.Windows.Forms.ColumnHeader clGroupTitle;\r
+ public System.Windows.Forms.Button btnGive;\r
\r
}\r
}
\ No newline at end of file
btnFriend.Enabled = false;\r
}\r
\r
+ if (instance.InventoryClipboard != null)\r
+ {\r
+ btnGive.Enabled = true;\r
+ }\r
+\r
// Callbacks\r
client.Avatars.AvatarPropertiesReply += new EventHandler<AvatarPropertiesReplyEventArgs>(Avatars_AvatarPropertiesReply);\r
client.Avatars.AvatarPicksReply += new EventHandler<AvatarPicksReplyEventArgs>(Avatars_AvatarPicksReply);\r
client.Parcels.ParcelInfoReply += new EventHandler<ParcelInfoReplyEventArgs>(Parcels_ParcelInfoReply);\r
client.Avatars.AvatarGroupsReply += new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);\r
netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);\r
-\r
+ instance.InventoryClipboardUpdated += new EventHandler<EventArgs>(instance_InventoryClipboardUpdated);\r
InitializeProfile();\r
}\r
\r
client.Parcels.ParcelInfoReply -= new EventHandler<ParcelInfoReplyEventArgs>(Parcels_ParcelInfoReply);\r
client.Avatars.AvatarGroupsReply -= new EventHandler<AvatarGroupsReplyEventArgs>(Avatars_AvatarGroupsReply);\r
netcom.ClientDisconnected -= new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);\r
+ instance.InventoryClipboardUpdated -= new EventHandler<EventArgs>(instance_InventoryClipboardUpdated);\r
+ }\r
+\r
+ void instance_InventoryClipboardUpdated(object sender, EventArgs e)\r
+ {\r
+ btnGive.Enabled = instance.InventoryClipboard != null;\r
}\r
\r
void Avatars_AvatarGroupsReply(object sender, AvatarGroupsReplyEventArgs e)\r
}\r
gotPicks = true;\r
DisplayListOfPicks(e.Picks);\r
-\r
}\r
\r
private void DisplayListOfPicks(Dictionary<UUID, string> picks)\r
catch (Exception) { }\r
}\r
}\r
+\r
+ private void btnGive_Click(object sender, EventArgs e)\r
+ {\r
+ if (instance.InventoryClipboard == null) return;\r
+\r
+ InventoryBase inv = instance.InventoryClipboard.Item;\r
+\r
+ if (inv is InventoryItem)\r
+ {\r
+ InventoryItem item = inv as InventoryItem;\r
+ client.Inventory.GiveItem(item.UUID, item.Name, item.AssetType, agentID, true);\r
+ instance.TabConsole.DisplayNotificationInChat("Offered item " + item.Name + " to " + fullName + ".");\r
+ }\r
+ else if (inv is InventoryFolder)\r
+ {\r
+ InventoryFolder folder = inv as InventoryFolder;\r
+ client.Inventory.GiveFolder(folder.UUID, folder.Name, AssetType.Folder, agentID, true);\r
+ instance.TabConsole.DisplayNotificationInChat("Offered folder " + folder.Name + " to " + fullName + ".");\r
+ }\r
+\r
+ }\r
}\r
}
\ No newline at end of file