示例#1
0
 private void activate(bool active)
 {
     if (active != this.activated)
     {
         this.activated = active;
         if (activated)
         {
             if (Activated != null)
             {
                 Activated.Invoke(this);
             }
         }
         else
         {
             if (Deactivated != null)
             {
                 Deactivated.Invoke(this);
             }
         }
         if (FocusChanged != null)
         {
             FocusChanged.Invoke(this);
         }
     }
 }
示例#2
0
 private void _checkForConfigFileUpdate()
 {
     if( ( Deactivated.wasAnySubFieldModified() || IPFilterRegex.wasAnySubFieldModified() || UserCount.wasAnySubFieldModified() ) && _CompanyIDDefined() )
     {
         UpdateConfigFile = true;
     }
 }
        /// <summary>
        /// Calls the <see cref="IActiveElement.Deactivate"/> method on all registered active elements.
        /// </summary>
        /// <param name="e">The EventArgs to use</param>
        public void Deactivate(SnippetEventArgs e)
        {
            if (_currentStatus == Status.Deactivated || _currentStatus == Status.RaisingDeactivated)
            {
                return;
            }
            if (_currentStatus != Status.Interactive)
            {
                throw new InvalidOperationException("Cannot call Deactivate() until RaiseInsertionCompleted() has finished.");
            }
            if (e == null)
            {
                e = new SnippetEventArgs(DeactivateReason.Unknown);
            }

            TextDocumentWeakEventManager.UpdateFinished.RemoveHandler(Document, OnUpdateFinished);
            _currentStatus = Status.RaisingDeactivated;
            TextArea.PopStackedInputHandler(_myInputHandler);
            foreach (IActiveElement element in _registeredElements)
            {
                element.Deactivate(e);
            }
            Deactivated?.Invoke(this, e);
            _currentStatus = Status.Deactivated;
        }
示例#4
0
 public virtual void Deactivate()
 {
     _activeNode?.SetActive(false);
     _inactiveNode?.SetActive(true);
     State = ZanzoObjectState.Inactive;
     Deactivated?.Invoke(this);
 }
示例#5
0
        private static void WindowChecker()
        {
            while (true)
            {
                WindowInfo foregroundWnd = WindowInfo.GetActiveWindowInfo();
                //Console.WriteLine(foregroundWnd.processFileName);

                if (active)
                {
                    if (autoDisableProcs.Contains(foregroundWnd.processFileName))
                    {
                        active = false;
                        Deactivated?.Invoke();
                    }
                }
                else
                {
                    if (autoEnableProcs.Contains(foregroundWnd.processFileName))
                    {
                        active = true;
                        Activated?.Invoke();
                        SetForegroundWindow(foregroundWnd.hwnd);
                    }
                }
                Thread.Sleep(50);
            }
        }
    public void StopInteraction()
    {
        plateMesh.materials[0].DisableKeyword("_EMISSION");
        InvertAllLights();

        wasPressed = false;
        Deactivated.Invoke();
    }
示例#7
0
 public void EnterBackground()
 {
     _isActive = false;
     if (Deactivated != null)
     {
         Deactivated.Invoke(this, null);
     }
 }
示例#8
0
        public async Task Handle(Deactivated e, IHandleContext ctx)
        {
            var get = await _uow.Get <presentationUsers.Models.AU_UserResponse>(e.UserAuthId);

            get.LockedDate = DateTime.UtcNow;

            _uow.Save(get);
            ctx.UpdateAsync(get, ChangeType.CHANGE);
        }
示例#9
0
        protected virtual void OnDeactivated(object sender, EventArgs args)
        {
            UpdateClock.MaximumUpdateHz = InactiveUpdateHz;

            UpdateScheduler.Add(delegate
            {
                Deactivated?.Invoke(this, EventArgs.Empty);
            });
        }
示例#10
0
        protected override void OnBeforePause()
        {
            if (Activated)
            {
                logger.Debug("Auto-deactivation.");
                Deactivated?.Invoke();
            }

            Activated = false;
        }
示例#11
0
 public virtual void Deactivate()
 {
     if (IsActive)
     {
         Deactivated?.Invoke(this);
         _isActive                 = false;
         _actHook.MouseActions    -= ActHookOnMouseActions;
         _actHook.OnMouseActivity -= ActHookOnOnMouseActivity;
         _actHook.KeyDown         -= ActHookOnKeyDown;
     }
 }
示例#12
0
 void Window_FocusedChanged(object sender, EventArgs e)
 {
     if (Window.Focused)
     {
         Activated?.Invoke(this, e);
     }
     else
     {
         Deactivated?.Invoke(this, e);
     }
 }
示例#13
0
 protected void OnActiveChanged()
 {
     if (this.active)
     {
         Activated?.Invoke(this, new EventArgs());
     }
     else
     {
         Deactivated?.Invoke(this, new EventArgs());
     }
 }
