using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
namespace HistoryDLL
{
///
/// 該歷史牆主要用於 n * 1 (n 最大為 3) 的螢幕
/// 解析度為(1920 * 1080), (3840 * 1080), (5760 * 1080)
/// 這部分將以上述解析度加上單位事件的寬度進行計算
/// 得到各個常數項的值
///
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;
}
///
/// 透過電視牆的寬度~及所設定的MainEventWidth, 取得該 scrollviewer 會有幾個 children
///
///
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;
}
}
}