Exemple #1
0
 private void Update()
 {
     if (gameStarted)
     {
         onUpdateEvent?.Invoke();
         onSpeedUpdate?.Invoke(0.1f);
     }
 }
        void Button2Click(object sender, EventArgs e)
        {
            //listBox1.BeginUpdate();
            foreach (string s in listBox1.SelectedItems)
            {
                Globals.full_files_name_variables.Remove(s);
            }
            listBox1.DataSource = null;
            listBox1.DataSource = Globals.full_files_name_variables;
            update(Globals.full_files_name_variables.Count);
            textBox1.Text = "";

            UpdateEventHandler.Invoke(this, args);
        }
        void Button1Click(object sender, EventArgs e)
        {
            OpenFileDialog FD = new System.Windows.Forms.OpenFileDialog();

            FD.Multiselect = true;
            //  textBox1.Text = "";
            if (FD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (string s in FD.FileNames)
                {
                    //  TaskDialog.Show("Revit",s);
                    if (!Globals.full_files_name_variables.Contains(s))
                    {
                        Globals.full_files_name_variables.Add(s);
                    }
                }
            }
            listBox1.DataSource = null;
            listBox1.DataSource = Globals.full_files_name_variables;
            update(Globals.full_files_name_variables.Count);
            //UpdateEventArgs args = new UpdateEventArgs();
            UpdateEventHandler.Invoke(this, args);
        }
Exemple #4
0
        private void FixedUpdate()
        {
            if (gameStarted)
            {
                onUpdateEvent?.Invoke();

                if (Input.GetKey(KeyCode.Escape))
                {
                    IncrementSpaceCounter();
                }
                else if (Input.GetKeyUp(KeyCode.Escape))
                {
                    spaceHeldCount = 0;
                }
            }

            if (Input.GetKeyDown(KeyCode.Escape))
            {
                if (!GameStarted)
                {
                    onEscapeKeyPressed?.Invoke();
                }
            }
        }
        protected void raiseUpdate()
        {
            UpdateEventArgs args = new UpdateEventArgs();

            UpdateEventHandler?.Invoke(this, args);
        }
Exemple #6
0
        protected void update_main_form()                 //update gridview in main form
        {
            UpdateEventArgs args = new UpdateEventArgs(); //create new update event args object

            UpdateEventHandler.Invoke(this, args);
        }