示例#14
0
 public void DeactivatedTest()
 {
     // get test
     Assert.That(Deactivated.Deleted.ToString(), Is.EqualTo("deleted"));
     Assert.That(Deactivated.Banned.ToString(), Is.EqualTo("banned"));
     Assert.That(Deactivated.Activated.ToString(), Is.EqualTo("activated"));
     // parse test
     Assert.That(Deactivated.FromJsonString("deleted"), Is.EqualTo(Deactivated.Deleted));
     Assert.That(Deactivated.FromJsonString("banned"), Is.EqualTo(Deactivated.Banned));
     Assert.That(Deactivated.FromJsonString("activated"), Is.EqualTo(Deactivated.Activated));
 }
示例#15
0
        public void Handle(Deactivated e)
        {
            using (var session = _store.OpenSession())
            {
                var get = session.Load <Responses.Get>(e.CurrencyId);
                get.Activated = false;

                session.SaveChanges();

                _manager.Publish(get);
            }
        }
示例#16
0
        public void DeactivatedTest()
        {
            // get test
            Assert.That(actual: Deactivated.Deleted.ToString(), expression: Is.EqualTo(expected: "deleted"));
            Assert.That(actual: Deactivated.Banned.ToString(), expression: Is.EqualTo(expected: "banned"));
            Assert.That(actual: Deactivated.Activated.ToString(), expression: Is.EqualTo(expected: "activated"));

            // parse test
            Assert.That(actual: Deactivated.FromJsonString(response: "deleted"), expression: Is.EqualTo(expected: Deactivated.Deleted));
            Assert.That(actual: Deactivated.FromJsonString(response: "banned"), expression: Is.EqualTo(expected: Deactivated.Banned));
            Assert.That(actual: Deactivated.FromJsonString(response: "activated"), expression: Is.EqualTo(expected: Deactivated.Activated));
        }
示例#17
0
        protected Window(IWindowBaseImpl window)
        {
            this.window = window;
            adapter     = new ControlAdapter(this);

            window.Input       = OnInput;
            window.Paint       = OnPaint;
            window.Resized     = OnResize;
            window.Closed      = () => Closed?.Invoke(this, EventArgs.Empty);
            window.Deactivated = () => Deactivated?.Invoke(this, EventArgs.Empty);
            window.Resize(new Size(DefaultSize.Width, DefaultSize.Height));
        }
示例#18
0
        private void setActive(bool isActive)
        {
            threads.ForEach(t => t.IsActive = isActive);

            if (isActive)
            {
                Activated?.Invoke();
            }
            else
            {
                Deactivated?.Invoke();
            }
        }
示例#19
0
        public void Handle(Deactivated e)
        {
            _elastic.Update <Responses.Index, Object>(x => x
                                                      .Id(e.CurrencyId)
                                                      .Doc(new { Activated = false })
                                                      .RetryOnConflict(3)
                                                      .Refresh()
                                                      );

            var index = _elastic.Get <Responses.Index>(e.CurrencyId);

            _manager.Publish(index.Source);
        }
示例#20
0
        /// <summary>
        /// Called when the app is about to be shoved in to the background
        /// </summary>
        public virtual void OnDeactivated()
        {
            _activatedFired = false;
            var cco = Navigation.CurrentContentObject as XViewModel;

            if (cco != null)
            {
                cco.OnDeactivated();
            }

            XMessenger.Default.Send(new ApplicationDeactivatedMessage());
            Deactivated?.Invoke(this, EventArgs.Empty);
        }
示例#21
0
 public void EnterBackground()
 {
     if (_isActive)
     {
         _isActive = false;
         view.Pause();
         Accelerometer.Pause();
         if (Deactivated != null)
         {
             Deactivated.Invoke(this, null);
         }
     }
 }
示例#22
0
        public IEnumerable <SearchQueryCriteria <Client> > GetClientCriterias()
        {
            yield return(Q.MapString(s => new SearchQueryCriteria <Client>(x => x.Email.Contains(s) || x.PhoneNumber.Contains(s) || x.Name.Contains(s))));

            yield return(Deactivated.MapNullable(d => new SearchQueryCriteria <Client>(x => x.DeActivated == d)));

            yield return(RegistrationDate.GetSearchCriteriaFromGenericRange <Client, DateTime>(x => x.CreatedOn));

            if (SearchSex)
            {
                yield return(new SearchQueryCriteria <Client>(x => x.Sex == Sex));
            }
        }
示例#23
0
    void Update()
    {
        var axis = Input.GetAxis(_gripButton);

        if (!Active && axis >= ACTIVATION_THRESHOLD)
        {
            Active = true;
            Activated?.Invoke(this);
        }
        else if (Active && axis <= DEACTIVATION_THRESHOLD)
        {
            Active = false;
            Deactivated.Invoke(this);
        }
    }
