/// <summary> /// Notify any listeners that the property value has changed. /// </summary> /// <param name="propertyName">The property name.</param> public void RaisePropertyChanged(string propertyName, ref PropertyEventDispatcher eventDispatcher) { if (string.IsNullOrEmpty(propertyName)) { throw new ArgumentException("PropertyName cannot be empty or null."); } PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { PropertyChangedEventArgs args; if (!_argumentInstances.TryGetValue(propertyName, out args)) { args = new PropertyChangedEventArgs(propertyName); _argumentInstances[propertyName] = args; } // Fire the change event. The smart dispatcher will directly // invoke the handler if this change happened on the UI thread, // otherwise it is sent to the proper dispatcher. eventDispatcher.BeginInvoke(delegate { handler(this, args); }); } }
public IgRestApiClient(string environment, string accountId, PropertyEventDispatcher eventDispatcher) { _eventDispatcher = eventDispatcher; _igRestService = new IgRestService(eventDispatcher, () => AuthenticateAsync().GetAwaiter().GetResult(), () => RefreshToken().GetAwaiter().GetResult(), environment); _accountId = accountId; }
public IgRestService(PropertyEventDispatcher eventDispatcher, Func <bool> funcAuthenticate, Func <bool> funcRefreshToken, string env = "demo") { this.eventDispatcher = eventDispatcher; _baseUrl = $"https://{(env == "live" ? "" : env + "-")}api.ig.com"; // This is not a very good solution, but it saves a lot of time to rework to authentication v3 _funcAuthenticate = funcAuthenticate; _funcRefreshToken = funcRefreshToken; }
public IgRestService(PropertyEventDispatcher eventDispatcher, string env = "demo") { this.eventDispatcher = eventDispatcher; _baseUrl = String.Format("https://{0}api.ig.com", env == "live" ? "" : env + "-"); }
public IgRestApiClient(string environment, PropertyEventDispatcher eventDispatcher) { this.eventDispatcher = eventDispatcher; this._igRestService = new IgRestService(eventDispatcher, environment); }