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)); }
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; } }
protected virtual void OnNodeEnabledChanged(NodeEnabledChangedEventArgs e) { if (!_externallySet) { EnabledChanged?.Invoke(this, e); } }
protected void OnEnabledChanged(EventArgs e) { if (EnabledChanged != null) { EnabledChanged.Invoke(this, e); } }
protected virtual void OnEnabledChanged() { EnabledChanged?.Invoke(this, new ClockEventArgs() { Clock = this }); }
/// <summary> /// Method called when enabled changes /// </summary> protected void OnEnabledChanged() { if (EnabledChanged != null) { EnabledChanged.Invoke(this, new EventArgs()); } SetDirty(); }
/// <summary> /// Enable busy indication /// </summary> public static void Enable() { if (string.IsNullOrEmpty(busyText)) { busyText = "Loading..."; } busyState = true; EnabledChanged?.Invoke(true, busyText); }
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)); }
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(); } } }
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(); } } }
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); }
protected virtual void OnEnabledChanged(EventArgs e) { EnabledChanged?.Invoke(this, new EventArgs()); }
private static void OnEnabledChanged(EventArgs e) => EnabledChanged?.Invoke(null, e);
private void OnEnabledChanged(EventArgs e) { EnabledChanged?.Invoke(this, e); }
/// <summary> /// Disable busy indication /// </summary> public static void Disable() { busyState = false; EnabledChanged?.Invoke(false, string.Empty); }
/// <summary> /// Update busy indication text /// </summary> /// <param name="message">New message to display</param> public static void UpdateText(string message) { EnabledChanged?.Invoke(busyState, message); }
internal void OnEnabledChanged(object sender, EventArgs e) { EnabledChanged?.Invoke(sender, e); }
private void EnabledChangedSignal_SignalRaised(ISignal sender, IList <object> args) { EnabledChanged?.Invoke(this, (bool)args[0]); }
public static void Change(bool enabled) { Enabled = enabled; EnabledChanged?.Invoke(null, EventArgs.Empty); }
protected internal virtual void OnEnabledChanged(EventArgs e) { EnabledChanged?.Invoke(this, e); }
internal void OnEnabledChanged(FileWatcher sender, EventArgs e) { EnabledChanged?.Invoke(sender, e); }