Exemplo n.º 1
0
        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);
     }
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public void Completed()
 {
     OnAfterInit?.Invoke();
 }
Exemplo n.º 5
0
Arquivo: BaseVM.cs Projeto: zyptfy/WTM
 /// <summary>
 /// 调用 InitVM 并触发 OnAfterInit 事件
 /// </summary>
 public void DoInit()
 {
     InitVM();
     OnAfterInit?.Invoke(this);
 }