Esempio n. 1
0
        private PubSubSubcribeForm setupPubSubForm()
        {
            string JID  = null;
            string node = null;

            if (tabControl1.SelectedTab.Name != null && tabControl1.SelectedTab.Name.Contains("/"))
            {
                string value = tabControl1.SelectedTab.Name;
                int    index = value.IndexOf("/");

                JID  = value.Substring(0, index);
                node = value.Substring(index + 1);
            }

            PubSubSubcribeForm fm = new PubSubSubcribeForm();

            fm.Text = "Delete PubSub";
            if (JID != null)
            {
                fm.JID = JID;
            }
            if (node != null)
            {
                fm.Node = node;
            }
            fm.DiscoManager = dm;

            return(fm);
        }
Esempio n. 2
0
        private void subscribeToPubSubToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PubSubSubcribeForm ps = new PubSubSubcribeForm();

            // this is a small race.  to do it right, I should call dm.BeginFindServiceWithFeature,
            // and modify that to call back on all of the found services.  The idea is that
            // by the the time the user has a chance to click on the menu item, the DiscoManager
            // will be populated.
            ps.DiscoManager = dm;
            if (ps.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            JID    jid  = ps.JID;
            string node = ps.Node;
            string text = string.Format("{0}/{1}", jid, node);

            TabPage tp = new TabPage(text);

            tp.Name = text;

            PubSubDisplay disp = new PubSubDisplay();

            disp.Node = psm.GetNode(jid, node, 10);
            tp.Controls.Add(disp);
            disp.Dock = DockStyle.Fill;

            tabControl1.TabPages.Add(tp);
            tabControl1.SelectedTab = tp;
        }
Esempio n. 3
0
        private void deletePubSubToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PubSubSubcribeForm fm = setupPubSubForm();

            if (fm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            JID    jid  = fm.JID;
            string node = fm.Node;

            psm.RemoveNode(jid, node,
                           delegate {
                MessageBox.Show("Remove Node unsuccessful.");
            });

            tabControl1.TabPages.RemoveByKey(string.Format("{0}/{1}", jid, node));
        }
Esempio n. 4
0
        private void subscribeToPubSubToolStripMenuItem_Click(object sender, EventArgs e)
        {
            PubSubSubcribeForm ps = new PubSubSubcribeForm();
            // this is a small race.  to do it right, I should call dm.BeginFindServiceWithFeature,
            // and modify that to call back on all of the found services.  The idea is that
            // by the the time the user has a chance to click on the menu item, the DiscoManager
            // will be populated.
            ps.DiscoManager = dm;
            if (ps.ShowDialog() != DialogResult.OK)
                return;
            JID jid = ps.JID;
            string node = ps.Node;
            string text = string.Format("{0}/{1}", jid, node);

            TabPage tp = new TabPage(text);
            tp.Name = text;

            PubSubDisplay disp = new PubSubDisplay();
            disp.Node = psm.GetNode(jid, node, 10);
            tp.Controls.Add(disp);
            disp.Dock = DockStyle.Fill;

            tabControl1.TabPages.Add(tp);
            tabControl1.SelectedTab = tp;
        }
Esempio n. 5
0
        private PubSubSubcribeForm setupPubSubForm()
        {
            string JID = null;
            string node = null;
            if (tabControl1.SelectedTab.Name != null && tabControl1.SelectedTab.Name.Contains("/"))
            {
                string value = tabControl1.SelectedTab.Name;
                int index = value.IndexOf("/");

                JID = value.Substring(0, index);
                node = value.Substring(index + 1);
            }

            PubSubSubcribeForm fm = new PubSubSubcribeForm();
            fm.Text = "Delete PubSub";
            if (JID != null) fm.JID = JID;
            if (node != null) fm.Node = node;
            fm.DiscoManager = dm;

            return fm;
        }