2 // Radegast Metaverse Client
\r
3 // Copyright (c) 2009, Radegast Development Team
\r
4 // All rights reserved.
\r
6 // Redistribution and use in source and binary forms, with or without
\r
7 // modification, are permitted provided that the following conditions are met:
\r
9 // * Redistributions of source code must retain the above copyright notice,
\r
10 // this list of conditions and the following disclaimer.
\r
11 // * Redistributions in binary form must reproduce the above copyright
\r
12 // notice, this list of conditions and the following disclaimer in the
\r
13 // documentation and/or other materials provided with the distribution.
\r
14 // * Neither the name of the application "Radegast", nor the names of its
\r
15 // contributors may be used to endorse or promote products derived from
\r
16 // this software without specific prior written permission.
\r
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
21 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
\r
22 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
\r
23 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
\r
24 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
\r
25 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
\r
26 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
\r
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
32 using System.Collections.Generic;
\r
33 using System.ComponentModel;
\r
34 using System.Drawing;
\r
38 using System.Windows.Forms;
\r
39 using OpenMetaverse;
\r
40 using OpenMetaverse.Assets;
\r
44 public partial class Notecard : UserControl
\r
46 private RadegastInstance instance;
\r
47 private GridClient client { get { return instance.Client; } }
\r
48 private InventoryNotecard notecard;
\r
50 public Notecard(RadegastInstance instance, InventoryNotecard notecard)
\r
52 InitializeComponent();
\r
53 Disposed += new EventHandler(Notecard_Disposed);
\r
55 this.instance = instance;
\r
56 this.notecard = notecard;
\r
58 txtName.Text = notecard.Name;
\r
59 txtDesc.Text = notecard.Description;
\r
60 lblStatus.Text = "Downloading";
\r
63 client.Assets.OnAssetReceived += new AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);
\r
65 client.Assets.RequestInventoryAsset(notecard, true);
\r
68 void Notecard_Disposed(object sender, EventArgs e)
\r
70 client.Assets.OnAssetReceived += new AssetManager.AssetReceivedCallback(Assets_OnAssetReceived);
\r
73 void Assets_OnAssetReceived(AssetDownload transfer, Asset asset)
\r
77 BeginInvoke(new MethodInvoker(delegate()
\r
79 Assets_OnAssetReceived(transfer, asset);
\r
85 if (transfer.Success && asset.AssetType == AssetType.Notecard)
\r
87 lblStatus.Text = "Done";
\r
88 AssetNotecard n = (AssetNotecard)asset;
\r
90 rtbContent.Text = n.BodyText;
\r
94 lblStatus.Text = "Failed";
\r
98 private void btnRefresh_Click(object sender, EventArgs e)
\r
100 lblStatus.Text = "Downloading";
\r
101 client.Assets.RequestInventoryAsset(notecard, true);
\r