示例#1
0
        private void OnTimeChanged( object s, EventArgs e) {
            if (enabled) {
                Mp4FileAccessRecorder recorder = (Mp4FileAccessRecorder)this.recorder;
                SimpleTime now = new SimpleTime(System.DateTime.Now);
                periods.ForEach(delegate(SimpleTimePeriod p) {
                    if (now.Equals(p.Start)) {

                        recorder.Initialize(p.ToString());
                        recorder.Start();
                        if (pic != null) {
                            recorder.OnImageCaptured = new ImageDelegate(delegate(Bitmap bitmap) {
                                pic.BackgroundImage = bitmap;
                            });
                        }

                    }
                    else if (now.Equals(p.End)) {
                        recorder.Stop();
                        if (pic != null) {
                            pic.BackgroundImage = null;
                        }

                    }
                });
            }
        }
示例#2
0
        public MainForm()
        {
            InitializeComponent();

            controller.Enabled = true;
            controller.Display = this.pictureBox1;

            SimpleTime now = new SimpleTime(System.DateTime.Now);
            int t = now.TotalSecond;
            controller.AddTimePeriod(new SimpleTimePeriod(new SimpleTime(t+5), new SimpleTime(t+65), "1"));
            controller.AddTimePeriod(new SimpleTimePeriod(new SimpleTime(t+70), new SimpleTime(t+200), "2"));
            controller.AddTimePeriod(new SimpleTimePeriod(new SimpleTime(t+201), new SimpleTime(t+300), "3"));

        }
示例#3
0
 public bool isBetween(SimpleTime t1, SimpleTime t2) {
     int s1 = t1.TotalSecond;
     int s2 = t2.TotalSecond;
     int s = this.TotalSecond;
     return (s1 <= s && s <= s2) || (s1 >= s && s >= s2);
 }
示例#4
0
 public bool isBefore(SimpleTime anotherTime) {
     return this.TotalSecond <= anotherTime.TotalSecond;
 }
示例#5
0
 public SimpleTime getAfter(SimpleTime time) {
     return new SimpleTime(this.TotalSecond + time.TotalSecond);
 }
示例#6
0
 public SimpleTime getBefore(SimpleTime time) {
     return new SimpleTime(this.TotalSecond - time.TotalSecond);
 }
示例#7
0
 public SimpleTimePeriod(SimpleTime start, SimpleTime end, String name) : this(start, end){
     this.name = name;
 }
示例#8
0
 public SimpleTimePeriod(SimpleTime start, SimpleTime end) {
     this.end = end;
     this.start = start;
 }