Example #1
0
        /// <summary>
        /// Toggle on and off subscription to
        /// automatic cloud updates.
        /// </summary>
        public static ExternalEvent ToggleSubscription(
            // EventHandler<IdlingEventArgs> handler
            IExternalEventHandler handler)
        {
            if (Subscribed)
            {
                Debug.Print("Unsubscribing...");
                //_uiapp.Idling -= _handler;
                //_handler = null;
                _event.Dispose();
                _event = null;

                _buttons[_subscribeButtonIndex].ItemText
                    = _subscribe;

                _timer.Stop();
                _timer.Report("Subscription timing");
                _timer = null;
                Debug.Print("Unsubscribed.");
            }
            else
            {
                Debug.Print("Subscribing...");
                //_uiapp.Idling += handler;
                //_handler = handler;
                _event = ExternalEvent.Create(handler);

                _buttons[_subscribeButtonIndex].ItemText
                    = _unsubscribe;

                _timer = new JtTimer("Subscription");
                Debug.Print("Subscribed.");
            }
            return(_event);
        }
        public static bool ToggleSubscription2(IExternalEventHandler handler)
        {
            if (Subscribed)
            {
                Util.Log("Unsubscribing...");

                _event.Dispose();
                _event = null;

                button1.ItemText = _subscribe;

                //_timer.Stop();
                //_timer.Report( "Subscription timing" );
                //_timer = null;

                Util.Log("Unsubscribed.");
            }
            else
            {
                Util.Log("Subscribing...");

                _event = ExternalEvent.Create(handler);

                button1.ItemText = _unsubscribe;

                //_timer = new JtTimer( "Subscription" );

                Util.Log("Subscribed.");
            }
            return(null != _event);
        }
Example #3
0
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            _exEvent.Dispose();
            _exEvent = null;
            _handler = null;

            base.OnFormClosed(e);
        }
Example #4
0
        public Result OnShutdown(UIControlledApplication a)
        {
            _thread.Abort();
            _thread = null;
            _event.Dispose();

            return(Result.Succeeded);
        }
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            f_ExEvent.Dispose();
            f_ExEvent = null;
            f_Handler = null;

            base.OnFormClosed(e);
        }
Example #6
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     m_ExEvent.Dispose();
     m_ExEvent         = null;
     m_Handler         = null;
     this.returnPath   = txtWordPath.Text;
     this.DialogResult = DialogResult.OK;
     base.OnFormClosing(e);
 }
Example #7
0
 private void FamiliesUpdate_Closed(object sender, EventArgs e)
 {
     // we own both the event and the handler
     // we should dispose it before we are closed
     m_ExEvent.Dispose();
     m_ExEvent = null;
     m_Handler = null;
     Close();
 }
Example #8
0
        private void cancelExternalEvent(object sender, EventArgs e)
        {
            m_ExEvent.Dispose();

            // re-create a new handler to handle request posting by the dialog
            m_Handler = new ExtOpenView();
            // external Event for the dialog to use (to post requests)
            m_ExEvent = ExternalEvent.Create(m_Handler);
        }
Example #9
0
 protected override void OnFormClosed(FormClosedEventArgs e)
 {
     // we own both the event and the handler
     // we should dispose it before we are closed
     Properties.Settings.Default.FileName = fileTextBox.Text;
     Properties.Settings.Default.Save();
     exEvent.Dispose();
     base.OnFormClosed(e);
 }
Example #10
0
        /// <summary>
        /// Form closed event handler
        /// </summary>
        /// <param name="e"></param>
        protected override void OnFormClosed(FormClosedEventArgs e)//重写窗体关闭事件
        {
            // we own both the event and the handler
            // we should dispose it before we are closed
            m_ExEvent.Dispose(); //释放所占内存空间
            m_ExEvent = null;    //重置外部事件为空
            m_Handler = null;    //重置请求处理器,访问父类的非私有成员

            // do not forget to call the base class
            base.OnFormClosed(e);//base关键词
        }
Example #11
0
        // Form closed event handler
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            // we own both the event and the handler
            // we should dispose it before we are closed
            m_ExEvent.Dispose();
            m_ExEvent = null;
            m_Handler = null;

            // do not forget to call the base class
            base.OnFormClosed(e);
        }
Example #12
0
        /// <summary>
        /// Modulo gestore eventi chiuso
        /// </summary>
        /// <param name="e"></param>
        protected override void OnFormClosed(FormClosedEventArgs e)
        {
            // possediamo sia l'evento che il gestore
            // dovremmo eliminarlo prima di chiudere la finestra

            m_ExEvent.Dispose();
            m_ExEvent = null;
            m_Handler = null;

            // non dimenticare di chiamare la classe base
            base.OnFormClosed(e);
        }
 public void Dispose()
 {
     // Revit handler stuff
     exEvent.Dispose();
     exEvent = null;
     handler = null;
     // This form is closed
     IsClosed = true;
     // Remove registered events
     form.Closed -= FormClosed;
     form.SeriesSelectedEvent -= SeriesSelected;
 }
Example #14
0
        /// <summary>
        /// Toggle on and off subscription to automatic
        /// BIM update from cloud. Return true when subscribed.
        /// </summary>
        public static bool ToggleSubscription()
        {
            if (null != _event)
            {
                Util.Log("Unsubscribing...");

                _socket.Disconnect();
                _socket = null;

                _bimUpdater = null;

                _event.Dispose();
                _event = null;

                Util.Log("Unsubscribed.");
            }
            else
            {
                Util.Log("Subscribing...");

                _bimUpdater = new BimUpdater();

                var options = new IO.Options()
                {
                    IgnoreServerCertificateValidation = true,
                    AutoConnect = true,
                    ForceNew    = true
                };

                _socket = IO.Socket(_url, options);

                _socket.On(Socket.EVENT_CONNECT, ()
                           => Util.Log("Connected"));

                _socket.On("transform", data
                           => Enqueue(data));

                _event = ExternalEvent.Create(_bimUpdater);

                Util.Log("Subscribed.");
            }
            return(null != _event);
        }
 protected override void OnFormClosed(FormClosedEventArgs e)
 {
     exEvent.Dispose();
     base.OnFormClosed(e);
 }
Example #16
0
 private void Window_Closed(object sender, EventArgs e)
 {
     m_event.Dispose();
     m_event   = null;
     m_handler = null;
 }
Example #17
0
 protected override void OnClosed(EventArgs e)
 {
     //外部事件资源需手动释放
     MyExternalEvent.Dispose();
     base.OnClosed(e);
 }