コード例 #1
0
        public void SetEnabled(bool enabled)
        {
            // Don't try to enable posing unless we are in gpose
            if (enabled && !GposeService.Instance.IsGpose)
            {
                throw new Exception("Attempt to enable posing outside of gpose");
            }

            if (this.isEnabled == enabled)
            {
                return;
            }

            this.isEnabled = enabled;

            this.FreezePositions = false;
            this.FreezeScale     = false;
            this.EnableParenting = true;
            this.FreezePhysics   = enabled;
            this.FreezeRotation  = enabled;

            EnabledChanged?.Invoke(enabled);

            this.RaisePropertyChanged(nameof(this.IsEnabled));
        }
コード例 #2
0
        private void OnOptionChanged(string name)
        {
            switch (name)
            {
            case "Enabled":
                EnabledChanged?.Invoke();
                break;

            case "Template":
                TemplateChanged?.Invoke();
                break;

            case "IgnoreBuiltinProjects":
                IgnoreBuiltinProjectsChanged?.Invoke();
                break;

            case "IgnoreSingleProject":
                IgnoreSingleProjectChanged?.Invoke();
                break;

            case "Logging":
                LoggingChanged?.Invoke();
                break;

            case "LoggingLevel":
                LoggingLevelChanged?.Invoke();
                break;

            default:
                Debug.Fail("unknown option '" + name + "'");
                break;
            }
        }
コード例 #3
0
 protected virtual void OnNodeEnabledChanged(NodeEnabledChangedEventArgs e)
 {
     if (!_externallySet)
     {
         EnabledChanged?.Invoke(this, e);
     }
 }
コード例 #4
0
ファイル: ControlBase.cs プロジェクト: IllyaTheHath/HSGomoku
 protected void OnEnabledChanged(EventArgs e)
 {
     if (EnabledChanged != null)
     {
         EnabledChanged.Invoke(this, e);
     }
 }
コード例 #5
0
ファイル: AlarmData.cs プロジェクト: silviubogan/timed-silver
 protected virtual void OnEnabledChanged()
 {
     EnabledChanged?.Invoke(this, new ClockEventArgs()
     {
         Clock = this
     });
 }
コード例 #6
0
ファイル: BaseNodeConfig.cs プロジェクト: wflk/canape
        /// <summary>
        /// Method called when enabled changes
        /// </summary>
        protected void OnEnabledChanged()
        {
            if (EnabledChanged != null)
            {
                EnabledChanged.Invoke(this, new EventArgs());
            }

            SetDirty();
        }
コード例 #7
0
        /// <summary>
        /// Enable busy indication
        /// </summary>
        public static void Enable()
        {
            if (string.IsNullOrEmpty(busyText))
            {
                busyText = "Loading...";
            }

            busyState = true;
            EnabledChanged?.Invoke(true, busyText);
        }
コード例 #8
0
        public void ChangeEnabled(bool newValue, IEnumerable <string> rawReasons, bool isUserAction)
        {
            var reasons  = rawReasons.ToList();
            var oldValue = Enabled;

            Enabled = newValue;

            _reasons.Clear();
            reasons.ForEach(x => _reasons.Add(x));

            ExecOrPostpone(() => EnabledChanged?.Invoke(this, oldValue, Enabled, reasons, isUserAction));
        }
コード例 #9
0
        protected virtual void OnEnabledChanged()
        {
            if (EnabledChanged != null)
            {
                EnabledChanged.Invoke(this, EventArgs.Empty);
            }

            if (!Enabled && ActiveControl == this)
            {
                ActiveControl.Deactivate();
            }

            if (Controls != null)
            {
                for (int I = 0; I < Controls.Count; I++)
                {
                    Controls[I].OnEnabledChanged();
                }
            }
        }
コード例 #10
0
ファイル: MirControl.cs プロジェクト: coolzoom/mir2-master
        protected virtual void OnEnabledChanged()
        {
            Redraw();

            if (EnabledChanged != null)
            {
                EnabledChanged.Invoke(this, EventArgs.Empty);
            }

            if (!Enabled && ActiveControl == this)
            {
                ActiveControl.Deactivate();
            }

            if (Controls != null)
            {
                foreach (MirControl control in Controls)
                {
                    control.OnEnabledChanged();
                }
            }
        }
