123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Controls;
- namespace HistoryDLL
- {
- /// <summary>
- /// 該歷史牆主要用於 n * 1 (n 最大為 3) 的螢幕
- /// 解析度為(1920 * 1080), (3840 * 1080), (5760 * 1080)
- /// 這部分將以上述解析度加上單位事件的寬度進行計算
- /// 得到各個常數項的值
- /// </summary>
- public partial class CyclicScroller : UserControl
- {
- private int MainEventHeight = 610;
- private int MainEventWidth = 460;
- private int YearEventHeight = 77;
- //螢幕解析度 (寬)
- private int ResolutionValueHeight = 0;
- private int ResolutionValueWidth = 0;
- //透過電視牆的寬度~及所設定的MainEventWidth, 取得該 scrollviewer 會有幾個 children
- private int ChildrenCount = 0;
- //除了 ChildrenCount 外在移動判斷上需再加上四, 以供在無限Scroll的時候判斷位置用
- private int TotalShowChildren = 0;
- //兩旁黑邊"沒出現"的範圍
- private int NoneUseRange = 0;
- private int FadeRate;
- private void SetSpecValue()
- {
- //設定 Scrollviewer 的高度~
- uxMyScroll.Height = MainEventHeight;
- ChildrenCount = GetChildrenCount();
- TotalShowChildren = ChildrenCount + 4;
- NoneUseRange = GetNoneUseRange();
- FadeRate = MainEventWidth / 2;
- }
- //兩旁黑邊"沒出現"的範圍
- private int GetNoneUseRange()
- {
- int result = 0;
- int buffer = 0;
- //一個螢幕的話可容納的個數
- if (CurrentMonitorCount.ncm == MonitorFlag.Monitor1_1)
- {
- //解析度1920 * 1080
- ResolutionValueWidth = 1920;
- ResolutionValueHeight = 1080;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor2_1)
- {
- //解析度3840 * 1080
- ResolutionValueWidth = 3840;
- ResolutionValueHeight = 1080;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor3_1)
- {
- //解析度5760 * 1080
- ResolutionValueWidth = 5760;
- ResolutionValueHeight = 1080;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor4_1)
- {
- //解析度7680 * 1080
- ResolutionValueWidth = 7680;
- ResolutionValueHeight = 1080;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor5_1)
- {
- //解析度9600 * 1080
- ResolutionValueWidth = 9600;
- ResolutionValueHeight = 1080;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor6_1)
- {
- //解析度11520 * 1080
- ResolutionValueWidth = 11520;
- ResolutionValueHeight = 1080;
- }
- if (GlobalFunction.isSolutionUsing4K)
- {
- ResolutionValueHeight *= 2;
- }
- buffer = (ResolutionValueWidth - MainEventWidth) / MainEventWidth;
- result = MainEventWidth - (ResolutionValueWidth - (MainEventWidth * buffer)) / 2;
- return result;
- }
- /// <summary>
- /// 透過電視牆的寬度~及所設定的MainEventWidth, 取得該 scrollviewer 會有幾個 children
- /// </summary>
- /// <returns></returns>
- private int GetChildrenCount()
- {
- int result = 0;
- //一個螢幕的話可容納的個數
- if (CurrentMonitorCount.ncm == MonitorFlag.Monitor1_1)
- {
- //解析度1920 * 1080
- result = 1920 / MainEventWidth + 1;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor2_1)
- {
- //解析度3840 * 1080
- result = 3840 / MainEventWidth + 1;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor3_1)
- {
- //解析度5760 * 1080
- result = 5760 / MainEventWidth + 1;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor4_1)
- {
- //解析度7680 * 1080
- result = 7680 / MainEventWidth + 1;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor5_1)
- {
- //解析度9600 * 1080
- result = 9600 / MainEventWidth + 1;
- }
- else if (CurrentMonitorCount.ncm == MonitorFlag.Monitor6_1)
- {
- //解析度11520 * 1080
- result = 11520 / MainEventWidth + 1;
- }
- return result;
- }
- }
- }
|