コード例 #1
0
    // FIXME this needs some work, to be completely in-tune with needs.
    public void MediaEventLoop(Action <double> UpdateProgress)
    {
        mediaEvent.CancelDefaultHandling(EventCode.StateChange);
        //mediaEvent.CancelDefaultHandling(EventCode.Starvation);
        while (stopMediaEventLoop == false)
        {
            try
            {
                EventCode ev;
                IntPtr    p1, p2;
                if (mediaEvent.GetEvent(out ev, out p1, out p2, 0) == 0)
                {
                    switch (ev)
                    {
                    case EventCode.Complete:
                        Stopping.Fire(this, null);
                        if (UpdateProgress != null)
                        {
                            UpdateProgress(source.PercentageCompleted);
                        }
                        return;

                    case EventCode.StateChange:
                        FilterState state = (FilterState)p1.ToInt32();
                        if (state == FilterState.Stopped || state == FilterState.Paused)
                        {
                            Stopping.Fire(this, null);
                        }
                        else if (state == FilterState.Running)
                        {
                            Starting.Fire(this, null);
                        }
                        break;
                        // FIXME add abort and stuff, and propagate this.
                    }
                    //                        Trace.WriteLine(ev.ToString() + " " + p1.ToInt32());
                    mediaEvent.FreeEventParams(ev, p1, p2);
                }
                else
                {
                    if (UpdateProgress != null)
                    {
                        UpdateProgress(source.PercentageCompleted);
                    }
                    // FiXME use AutoResetEvent
                    Thread.Sleep(100);
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine("MediaEventLoop: " + e);
            }
        }
    }
コード例 #2
0
ファイル: ConsoleApp.cs プロジェクト: kentcb/PowerArgs
 private void ExitInternal()
 {
     Stopping.Fire();
     using (var snapshot = Bitmap.CreateSnapshot())
     {
         Bitmap.CreateWiper().Wipe();
         Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor;
         Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor;
     }
     _current = null;
     Stopped.Fire();
     Dispose();
 }
コード例 #3
0
ファイル: ConsoleApp.cs プロジェクト: jiaw37/PowerArgs
 private void ExitInternal()
 {
     Stopping.Fire();
     Recorder?.WriteFrame(Bitmap, true);
     Recorder?.Dispose();
     using (var snapshot = Bitmap.CreateSnapshot())
     {
         Bitmap.CreateWiper().Wipe();
         Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor;
         Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor;
     }
     _current = null;
     LayoutRoot.Dispose();
     Stopped.Fire();
     Dispose();
 }
コード例 #4
0
        private void ExitInternal()
        {
            Stopping.Fire();
            Recorder?.WriteFrame(Bitmap, true);
            Recorder?.Finish();

            if (ClearOnExit)
            {
                ConsoleProvider.Current.Clear();
            }
            Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor;
            Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor;
            LayoutRoot.Dispose();
            Stopped.Fire();
            Dispose();
            _current = null;
        }