2508281333
已點歌曲頁面自動定位至播放中歌曲 QRCode關閉按鈕偏移問題修正
This commit is contained in:
parent
9e44419710
commit
ed34f6c05a
@ -12,7 +12,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
private const int ItemHeight = 70;
|
private const int ItemHeight = 70;
|
||||||
private const int RowGap = 2;
|
private const int RowGap = 2;
|
||||||
private int itemsPerPage
|
public int itemsPerPage
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@ -204,11 +204,9 @@ namespace DualScreenDemo
|
|||||||
currentArtistList.Clear();
|
currentArtistList.Clear();
|
||||||
currentPageIndex = 0;
|
currentPageIndex = 0;
|
||||||
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
|
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
|
||||||
|
|
||||||
// 直接調用基礎刷新邏輯
|
// 直接調用基礎刷新邏輯
|
||||||
RefreshDisplayBase();
|
RefreshDisplayBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadSingers(List<Artist> artists)
|
public void LoadSingers(List<Artist> artists)
|
||||||
{
|
{
|
||||||
_isShowingSinger = true;
|
_isShowingSinger = true;
|
||||||
@ -219,18 +217,17 @@ namespace DualScreenDemo
|
|||||||
RefreshDisplayBase_Singer();
|
RefreshDisplayBase_Singer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPlayedSongs(List<SongData> songs)
|
public void LoadPlayedSongs(List<SongData> songs,int page)
|
||||||
{
|
{
|
||||||
_isShowingSinger = false;
|
_isShowingSinger = false;
|
||||||
currentSongList = songs;
|
currentSongList = songs;
|
||||||
currentArtistList.Clear();
|
currentArtistList.Clear();
|
||||||
currentPageIndex = 0;
|
currentPageIndex = page;
|
||||||
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
|
totalPages = (int)Math.Ceiling(songs.Count / (double)itemsPerPage);
|
||||||
|
|
||||||
// 直接調用基礎刷新邏輯
|
// 直接調用基礎刷新邏輯
|
||||||
RefreshDisplayBase();
|
RefreshDisplayBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshDisplay()
|
public void RefreshDisplay()
|
||||||
{
|
{
|
||||||
this.Controls.Clear(); // 清除所有 UI 元件
|
this.Controls.Clear(); // 清除所有 UI 元件
|
||||||
@ -562,8 +559,6 @@ namespace DualScreenDemo
|
|||||||
songLabel.BringToFront();
|
songLabel.BringToFront();
|
||||||
artistLabel.BringToFront();
|
artistLabel.BringToFront();
|
||||||
|
|
||||||
//songLabel.Controls.Add(artistLabel);
|
|
||||||
//artistLabel.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
|
|
||||||
songLabel.TextAlign = ContentAlignment.TopLeft;
|
songLabel.TextAlign = ContentAlignment.TopLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,6 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
closeQRCodeButton = new Button { Text = "" };
|
closeQRCodeButton = new Button { Text = "" };
|
||||||
closeQRCodeButton.Name = "closeQRCodeButton";
|
closeQRCodeButton.Name = "closeQRCodeButton";
|
||||||
closeQRCodeButton.Location = new Point(259, 7);
|
|
||||||
closeQRCodeButton.Size = new Size(30, 30);
|
|
||||||
closeQRCodeButton.BackColor = Color.Transparent;
|
closeQRCodeButton.BackColor = Color.Transparent;
|
||||||
closeQRCodeButton.BackgroundImageLayout = ImageLayout.Stretch;
|
closeQRCodeButton.BackgroundImageLayout = ImageLayout.Stretch;
|
||||||
closeQRCodeButton.FlatStyle = FlatStyle.Flat;
|
closeQRCodeButton.FlatStyle = FlatStyle.Flat;
|
||||||
@ -102,6 +100,7 @@ namespace DualScreenDemo
|
|||||||
closeQRCodeButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
|
closeQRCodeButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
|
||||||
closeQRCodeButton.Click += CloseQRCodeButton_Click;
|
closeQRCodeButton.Click += CloseQRCodeButton_Click;
|
||||||
pictureBoxQRCode.Controls.Add(closeQRCodeButton);
|
pictureBoxQRCode.Controls.Add(closeQRCodeButton);
|
||||||
|
ResizeAndPositionControl(closeQRCodeButton, 193, 4, 25, 25);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -154,8 +154,8 @@ namespace DualScreenDemo
|
|||||||
//{
|
//{
|
||||||
// var data = LoadBtnConfigData();
|
// var data = LoadBtnConfigData();
|
||||||
// var hostdata = LoadBtnConfigData();
|
// var hostdata = LoadBtnConfigData();
|
||||||
// string test = hostdata["HeartBeatUrl"] + "/" + data["PrimaryFormBtn"]["AlertNormal1"];
|
// string test1 = hostdata["HeartBeatUrl"] + "/" + data["PrimaryFormBtn"]["AlertNormal1"];
|
||||||
// Console.WriteLine(test);
|
// Console.WriteLine(test1);
|
||||||
// Uri remoteUri = new Uri("http://zqd.superstar.dnsnet.cc/themes/superstar/button/1.主類別/主類別上方_新歌快報(未按).png");
|
// Uri remoteUri = new Uri("http://zqd.superstar.dnsnet.cc/themes/superstar/button/1.主類別/主類別上方_新歌快報(未按).png");
|
||||||
|
|
||||||
// Bitmap bitmap = await GetBitmapFromUriAsync(remoteUri);
|
// Bitmap bitmap = await GetBitmapFromUriAsync(remoteUri);
|
||||||
@ -179,7 +179,7 @@ namespace DualScreenDemo
|
|||||||
this.Invalidate(); // 重新繪製界面
|
this.Invalidate(); // 重新繪製界面
|
||||||
}
|
}
|
||||||
|
|
||||||
public const int itemsPerPage = 18;
|
public const int itemsPerPage = 16;
|
||||||
private WaveInEvent waveIn;
|
private WaveInEvent waveIn;
|
||||||
private WaveFileWriter waveWriter;
|
private WaveFileWriter waveWriter;
|
||||||
|
|
||||||
@ -340,12 +340,12 @@ namespace DualScreenDemo
|
|||||||
// 設定繪製文字的位置 (X=500, Y=30)
|
// 設定繪製文字的位置 (X=500, Y=30)
|
||||||
PointF point_PCName = new PointF(450 * scaleX, 30 * scaleY);
|
PointF point_PCName = new PointF(450 * scaleX, 30 * scaleY);
|
||||||
PointF point_PageNumber = new PointF(1390 * scaleX, 30 * scaleY);
|
PointF point_PageNumber = new PointF(1390 * scaleX, 30 * scaleY);
|
||||||
PointF point_verSion = new PointF(1800 * scaleX, 30 * scaleY);
|
PointF point_verSion = new PointF(1800 * scaleX-10, 30 * scaleY);
|
||||||
// 繪製文字:
|
// 繪製文字:
|
||||||
// `DrawString(要繪製的文字, 字型, 畫刷, 位置)`
|
// `DrawString(要繪製的文字, 字型, 畫刷, 位置)`
|
||||||
e.Graphics.DrawString(displayName, font, brush, point_PCName);
|
e.Graphics.DrawString(displayName, font, brush, point_PCName);
|
||||||
e.Graphics.DrawString(pageNumber, font, brush, point_PageNumber);
|
e.Graphics.DrawString(pageNumber, font, brush, point_PageNumber);
|
||||||
e.Graphics.DrawString(version.Substring(version.IndexOf("V"), 4), font, brush, point_verSion);
|
e.Graphics.DrawString(version.Substring(version.IndexOf("V"), 5), font, brush, point_verSion);
|
||||||
}
|
}
|
||||||
private void User_Paint(object sender, PaintEventArgs e)
|
private void User_Paint(object sender, PaintEventArgs e)
|
||||||
{
|
{
|
||||||
@ -2319,7 +2319,9 @@ namespace DualScreenDemo
|
|||||||
// 已點歌曲錨點
|
// 已點歌曲錨點
|
||||||
var List = SongList.GetHistory();
|
var List = SongList.GetHistory();
|
||||||
totalPages = (int)Math.Ceiling((double)List.Count / itemsPerPage);
|
totalPages = (int)Math.Ceiling((double)List.Count / itemsPerPage);
|
||||||
multiPagePanel.currentPageIndex = 0;
|
int index = List.FindIndex(song => song.GetState() == PlayState.Playing);
|
||||||
|
int page = 0;
|
||||||
|
if ((index+1) > multiPagePanel.itemsPerPage) page = Math.Abs((index+1) / multiPagePanel.itemsPerPage);
|
||||||
|
|
||||||
SetHotSongButtonsVisibility(false);
|
SetHotSongButtonsVisibility(false);
|
||||||
SetNewSongButtonsVisibility(false);
|
SetNewSongButtonsVisibility(false);
|
||||||
@ -2343,7 +2345,7 @@ namespace DualScreenDemo
|
|||||||
closeQRCodeButton.Visible = false;
|
closeQRCodeButton.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
multiPagePanel.LoadPlayedSongs(List);
|
multiPagePanel.LoadPlayedSongs(List,page);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 控制項Visible屬性設定
|
#region 控制項Visible屬性設定
|
||||||
@ -2419,5 +2421,40 @@ namespace DualScreenDemo
|
|||||||
activeButton.BackgroundImage = activeBackground;
|
activeButton.BackgroundImage = activeBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void HttpDownload(string fileUrl,string LocalLoc)
|
||||||
|
{
|
||||||
|
using HttpClient client = new HttpClient();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response= await client.GetAsync(fileUrl, HttpCompletionOption.ResponseHeadersRead);
|
||||||
|
|
||||||
|
var totalBytes = response.Content.Headers.ContentLength ?? -1L;
|
||||||
|
using var contentStream = await response.Content.ReadAsStreamAsync();
|
||||||
|
using var fileStream = new FileStream(LocalLoc, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||||
|
|
||||||
|
var buffer = new byte[8192];
|
||||||
|
long totalRead = 0;
|
||||||
|
int read;
|
||||||
|
while ((read = await contentStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
|
||||||
|
{
|
||||||
|
await fileStream.WriteAsync(buffer, 0, read);
|
||||||
|
totalRead += read;
|
||||||
|
|
||||||
|
if (totalBytes > 0)
|
||||||
|
{
|
||||||
|
int progress = (int)((totalRead * 100) / totalBytes);
|
||||||
|
progressBar.Value = progress;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine("File Downloaded");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Download Failed:"+ex.Message);
|
||||||
|
Program.WriteLog("Download Failed:" + ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user