Exemple #7
0
        protected void insert()
        {
            UpdateEventArgs args = new UpdateEventArgs();

            UpdateEventHandler.Invoke(this, args);
        }
        public void UpdateAndDelete()
        {
            UpdateHandler args = new UpdateHandler();

            UpdateEventHandler.Invoke(this, args);
        }
        private static void ChangedEvent(IntPtr userData, NotificationType type, IntPtr operationList, int num)
        {
            IntPtr operationType;
            IntPtr uniqueNumber;
            IntPtr notification;

            NotificationEventArgs       eventargs;
            NotificationDeleteEventArgs deleteargs;

            for (int i = 0; i < num; i++)
            {
                uniqueNumber  = IntPtr.Zero;
                operationType = IntPtr.Zero;
                notification  = IntPtr.Zero;

                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.Type, out operationType);
                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.UniqueNumber, out uniqueNumber);
                Interop.NotificationEventListener.GetOperationData(operationList + (i * Marshal.SizeOf <NotificationOperation>()), NotificationOperationDataType.Notification, out notification);

                if (operationType == IntPtr.Zero)
                {
                    Log.Error(LogTag, "unable to get operationType");
                    continue;
                }

                Log.Info(LogTag, "type : " + ((int)operationType).ToString());
                Log.Info(LogTag, "Add : " + (AddEventHandler == null ? "0" : AddEventHandler.GetInvocationList().Length.ToString()));
                Log.Info(LogTag, "update: " + (UpdateEventHandler == null ? "0" : UpdateEventHandler.GetInvocationList().Length.ToString()));
                Log.Info(LogTag, "delete : " + (DeleteEventHandler == null ? "0" : DeleteEventHandler.GetInvocationList().Length.ToString()));

                switch ((int)operationType)
                {
                case (int)NotificationOperationType.Insert:
                    if (notification != IntPtr.Zero)
                    {
                        try
                        {
                            eventargs = NotificationEventArgsBinder.BindObject(notification, false);
                            AddEventHandler?.Invoke(null, eventargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                case (int)NotificationOperationType.Update:
                    if (notification != IntPtr.Zero)
                    {
                        try
                        {
                            eventargs = NotificationEventArgsBinder.BindObject(notification, false);
                            UpdateEventHandler?.Invoke(null, eventargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                case (int)NotificationOperationType.Delete:
                    if (uniqueNumber != IntPtr.Zero)
                    {
                        try
                        {
                            deleteargs = NotificationDeleteEventArgsBinder.BindObject((int)uniqueNumber);
                            DeleteEventHandler?.Invoke(null, deleteargs);
                        }
                        catch (Exception e)
                        {
                            Log.Error(LogTag, e.Message);
                        }
                    }

                    break;

                default:
                    Log.Info(LogTag, "Event : " + (int)operationType);
                    break;
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// Add an event handler to the current statement and replays current statement
        /// results to the handler.
        /// <para/>
        /// The handler receives current statement results as the first call to the Update
        /// method of the event handler, passing in the newEvents parameter the current statement
        /// results as an array of zero or more events. Subsequent calls to the Update
        /// method of the event handler are statement results.
        /// <para/>
        /// Current statement results are the events returned by the GetEnumerator or
        /// GetSafeEnumerator methods.
        /// <para/>
        /// Delivery of current statement results in the first call is performed by the
        /// same thread invoking this method, while subsequent calls to the event handler may
        /// deliver statement results by the same or other threads.
        /// <para/>
        /// Note: this is a blocking call, delivery is atomic: Events occurring during
        /// iteration and delivery to the event handler are guaranteed to be delivered in a separate
        /// call and not lost. The event handler implementation should minimize long-running or
        /// blocking operations.
        /// <para/>
        /// Delivery is only atomic relative to the current statement. If the same event handler
        /// instance is registered with other statements it may receive other statement
        /// result s simultaneously.
        /// <para/>
        /// If a statement is not started an therefore does not have current results, the
        /// event handler receives a single invocation with a null listenerSet in newEvents.
        /// </summary>
        /// <param name="eventHandler">eventHandler that will receive events</param>
        public void AddEventHandlerWithReplay(UpdateEventHandler eventHandler)
        {
            if (eventHandler == null)
            {
                throw new ArgumentNullException("eventHandler", "Null listener reference supplied");
            }

            if (IsDisposed)
            {
                throw new IllegalStateException("Statement is in destroyed state");
            }

            using (StatementContext.DefaultAgentInstanceLock.AcquireReadLock())
            {
                _statementListenerSet.Events.Add(eventHandler);
                StatementContext.StatementResultService.SetUpdateListeners(_statementListenerSet, false);
                if (_statementLifecycleSvc != null)
                {
                    _statementLifecycleSvc.DispatchStatementLifecycleEvent(
                        new StatementLifecycleEvent(this,
                                                    StatementLifecycleEvent.LifecycleEventType.LISTENER_ADD,
                                                    eventHandler));
                }

                IEnumerator <EventBean> enumerator = GetEnumerator();
                var events = new List <EventBean>();
                while (enumerator.MoveNext())
                {
                    events.Add(enumerator.Current);
                }

                try
                {
                    if (events.IsEmpty())
                    {
                        eventHandler.Invoke(
                            this,
                            new UpdateEventArgs(
                                ServiceProvider,
                                this,
                                null,
                                null));
                    }
                    else
                    {
                        eventHandler.Invoke(
                            this,
                            new UpdateEventArgs(
                                ServiceProvider,
                                this,
                                events.ToArray(),
                                null));
                    }
                }
                catch (Exception exception)
                {
                    Log.Error(
                        "Unexpected exception invoking eventHandler for replay on event handler '{0}' : {1} : {2}",
                        eventHandler.GetType().Name,
                        exception.GetType().Name,
                        exception.Message);
                }
                finally
                {
                    if (StatementContext.EpStatementHandle.HasTableAccess)
                    {
                        StatementContext.TableExprEvaluatorContext.ReleaseAcquiredLocks();
                    }
                }
            }
        }
Exemple #11
0
        protected void RefreshStudentGridView()
        {
            UpdateEventArgs args = new UpdateEventArgs();

            UpdateEventHandler.Invoke(this, args);
        }