public void Unregister(Action <string> p, ObserverType b) { Watcher.EnableRaisingEvents = true; if (b == 0) { Make -= p; } }
public Observer(ObserverType type, Type subject = null, Type parent = null) { ObserverType = type; if (subject != null) Subject = subject.Name; if (parent != null) Parent = parent.Name; }
/// <summary> /// Unregister Method for deleting the changes occured in the directories /// </summary> /// <param name="notifyMe"></param> /// <param name="type"></param> public void Unregister(Action <string> notifyMe, ObserverType type) { if (type == ObserverType.Create) { createFile -= notifyMe; } else { deleteFile -= notifyMe; } }
public void Unregister(Action <string> notifyMe, ObserverType newevent) { if (newevent == ObserverType.Create) { Watcher.Created -= Watcher_Created; } else if (newevent == ObserverType.Delete) { Watcher.Deleted -= Watcher_Deleted; } }
public void Unregister(Action <string> action, ObserverType observer) { if (observer == ObserverType.Create) { CreatedActions -= action; } else { DeletedActions -= action; } }
public void Unregister(Action <string> notifyMe, ObserverType status) { if (status == ObserverType.Create) { MyAction -= notifyMe; } if (status == ObserverType.Delete) { MyAction -= notifyMe; } }
public void Unregister(Action <string> notifyMe, ObserverType observerType) { if (observerType == ObserverType.Create) { watch.Created -= new FileSystemEventHandler(OnCreated); } else { watch.Deleted -= new FileSystemEventHandler(OnDeleted); } this.Msg -= notifyMe; }
public void Register(Action <string> MsgTo, ObserverType observerType) { if (observerType == ObserverType.Create) { watch.Created += new FileSystemEventHandler(OnCreated); } else { watch.Deleted += new FileSystemEventHandler(OnDeleted); } this.Msg += MsgTo; }
private IObserverBuilder observerBuilderFrom(ObserverType observerType) { switch (observerType) { case ObserverType.AmountObserver: return(_subject.AmountObserverBuilders.FirstOrDefault()); case ObserverType.ContainerObserver: return(_subject.ContainerObserverBuilders.FirstOrDefault()); default: throw new ArgumentOutOfRangeException("observerType"); } }
public void Register(Action <string> p, ObserverType b) { if (b == 0) { Make += p; Watcher.Created += Watcher_Created; } if (b == ObserverType.Delete) { Remove += p; Watcher.Deleted += Watcher_Deleted; } }
private static IObserver GenerateObserver(ObserverType type, MediatorContext m) { return(type switch { ObserverType.Dummy => new DummyObserver() { MediatorContext = m }, ObserverType.Print => new PrintObserver() { MediatorContext = m }, ObserverType.Grpc => GenerateGrpcObserver(m), _ => throw new ArgumentException($"Unknown receiver type: {type}"), });
public void Select(ObserverType observerType) { var observer = observerBuilderFrom(observerType); if (observer == null) { _view.SetEditObserverBuilderView(null); return; } _editObserverPresenter = setUpEditObserverPresenter(observer); _view.SetEditObserverBuilderView(_editObserverPresenter.View); _editObserverPresenter.BuildingBlock = _subject; _editObserverPresenter.Edit(observer); }
private void OnComplete(ObserverType type) { App.AddLog($"{MethodBase.GetCurrentMethod().Name} {Name} {Helper.GetEnumName(type)}"); if (type == ObserverType.State) { IsSubscribeStatus = false; } else if (type == ObserverType.ConnectWait) { IsSubscribeConnetionWait = false; _ConnectWaitDisposable?.Dispose(); _ConnectWaitDisposable = default; } }
public void NotifyObservers(ObserverType observerType) { if (observerType == ObserverType.Availability) { foreach (IProductObserver observer in _observers) { observer.UpdateAvailability(_availability); } } else { foreach (IProductObserver observer in _observers) { observer.UpdatePromotion(_productPrice); } } }
public static IObserver CreateObserver(ObserverType type, MediatorContext m) { var r = GenerateObserver(type, m); m.StateChanged += r.StateChanged; m.Completed += r.Completed; m.ConnectionsChanged += r.ConnectionsChanged; m.OnEarthquake += r.OnEarthquake; m.OnTsunami += r.OnTsunami; m.OnAreapeers += r.OnAreapeers; m.OnEEWTest += r.OnEEWTest; m.OnUserquake += r.OnUserquake; m.OnNewUserquakeEvaluation += r.OnNewUserquakeEvaluation; m.OnUpdateUserquakeEvaluation += r.OnUpdateUserquakeEvaluation; return(r); }
public Observer(ObserverType type, Type subject = null, Type parent = null) { ObserverType = type; if (subject != null) { Subject = subject.Name; } if (parent != null) { Parent = parent.Name; } TimeWindow = new TimeSpan(0, 15, 0); // 15 minutes. BroadcastOnlyRecent = true; Throttle = null; NextAllowedBroadcast = null; }
/// <summary> /// Creates an observer-based gradient and curvature estimator with the default discretisation used in VRProEP /// (iteration domain: ts = 1), with the given dither frequency and observer gain. /// </summary> /// <param name="wo">The dither frequency in rad/s.</param> /// <param name="L">The observer gain vector (in R^3)</param> /// <param name="type">The type of observer.</param> /// <param name="a">The amplitude of dither frequency used for excitation.</param> public GradientHessianObserver(float[] wo, float[] L, ObserverType type, float a = 1.0f) { this.type = type; this.a = a; SetSamplingTime(1.0f); // Set parameters and do checks. SetEstimatorFrequencies(wo); SetGains(L); // Add common dithers dithers.Add(new SinusoidalDither(1.0f, wo[0], 0.0f)); dithers.Add(new SinusoidalDither(1.0f, wo[0], Mathf.PI / 2.0f)); // Handle type init switch (this.type) { // // Gradient // case ObserverType.Gradient: // Estimates duHat = new float[1] { 0.0f }; // Observer states xHat = new float[3] { 0.0f, 0.0f, 0.0f }; // Observer C gain C = new float[3] { 1.0f, 1.0f, 0.0f }; // Observer A matrix A = new float[3][]; A[0] = new float[3] { 1.0f, 0.0f, 0.0f }; A[1] = new float[3] { 0.0f, 0.5403f, 0.8415f }; A[2] = new float[3] { 0.0f, -0.8415f, 0.5403f }; break; // // Gradient-Hessian // case ObserverType.GradientHessian: // Estimates duHat = new float[2] { 0.0f, 0.0f }; // Observer states xHat = new float[5] { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; // Observer C gain C = new float[5] { 1.0f, 1.0f, 0.0f, 0.0f, -0.25f }; // Observer A matrix A = new float[5][]; A[0] = new float[5] { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f }; A[1] = new float[5] { 0.0f, 0.5403f, 0.8415f, 0.0f, 0.0f }; A[2] = new float[5] { 0.0f, -0.8415f, 0.5403f, 0.0f, 0.0f }; A[3] = new float[5] { 0.0f, 0.0f, 0.0f, -0.4161f, 0.9093f }; A[4] = new float[5] { 0.0f, 0.0f, 0.0f, -0.9093f, -0.4161f }; // Add additional dithers. dithers.Add(new SinusoidalDither(1.0f, wo[1], 0.0f)); dithers.Add(new SinusoidalDither(1.0f, wo[1], Mathf.PI / 2.0f)); break; default: throw new System.Exception("Invalid observer type."); } }
//public ConditionalObserverBase(Type subject = null, Type parent = null, // ObserverTiming timing = ObserverTiming.edge) // : this(ObserverType.Generic, subject, parent, timing) //{ //} public ConditionalObserverBase(ObserverType type, Type subject = null, Type parent = null, ObserverTiming timing = ObserverTiming.edge) : base(type, subject, parent) { Timing = timing; }
public ConditionalObserverBase(ObserverType type, ObserverTiming timing = ObserverTiming.edge) : base(type) { Timing = timing; }
public static double MaximumTimeForInterpolation = 5.0 * 60.0; // in seconds, five minutes public SmoothObserverBase(ObserverType type, double interpolationRate=1.0) : base(type) { InterpolationRate = interpolationRate; }
public SmoothObserverBase(ObserverType type, Type subject = null, Type parent = null, double interpolationRate=1.0) : base(type, subject, parent) { InterpolationRate = interpolationRate; }
//public ConditionalObserverBase(Type subject = null, Type parent = null, // ObserverTiming timing = ObserverTiming.edge) // : this(ObserverType.Generic, subject, parent, timing) //{ //} public ConditionalObserverBase(ObserverType type, Type subject = null, Type parent = null, ObserverTiming timing = ObserverTiming.edge) : base(type, subject, parent) { Timing = timing; }
public ConditionalObserverBase(ObserverType type, ObserverTiming timing = ObserverTiming.edge) : base(type) { Timing = timing; }
public SmoothObserverBase(ObserverType type, Type subject = null, Type parent = null, double interpolationRate = 1.0) : base(type, subject, parent) { InterpolationRate = interpolationRate; }
public static double MaximumTimeForInterpolation = 5.0 * 60.0; // in seconds, five minutes public SmoothObserverBase(ObserverType type, double interpolationRate = 1.0) : base(type) { InterpolationRate = interpolationRate; }
public Observer(ObserverType type, Type subject = null, Type parent = null) { ObserverType = type; if (subject != null) Subject = subject.Name; if (parent != null) Parent = parent.Name; TimeWindow = new TimeSpan(0, 15, 0); // 15 minutes. BroadcastOnlyRecent = true; Throttle = null; NextAllowedBroadcast = null; }