예제 #1
0
        /// <summary>
        /// Deletes a subscription.
        /// </summary>
        public void Delete(Subscription subscription)
        {
            if (subscription == null)
            {
                throw new ArgumentNullException("subscription");
            }

            TreeNode node = FindNode(NodesTV.Nodes, subscription);

            if (node != null)
            {
                Clear(node.Nodes);
                node.Remove();
            }

            // close any dialog.
            SubscriptionDlg dialog = null;

            if (m_dialogs.TryGetValue(subscription, out dialog))
            {
                dialog.Close();
            }

            Session session = subscription.Session;

            session.RemoveSubscription(subscription);
            NodesTV.SelectedNode = FindNode(NodesTV.Nodes, session);
        }
예제 #2
0
        private void SubscriptionMonitorMI_Click(object sender, EventArgs e)
        {
            try
            {
                // get selected session.
                Subscription subscription = SelectedTag as Subscription;

                if (subscription == null)
                {
                    return;
                }

                // show form
                SubscriptionDlg dialog = null;

                if (!m_dialogs.TryGetValue(subscription, out dialog))
                {
                    dialog              = new SubscriptionDlg();
                    dialog.FormClosing += new FormClosingEventHandler(Subscription_FormClosing);
                    m_dialogs.Add(subscription, dialog);
                }

                dialog.Show(subscription);
            }
            catch (Exception exception)
            {
                GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
            }
        }
예제 #3
0
        /// <summary>
        /// Creates a new subscription.
        /// </summary>
        public Subscription CreateSubscription(Session session)
        {
            // create form.
            SubscriptionDlg dialog = new SubscriptionDlg();

            dialog.FormClosing += new FormClosingEventHandler(Subscription_FormClosing);

            // create subscription.
            Subscription subscription = dialog.New(session);

            if (subscription != null)
            {
                m_dialogs.Add(subscription, dialog);
                return(subscription);
            }

            return(null);
        }