コード例 #1
0
ファイル: TimelineView.cs プロジェクト: cosmolen/act_timeline
        void controller_CurrentTimeUpdate(object sender, EventArgs e)
        {
            Timeline timeline = controller.Timeline;

            if (timeline == null)
            {
                return;
            }

            if (InvokeRequired)
            {
                Invoke(new Action(() => { controller_CurrentTimeUpdate(sender, e); }));
                return;
            }
            else
            {
                // play pending alerts
                var pendingAlerts = timeline.PendingAlertsAt(controller.CurrentTime);
                foreach (ActivityAlert pendingAlert in pendingAlerts)
                {
                    if (pendingAlert.Sound != null)
                    {
                        soundplayer.PlaySound(pendingAlert.Sound.Filename);
                    }
                    if (pendingAlert.TtsSpeaker != null &&
                        !string.IsNullOrWhiteSpace(pendingAlert.TtsSentence))
                    {
                        pendingAlert.TtsSpeaker.Synthesizer.SpeakAsync(pendingAlert.TtsSentence);
                    }
                    pendingAlert.Processed = true;
                }

                // sync dataGridView
                dataGridView.DataSource = null;
                if (popupMode)
                {
                    dataGridView.DataSource = timeline.VisibleItemsAtMostWithoutCasting(controller.CurrentTime - 5, controller.CurrentTime, numberOfRowsToDisplay, ReverseOrder).ToList();
                }
                else if (over10)
                {
                    if (under10)
                    {
                        if (showCasting)
                        {
                            dataGridView.DataSource = timeline.VisibleItemsAt(controller.CurrentTime, numberOfRowsToDisplay, ReverseOrder).ToList();
                        }
                        else
                        {
                            dataGridView.DataSource = timeline.VisibleItemsAtWithoutCasting(controller.CurrentTime, numberOfRowsToDisplay, ReverseOrder).ToList();
                        }
                    }
                    else
                    {
                        dataGridView.DataSource = timeline.VisibleItemsAtLeast(controller.CurrentTime, controller.CurrentTime + 10, numberOfRowsToDisplay, ReverseOrder).ToList();
                    }
                }
                else
                {
                    if (under10)
                    {
                        if (showCasting)
                        {
                            dataGridView.DataSource = timeline.VisibleItemsAtMost(controller.CurrentTime, controller.CurrentTime + 10, numberOfRowsToDisplay, ReverseOrder).ToList();
                        }
                        else
                        {
                            dataGridView.DataSource = timeline.VisibleItemsAtMostWithoutCasting(controller.CurrentTime, controller.CurrentTime + 10, numberOfRowsToDisplay, ReverseOrder).ToList();
                        }
                    }
                    else if (showCasting)
                    {
                        dataGridView.DataSource = timeline.VisibleItemsAtMost(controller.CurrentTime, controller.CurrentTime, numberOfRowsToDisplay, ReverseOrder).ToList();
                    }
                }
            }
        }