public ProcessTrackTask(MainViewModel viewModelSource) { this.viewModelSource = viewModelSource; var tracker = new ProcessTracker(); tracker.Start(10000); tracker.ProcessStarted += this.Tracker_ProcessStarted; tracker.ProcessStoped += Tracker_ProcessStoped; }
/// <summary> /// 引发 <see cref="E:System.Windows.FrameworkElement.Initialized"/> 事件。 每当在内部将 <see cref="P:System.Windows.FrameworkElement.IsInitialized"/> 设置为 true 时,都将调用此方法。 /// </summary> /// <param name="e">包含事件数据的 <see cref="T:System.Windows.RoutedEventArgs"/>。</param> protected override async void OnInitialized(EventArgs e) { base.OnInitialized(e); if (!DesignerProperties.GetIsInDesignMode(this)) { await JryVideoCore.Current.InitializeAsync(); this.DataContext = this.ViewModel = new MainViewModel(); this.ViewModel.LoadAsync(); } }
/// <summary> /// 引发 <see cref="E:System.Windows.FrameworkElement.Initialized"/> 事件。 每当在内部将 <see cref="P:System.Windows.FrameworkElement.IsInitialized"/> 设置为 true 时,都将调用此方法。 /// </summary> /// <param name="e">包含事件数据的 <see cref="T:System.Windows.RoutedEventArgs"/>。</param> protected override async void OnInitialized(EventArgs e) { base.OnInitialized(e); if (!DesignerProperties.GetIsInDesignMode(this)) { this.DataContext = this.ViewModel = new MainViewModel(); await JryVideoCore.Current.InitializeAsync(); this.ViewModel.ReloadAsync(); this.processTrackTask = new ProcessTrackTask(this.ViewModel); this.processTrackTask.CurrentWatchVideo += this.ProcessTrackTask_CurrentWatchVideo; } }