Пример #1
0
        void toolTipTimer_Tick(object sender, EventArgs e)
        {
            toolTipTimer.Stop();
            try
            {
                if (EpgSetting.EpgPopup || EpgSetting.EpgToolTip == false)
                {
                    return;
                }
                if (Window.GetWindow(this).IsActive == false)
                {
                    return;
                }
                Point cursorPos2 = Mouse.GetPosition(scrollViewer);
                if (cursorPos2.X < 0 || cursorPos2.Y < 0 ||
                    scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y)
                {
                    return;
                }
                Point cursorPos = Mouse.GetPosition(canvas);
                foreach (UIElement child in canvas.Children)
                {
                    EpgViewPanel childPanel = child as EpgViewPanel;
                    if (childPanel != null && childPanel.Items != null && Canvas.GetLeft(child) <= cursorPos.X && cursorPos.X < Canvas.GetLeft(child) + childPanel.Width)
                    {
                        foreach (ProgramViewItem info in childPanel.Items)
                        {
                            if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width &&
                                info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height)
                            {
                                if (info.TitleDrawErr == false && EpgSetting.EpgToolTipNoViewOnly)
                                {
                                    break;
                                }
                                String viewTip = "";

                                if (info != null)
                                {
                                    viewTip += new CommonManager.TimeDuration(info.EventInfo.StartTimeFlag != 0, info.EventInfo.start_time,
                                                                              info.EventInfo.DurationFlag != 0, info.EventInfo.durationSec) + "\r\n";
                                    if (info.EventInfo.ShortInfo != null)
                                    {
                                        viewTip += info.EventInfo.ShortInfo.event_name + "\r\n\r\n";
                                        viewTip += info.EventInfo.ShortInfo.text_char + "\r\n\r\n";
                                    }
                                    if (info.EventInfo.ExtInfo != null)
                                    {
                                        viewTip += CommonManager.TrimHyphenSpace(info.EventInfo.ExtInfo.text_char);
                                    }
                                }
                                toolTipTextBlock.Text       = viewTip;
                                toolTipTextBlock.Background = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgTipsBackColorR, EpgSetting.EpgTipsBackColorG, EpgSetting.EpgTipsBackColorB));
                                toolTipTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(EpgSetting.EpgTipsForeColorR, EpgSetting.EpgTipsForeColorG, EpgSetting.EpgTipsForeColorB));
                                toolTip.IsOpen = true;
                                toolTipOffTimer.Stop();
                                toolTipOffTimer.Interval = TimeSpan.FromSeconds(10);
                                toolTipOffTimer.Start();

                                lastPopupInfo = info;
                                lastPopupPos  = cursorPos;
                            }
                        }
                        break;
                    }
                }
            }
            catch
            {
                toolTip.IsOpen = false;
            }
        }
Пример #2
0
        void toolTipTimer_Tick(object sender, EventArgs e)
        {
            toolTipTimer.Stop();
            try
            {
                if (Settings.Instance.NoToolTip == true)
                {
                    return;
                }
                if (reserveViewPanel.Items != null)
                {
                    if (MainWindow.GetWindow(this).IsActive == false)
                    {
                        return;
                    }
                    Point cursorPos2 = Mouse.GetPosition(scrollViewer);
                    if (cursorPos2.X < 0 || cursorPos2.Y < 0 ||
                        scrollViewer.ViewportWidth < cursorPos2.X || scrollViewer.ViewportHeight < cursorPos2.Y)
                    {
                        return;
                    }
                    Point cursorPos = Mouse.GetPosition(reserveViewPanel);
                    foreach (ReserveViewItem info in reserveViewPanel.Items)
                    {
                        if (info.LeftPos <= cursorPos.X && cursorPos.X < info.LeftPos + info.Width)
                        {
                            if (info.TopPos <= cursorPos.Y && cursorPos.Y < info.TopPos + info.Height)
                            {
                                if (info.TitleDrawErr == true)
                                {
                                    string view = new CommonManager.TimeDuration(true, info.ReserveInfo.StartTime,
                                                                                 true, info.ReserveInfo.DurationSecond) + "\r\n";
                                    view += info.ReserveInfo.StationName;
                                    view += " (" + CommonManager.ConvertNetworkNameText(info.ReserveInfo.OriginalNetworkID) + ")" + "\r\n";

                                    view += info.ReserveInfo.Title;

                                    toolTipTextBlock.Text       = view;
                                    toolTipTextBlock.Background = new SolidColorBrush(Color.FromRgb(
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsBackColorR,
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsBackColorG,
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsBackColorB));
                                    toolTipTextBlock.Foreground = new SolidColorBrush(Color.FromRgb(
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsForeColorR,
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsForeColorG,
                                                                                          Settings.Instance.EpgSettingList[0].EpgTipsForeColorB));
                                    toolTip.IsOpen = true;
                                    toolTipOffTimer.Start();

                                    lastPopupInfo = info;
                                    lastPopupPos  = cursorPos;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }