public ntfPermissions(RadegastInstance instance, Simulator simulator, UUID taskID, UUID itemID, string objectName, string objectOwner, ScriptPermission questions)
            : base(NotificationType.PermissionsRequest)
        {
            InitializeComponent();

            this.instance = instance;
            this.simulator = simulator;
            this.taskID = taskID;
            this.itemID = itemID;
            this.objectName = objectName;
            this.objectOwner = objectOwner;
            this.questions = questions;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = "Object " + objectName + " owned by " + objectOwner + " is asking permission to " + questions.ToString() + ". Do you accept?";

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnMute);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
 private void Test_OnNotificationClosing(object sender, NotificationEventArgs e)
 {
     lock (_cogbotNotification)
     {
         WriteLine("You can no longer see the Notifation: " + e.Text);
         e.OnNotificationClosed -= Test_OnNotificationClosing;
         lock (LookingAt) LookingAt.Remove(e);
     }
 }
Exemple #3
0
        internal BlueMenu(PluginControl pc, NotificationEventArgs arg)
            : base(pc)
        {
            note = arg;

            // Watch for being closed by keyboard before we get to talk about it.
            note.OnNotificationClicked +=
                new Notification.NotificationClickedCallback(note_OnNotificationClicked);
            note.OnNotificationClosed +=
                new Notification.NotificationCallback(note_OnNotificationClosed);
        }
 private void Test_OnNotificationOpened(object sender, NotificationEventArgs e)
 {
     lock (_cogbotNotification)
     {
         lock (LookingAt) LookingAt.Add(e);
         WriteLine("Hooked up " + e.Text);
         // Hook me up
         e.OnNotificationClicked += Test_OnNotificationItemClicked;
         e.OnNotificationClosed += Test_OnNotificationClosing;
     }
 }
Exemple #5
0
        public ntfScriptDialog(RadegastInstance instance, string message, string objectName, UUID imageID, UUID objectID, string firstName, string lastName, int chatChannel, List<string> buttons)
            : base(NotificationType.ScriptDialog)
        {
            InitializeComponent();

            this.instance = instance;
            this.chatChannel = chatChannel;
            this.objectID = objectID;

            descBox.BackColor = instance.MainForm.NotificationBackground;
            descBox.Text = firstName + " " + lastName + "'s " + objectName + "\r\n\r\n" + message.Replace("\n", "\r\n") + "\r\n";

            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = descBox.Text;

            int btnWidth = 90;
            int btnHeight = 23;

            int i = 0;
            if (buttons.Count == 1 && buttons[0] == "!!llTextBox!!")
            {
                txtTextBox.Visible = true;
                sendBtn.Visible = true;
                args.Buttons.Add(ignoreBtn);
            }
            else
            {
                foreach (string label in buttons)
                {
                    Button b = new Button();
                    b.Size = new Size(btnWidth, btnHeight);
                    b.Text = label;
                    b.Location = new Point(5 + (i % 3) * (btnWidth + 5), btnsPanel.Size.Height - (i / 3) * (btnHeight + 5) - (btnHeight + 5));
                    b.Name = i.ToString();
                    b.Click += new EventHandler(b_Click);
                    b.UseVisualStyleBackColor = true;
                    b.Margin = new Padding(0, 3, 0, 3);
                    b.Padding = new Padding(0);
                    btnsPanel.Controls.Add(b);
                    args.Buttons.Add(b);
                    i++;
                }
            }
            // Fire off event
            args.Buttons.Add(ignoreBtn);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
        public ntfGeneric(RadegastInstance instance, string msg)
            : base(NotificationType.Generic)
        {
            InitializeComponent();

            this.instance = instance;
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Replace("\n", "\r\n");
            btnOk.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnOk);
            FireNotificationCallback(args);
        }
 private void Test_OnNotificationItemClicked(object sender, EventArgs e, NotificationEventArgs notice)
 {
     lock (_cogbotNotification)
     {
         notice.OnNotificationClicked -= Test_OnNotificationItemClicked;
         lock (LookingAt) if (!LookingAt.Contains(notice))
             {
                 WriteLine("Not sure you heard that we tracking " + notice.Text);
             }
         Button button = sender as Button;
         if (button == null)
         {
             WriteLine("You expected a button but got: " + sender + " for " + notice.Text);
             return;
         }
         WriteLine("You clicked: " + button.Text + " on Dialog" + notice.Text);
     }
 }
        public ntfGroupInvitation(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupInvitation)
        {
            InitializeComponent();

            this.instance = instance;
            this.msg = msg;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message.Replace("\n", "\r\n");
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnYes);
            FireNotificationCallback(args);
        }
        public ntfLoadURL(RadegastInstance instance, LoadUrlEventArgs e)
        {
            InitializeComponent();
            Disposed += new EventHandler(ntfLoadURL_Disposed);

            this.ev = e;
            this.instance = instance;

            instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);

            SetText();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = rtbText.Text;
            args.Buttons.Add(btnGoTo);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);
        }
        public ntfTeleport(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.Teleport)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg = msg;

            txtHead.BackColor = instance.MainForm.NotificationBackground;
            txtHead.Text = String.Format("{0} has offered to teleport you to their location.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message;
            btnTeleport.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnTeleport);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);
        }
Exemple #11
0
        public ntfSendLureRequest(RadegastInstance instance, UUID agentID)
            : base(NotificationType.SendLureRequest)
        {
            InitializeComponent();
            this.instance = instance;
            this.agentID = agentID;

            txtHead.BackColor = instance.MainForm.NotificationBackground;

            agentName = instance.Names.Get(agentID, true);
            txtHead.Text = String.Format("Request a teleport to {0}'s location with the following message:", agentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            btnRequest.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnRequest);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);
        }
        public ntfFriendshipOffer(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.FriendshipOffer)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg = msg;

            txtHead.BackColor = instance.MainForm.NotificationBackground;
            txtHead.Text = String.Format("{0} has offered you friendship.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Message;
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnIgnore);
            FireNotificationCallback(args);
        }
        public ntfGeneric(RadegastInstance instance, string msg)
            : base(NotificationType.Generic)
        {
            InitializeComponent();

            this.instance = instance;
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = msg.Replace("\n", "\r\n");
            if (msg.Length < 100)
            {
                txtMessage.ScrollBars = ScrollBars.None;
            }
            btnOk.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnOk);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
Exemple #14
0
        public ntfSendLureOffer(RadegastInstance instance, UUID agentID)
            : base(NotificationType.SendLureOffer)
        {
            InitializeComponent();
            this.instance = instance;
            this.agentID = agentID;

            txtHead.BackColor = instance.MainForm.NotificationBackground;

            agentName = instance.Names.Get(agentID, true);
            txtHead.Text = String.Format("Offer a teleport to {0} with the following message: ", agentName);
            txtMessage.Text = String.Format("Join me in {0}!", instance.Client.Network.CurrentSim.Name);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            btnOffer.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnOffer);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
        public ntfGroupNotice(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupNotice)
        {
            InitializeComponent();

            this.instance = instance;
            this.msg = msg;

            if (msg.BinaryBucket.Length > 18 && msg.BinaryBucket[0] != 0)
            {
                type = (AssetType)msg.BinaryBucket[1];
                destinationFolderID = client.Inventory.FindFolderForType(type);
                int icoIndx = InventoryConsole.GetItemImageIndex(type.ToString().ToLower());
                if (icoIndx >= 0)
                {
                    icnItem.Image = frmMain.ResourceImages.Images[icoIndx];
                    icnItem.Visible = true;
                }
                txtItemName.Text = Utils.BytesToString(msg.BinaryBucket, 18, msg.BinaryBucket.Length - 19);
                btnSave.Enabled = true;
                btnSave.Visible = icnItem.Visible = txtItemName.Visible = true;
            }

            string group = string.Empty;

            if (msg.BinaryBucket.Length >= 18)
            {
                UUID groupID = new UUID(msg.BinaryBucket, 2);

                if (instance.Groups.ContainsKey(groupID))
                {
                    group = instance.Groups[groupID].Name;
                    if (instance.Groups[groupID].InsigniaID != UUID.Zero)
                    {
                        imgGroup.Init(instance, instance.Groups[groupID].InsigniaID, string.Empty);
                    }
                }
            }

            string text = msg.Message.Replace("\n", System.Environment.NewLine);
            int pos = msg.Message.IndexOf('|');
            string title = msg.Message.Substring(0, pos);
            text = text.Remove(0, pos + 1);

            lblTitle.Text = title;
            lblSentBy.Text = string.Format("Sent by {0}, {1}", msg.FromAgentName, group);
            txtNotice.Text = text;

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = string.Format("{0}{1}{2}{3}{4}",
                lblTitle.Text, System.Environment.NewLine,
                lblSentBy.Text, System.Environment.NewLine,
                txtNotice.Text
                );
            if (btnSave.Visible == true)
            {
                args.Buttons.Add(btnSave);
                args.Text += string.Format("{0}Attachment: {1}", System.Environment.NewLine, txtItemName.Text);
            }
            args.Buttons.Add(btnOK);
            FireNotificationCallback(args);
        }
