OSDN Git Service

Adjust to the introduction of FolderType ENUM in libomv
[radegast/radegast.git] / Radegast / GUI / Consoles / Assets / Notecard.cs
index 37ed318..5ec07c9 100644 (file)
@@ -1,6 +1,6 @@
 // 
 // Radegast Metaverse Client
-// Copyright (c) 2009-2010, Radegast Development Team
+// Copyright (c) 2009-2014, Radegast Development Team
 // All rights reserved.
 // 
 // Redistribution and use in source and binary forms, with or without
@@ -91,7 +91,7 @@ namespace Radegast
         {
             if (InvokeRequired)
             {
-                if (IsHandleCreated)
+                if (!instance.MonoRuntime || IsHandleCreated)
                     BeginInvoke(new MethodInvoker(() => Assets_OnAssetReceived(transfer, asset)));
                 return;
             }
@@ -147,6 +147,18 @@ namespace Radegast
                         titem.Name = item.UUID.ToString(); ;
                         titem.Tag = item;
                         titem.Click += new EventHandler(attachmentMenuItem_Click);
+
+                        var saveToInv = new ToolStripMenuItem("Save to inventory");
+                        saveToInv.Click += (object xsender, EventArgs xe) =>
+                            {
+                                client.Inventory.RequestCopyItemFromNotecard(UUID.Zero,
+                                    notecard.UUID,
+                                    client.Inventory.FindFolderForType(item.AssetType),
+                                    item.UUID,
+                                    Inventory_OnInventoryItemCopied);
+                            };
+
+                        titem.DropDownItems.Add(saveToInv);
                         tbtnAttachments.DropDownItems.Add(titem);
                     }
                 }
@@ -164,13 +176,19 @@ namespace Radegast
         {
             if (InvokeRequired)
             {
-                if (IsHandleCreated)
+                if (!instance.MonoRuntime || IsHandleCreated)
                     BeginInvoke(new MethodInvoker(() => Inventory_OnInventoryItemCopied(item)));
                 return;
             }
 
             if (null == item) return;
 
+            instance.TabConsole.DisplayNotificationInChat(
+                string.Format("{0} saved to inventory", item.Name),
+                ChatBufferTextStyle.Invisible);
+
+            tlblStatus.Text = "Saved";
+            
             if (item is InventoryNotecard)
             {
                 Notecard nc = new Notecard(instance, (InventoryNotecard)item);
@@ -321,7 +339,7 @@ namespace Radegast
         {
             if (InvokeRequired)
             {
-                if (IsHandleCreated)
+                if (!instance.MonoRuntime || IsHandleCreated)
                     BeginInvoke(new MethodInvoker(() => UpdateStatus(status)));
                 return;
             }
@@ -357,7 +375,7 @@ namespace Radegast
 
         private void btnDiscard_Click(object sender, EventArgs e)
         {
-            client.Inventory.MoveItem(notecard.UUID, client.Inventory.FindFolderForType(AssetType.TrashFolder), notecard.Name);
+            client.Inventory.MoveItem(notecard.UUID, client.Inventory.FindFolderForType(FolderType.Trash), notecard.Name);
             Retach();
         }
     }