New() public method

Creates a new subscription.
public New ( Session session ) : Subscription
session Opc.Ua.Client.Session
return Subscription
Exemplo n.º 1
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);
                subscription.Handle = dialog;
                return(subscription);
            }

            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new subscription.
        /// </summary>
        public Subscription CreateSubscription(Session session)
        {
            // create form.
            SubscriptionDlg dialog = new SubscriptionDlg();

            dialog.Unloaded += Dialog_Unloaded;

            // create subscription.
            Subscription        subscription;
            Task <Subscription> t = Task.Run(() => dialog.New(session));

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

            return(null);
        }