Exemple #16
0
 // TODO: we need a notification closed event to hook up to...
 private void OnNotificationClosed(object sender, NotificationEventArgs e)
 {
     CountdownTimer.Stop();
 }
 void Notification_OnNotificationDisplayed(object sender, NotificationEventArgs e)
 {
     // Example: auto accept friendship offers after 2 seconds of "thinking" ;)
     if (e.Type == NotificationType.FriendshipOffer)
     {
         Thread.Sleep(2000);
         // Execute on GUI thread
         Instance.MainForm.BeginInvoke(new MethodInvoker(() =>
             {
                 e.Buttons[0].PerformClick();
             }
             ));
     }
 }
Exemple #18
0
 void note_OnNotificationClicked(object sender, EventArgs e, NotificationEventArgs notice)
 {
     Button b = sender as Button;
     Talker.SayMore( b.Text, RadegastSpeech.Talk.BeepType.Good);
 }
        public ntfInventoryOffer(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.InventoryOffer)
        {
            InitializeComponent();
            Disposed += new EventHandler(ntfInventoryOffer_Disposed);

            this.instance = instance;
            this.msg = msg;

            instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);

            if (msg.BinaryBucket.Length > 0)
            {
                type = (AssetType)msg.BinaryBucket[0];
                destinationFolderID = client.Inventory.FindFolderForType(type);

                if (msg.BinaryBucket.Length == 17)
                {
                    objectID = new UUID(msg.BinaryBucket, 1);
                }

                if (msg.Dialog == InstantMessageDialog.InventoryOffered)
                {
                    txtInfo.Text = string.Format("{0} has offered you {1} \"{2}\".", msg.FromAgentName, type.ToString(), msg.Message);
                }
                else if (msg.Dialog == InstantMessageDialog.TaskInventoryOffered)
                {
                    txtInfo.Text = objectOfferText();
                }

                // Fire off event
                NotificationEventArgs args = new NotificationEventArgs(instance);
                args.Text = txtInfo.Text;
                args.Buttons.Add(btnAccept);
                args.Buttons.Add(btnDiscard);
                args.Buttons.Add(btnIgnore);
                FireNotificationCallback(args);
            }
            else
            {
                Logger.Log("Wrong format of the item offered", Helpers.LogLevel.Warning, client);
            }
        }
Exemple #20
0
 void note_OnNotificationClosed(object sender, NotificationEventArgs e)
 {
     note.OnNotificationClosed -=
         new Notification.NotificationCallback(note_OnNotificationClosed);
     note.OnNotificationClicked -=
         new Notification.NotificationClickedCallback(note_OnNotificationClicked);
     FinishInterruption();
 }
        private void ShowNotice()
        {
            if (group.ID == UUID.Zero) return;

            imgGroup.Init(instance, group.InsigniaID, string.Empty);
            lblSentBy.Text += ", " + group.Name;

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = string.Format("{0}{1}{2}{3}{4}",
                lblTitle.Text, System.Environment.NewLine,
                lblSentBy.Text, System.Environment.NewLine,
                txtNotice.Text
                );
            if (btnSave.Visible == true)
            {
                args.Buttons.Add(btnSave);
                args.Text += string.Format("{0}Attachment: {1}", System.Environment.NewLine, txtItemName.Text);
            }
            args.Buttons.Add(btnOK);
            FireNotificationCallback(args);
        }
Exemple #22
0
 private void Notificaton_Displayed(Notification notification, NotificationEventArgs e)
 {
     try
     {
         e.HookNotification(this);
         if (OnNotificationDisplayed != null)
             OnNotificationDisplayed(notification, e);
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
         OpenMetaverse.Logger.Log("Error executing notification displayed", OpenMetaverse.Helpers.LogLevel.Warning, ex);
     }
 }
Exemple #23
0
 protected void FireNotificationCallback(NotificationEventArgs e)
 {
     if (OnNotificationDisplayed == null) return;
     try
     {
         e.Type = this.Type;
         WorkPool.QueueUserWorkItem((object o) => Notificaton_Displayed(this, e));
     }
     catch (Exception ex)
     {
         Console.WriteLine("" + ex);
         OpenMetaverse.Logger.Log("Error executing notification callback", OpenMetaverse.Helpers.LogLevel.Warning, ex);
     }
 }
Exemple #24
0
 /// <summary>
 /// Event handler for new blue dialog boxes.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnNotificationDisplayed(object sender, NotificationEventArgs e)
 {
     AddInterruption(new Conversation.BlueMenu(control,e));
 }