コード例 #11
0
        private async Task PingTaskAsync()
        {
            var tokenTask = _token.WhenCanceledAsync();
            var sw        = new Stopwatch();
            var tskArray  = new Task[2];

            tskArray[0] = tokenTask;
            while (!_token.IsCancellationRequested)
            {
                try
                {
                    if (Storage is null)
                    {
                        Core.Log.Error("The cache pool item node: {0} doesn't have any storage associated", Name);
                        break;
                    }
                    var lastEnabled = Enabled;
                    try
                    {
                        sw.Restart();
                        var stoTask = Storage.IsEnabledAsync();
                        tskArray[1] = stoTask;
                        var rTask = await Task.WhenAny(tskArray).ConfigureAwait(false);

                        if (rTask == tokenTask)
                        {
                            break;
                        }
                        Enabled = stoTask.Result;
                        sw.Stop();
                        if (PingResponse == int.MaxValue)
                        {
                            PingResponse = 15;
                        }
                        PingResponse++;
                        PingConsecutiveFailure = 0;
                    }
                    catch (Exception ex)
                    {
                        Core.Log.Error("Cache Ping Error on {0}: {1}", Name, ex.InnerException?.Message ?? ex.Message);
                        Enabled = false;
                        if (PingFailure == int.MaxValue)
                        {
                            PingFailure = 15;
                        }
                        if (PingConsecutiveFailure == int.MaxValue)
                        {
                            PingConsecutiveFailure = 15;
                        }
                        PingFailure++;
                        PingConsecutiveFailure++;
                    }
                    PingTime = sw.Elapsed.TotalMilliseconds;

                    if (Enabled != lastEnabled)
                    {
                        EnabledChanged?.Invoke(this, Enabled);
                    }
                    Core.Log.LibVerbose("Cache Ping Task for Pool item node: {0} has Enabled = {1} with a PingTime = {2:0.0000}ms", Name, Enabled, PingTime);

                    var waitDelay = PingConsecutiveFailure < 15 ? PingDelayOnError : PingDelay;
                    if (Enabled == false)
                    {
                        Core.Log.Warning("{0} is Disabled due connection issues, Trying a new ping on: {1}ms", Name, waitDelay);
                    }
                    if (!lastEnabled && Enabled)
                    {
                        Core.Log.InfoBasic("{0} is connected.", Name);
                    }
                    await Task.Delay(waitDelay, _token).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                }
                catch (Exception ex)
                {
                    Core.Log.Write(ex);
                }
            }
            Core.Log.InfoDetail("Ping Task for Pool item node: {0} was terminated.", Name);
        }
コード例 #12
0
 protected virtual void OnEnabledChanged(EventArgs e)
 {
     EnabledChanged?.Invoke(this, new EventArgs());
 }
コード例 #13
0
 private static void OnEnabledChanged(EventArgs e) => EnabledChanged?.Invoke(null, e);
コード例 #14
0
 private void OnEnabledChanged(EventArgs e)
 {
     EnabledChanged?.Invoke(this, e);
 }
コード例 #15
0
 /// <summary>
 /// Disable busy indication
 /// </summary>
 public static void Disable()
 {
     busyState = false;
     EnabledChanged?.Invoke(false, string.Empty);
 }
コード例 #16
0
 /// <summary>
 /// Update busy indication text
 /// </summary>
 /// <param name="message">New message to display</param>
 public static void UpdateText(string message)
 {
     EnabledChanged?.Invoke(busyState, message);
 }
コード例 #17
0
 internal void OnEnabledChanged(object sender, EventArgs e)
 {
     EnabledChanged?.Invoke(sender, e);
 }
コード例 #18
0
 private void EnabledChangedSignal_SignalRaised(ISignal sender, IList <object> args)
 {
     EnabledChanged?.Invoke(this, (bool)args[0]);
 }
コード例 #19
0
 public static void Change(bool enabled)
 {
     Enabled = enabled;
     EnabledChanged?.Invoke(null, EventArgs.Empty);
 }
コード例 #20
0
 protected internal virtual void OnEnabledChanged(EventArgs e)
 {
     EnabledChanged?.Invoke(this, e);
 }
コード例 #21
0
 internal void OnEnabledChanged(FileWatcher sender, EventArgs e)
 {
     EnabledChanged?.Invoke(sender, e);
 }