public override async void OnStateEnter(Animator animator, AnimatorStateInfo animatorStateInfo, int layerIndex) { Enter?.Invoke(); await Task.Delay((int)(animatorStateInfo.length * 1000)); StopRunning?.Invoke(); }
public void Start(string fileName) { #region Early Termination Checks if (string.IsNullOrWhiteSpace(fileName)) { return; } FileInfo temp; try { temp = new FileInfo(fileName); } catch (Exception) { MessageBox.Show(messageBoxText: "File Name is Not Valid", caption: "Malformed File Name", button: MessageBoxButton.OK, icon: MessageBoxImage.Error); return; } if (!temp.Exists) { MessageBox.Show(messageBoxText: "Provided File Name Could Not Be Located", caption: "File Not Found", button: MessageBoxButton.OK, icon: MessageBoxImage.Error); return; } #endregion worker = new LogWorker(fileName); worker.MonitorStopped += delegate { StopRunning?.Invoke(this, new EventArgs()); }; worker.OutputUpdate += (obj, args) => { Application.Current.Dispatcher.Invoke(new Action(() => output.Text = args.Output)); }; worker.RunWorkerAsync(); StartRunning?.Invoke(this, new EventArgs()); }