示例#24
0
        private void setActive(bool isActive)
        {
            threads.ForEach(t => t.IsActive = isActive);

            activeGCMode.TriggerChange();

            if (isActive)
            {
                Activated?.Invoke();
            }
            else
            {
                Deactivated?.Invoke();
            }
        }
示例#25
0
        /// <summary>
        /// Initializes a new instance of the Window class.
        /// </summary>
        internal WindowBase(IWindowBaseImpl window)
        {
            this.window = window;
            adapter     = new ControlAdapter(this);

            window.Input       = OnInput;
            window.Paint       = DoPaint;
            window.Resized     = OnResize;
            window.Closed      = () => Closed?.Invoke(this, EventArgs.Empty);
            window.Deactivated = () => {
                // If we're clicking off the form, deactivate any active menus
                Application.ActiveMenu?.Deactivate();
                Deactivated?.Invoke(this, EventArgs.Empty);
            };
        }
示例#26
0
        private void OnDeactivate(RevaleeRequestException exception)
        {
            Trace.TraceError("A Revalee recurring task could not be scheduled.");

            if (_CurrentState.TransitionToInactive())
            {
                Task.Factory.StartNew(() =>
                {
                    Thread.Sleep(2000);
                    this.Start();
                });

                Deactivated.Invoke(this, new DeactivationEventArgs(exception));
            }
        }
示例#27
0
 public void Deactivate(bool close)
 {
     AttemptingDeactivation.Raise(this, new DeactivationEventArgs {
         WasClosed = close
     });
     if (_disposeToken != null && close)
     {
         _disposeToken.Dispose();
     }
     IsActive = false;
     OnDeactivate(close);
     Deactivated.Raise(this, new DeactivationEventArgs {
         WasClosed = close
     });
 }
示例#28
0
        private bool IsDeactivation(KeyModifier modifier)
        {
            var isDeactivation = Activated && !modifier.HasFlag(KeyModifier.Alt);

            if (isDeactivation)
            {
                Activated = false;
                LeftShift = false;
                Tab       = false;

                logger.Debug("Detected deactivation sequence.");
                Deactivated?.Invoke();
            }

            return(isDeactivation);
        }
示例#29
0
        protected virtual unsafe bool OnStateChanged(IntPtr w, IntPtr pev, IntPtr userData)
        {
            var ev = (GdkEventWindowState *)pev;

            if (ev->changed_mask.HasFlag(GdkWindowState.Focused))
            {
                if (ev->new_window_state.HasFlag(GdkWindowState.Focused))
                {
                    Activated?.Invoke();
                }
                else
                {
                    Deactivated?.Invoke();
                }
            }
            return(true);
        }
示例#30
0
        public bool Equals(Garage other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   State.Equals(other.State) &&
                   Field02h.Equals(other.Field02h) &&
                   ClosingWithoutTargetVehicle.Equals(other.ClosingWithoutTargetVehicle) &&
                   Deactivated.Equals(other.Deactivated) &&
                   ResprayHappened.Equals(other.ResprayHappened) &&
                   TargetModelIndex.Equals(other.TargetModelIndex) &&
                   Door1Pointer.Equals(other.Door1Pointer) &&
                   Door2Pointer.Equals(other.Door2Pointer) &&
                   Door1Handle.Equals(other.Door1Handle) &&
                   Door2Handle.Equals(other.Door2Handle) &&
                   IsDoor1Dummy.Equals(other.IsDoor1Dummy) &&
                   IsDoor2Dummy.Equals(other.IsDoor2Dummy) &&
                   RecreateDoorOnNextRefresh.Equals(other.RecreateDoorOnNextRefresh) &&
                   RotatingDoor.Equals(other.RotatingDoor) &&
                   CameraFollowsPlayer.Equals(other.CameraFollowsPlayer) &&
                   X1.Equals(other.X1) &&
                   X2.Equals(other.X2) &&
                   Y1.Equals(other.Y1) &&
                   Y2.Equals(other.Y2) &&
                   Z1.Equals(other.Z1) &&
                   Z2.Equals(other.Z2) &&
                   DoorOpenOffset.Equals(other.DoorOpenOffset) &&
                   DoorOpenMax.Equals(other.DoorOpenMax) &&
                   Door1X.Equals(other.Door1X) &&
                   Door1Y.Equals(other.Door1Y) &&
                   Door2X.Equals(other.Door2X) &&
                   Door2Y.Equals(other.Door2Y) &&
                   Door1Z.Equals(other.Door1Z) &&
                   Door2Z.Equals(other.Door2Z) &&
                   Timer.Equals(other.Timer) &&
                   CollectedCarsState.Equals(other.CollectedCarsState) &&
                   TargetCarPointer.Equals(other.TargetCarPointer) &&
                   Field96h.Equals(other.Field96h) &&
                   StoredCar.Equals(other.StoredCar));
        }