protected override async Task OnAfterRenderAsync(bool firstRender) { await InitAsync(Element, Options); //Debug.WriteLine("Init finished"); await OnAfterInit.InvokeAsync(null); }
public void Run() { try { Reset(); var errors = graph.Validate(); if (errors.Count > 0) { throw new FLowNetworkValidationException(errors); } if (graph == null) { throw new InvalidConfigurationException("Can't run algorithm without graph."); } OnBeforeInit?.Invoke(this); Init(); OnAfterInit?.Invoke(this); var timer = new Stopwatch(); OnStart?.Invoke(this); timer.Start(); Logic(); timer.Stop(); Elapsed = timer.Elapsed; Log.Write($"Algorithm {Name}. Max flow: {MaxFlow}. From: {graph.Source}, To: {graph.Target}, Time: {Elapsed}. Ticks: {Ticks}"); OnFinish?.Invoke(this); } catch (Exception e) { Log.Write(e.Message, Log.ERROR); } }
public async Task InitAsync(TModel model = null, Action <TModel> afterInit = null) { Model = model ?? new TModel(); await OnAfterInit.InvokeAsync(Model); afterInit?.Invoke(Model); error = null; EditContext = new EditContext(Model); validationMessageStore = new ValidationMessageStore(EditContext); }
public void Completed() { OnAfterInit?.Invoke(); }
/// <summary> /// 调用 InitVM 并触发 OnAfterInit 事件 /// </summary> public void DoInit() { InitVM(); OnAfterInit?.Invoke(this); }