移除 warning ,與加入DBobj 20250319

This commit is contained in:
allen.yan 2025-03-19 15:17:05 +08:00
parent 4891ae34c4
commit 00fdf5018b
20 changed files with 48 additions and 44 deletions

2
.gitignore vendored
View File

@ -3,5 +3,5 @@ Superstar.mdf
Superstar_log.ldf
.vs
build.bat
DualScreenKTVPlayStation.exe
*.exe
themes/superstar/_www/

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Diagnostics;
using DBObj;
namespace DualScreenDemo
{
public class CommandHandler

View File

@ -1,4 +1,4 @@
namespace DualScreenDemo
namespace DBObj
{
// artist OOP test
public class Artist

View File

@ -4,8 +4,8 @@ using System.Data.SQLite;
using System.IO;
using System.Linq;
using System.Windows.Forms;
namespace DualScreenDemo
using DualScreenDemo;
namespace DBObj
{
/**

View File

@ -1,6 +1,6 @@
using System;
namespace DualScreenDemo
namespace DBObj
{
public class SongData
{

View File

@ -6,8 +6,8 @@ using System.Linq;
using System.Windows.Forms;
using System.Globalization;
using System.Diagnostics;
namespace DualScreenDemo
using DualScreenDemo;
namespace DBObj
{
public class SongListManager
{
@ -278,7 +278,7 @@ namespace DualScreenDemo
}
catch (System.FormatException ex)
{
// Console.WriteLine(String.Format("Invalid date format for song: {0}. Error: {1}", song, ex.Message));
//Console.WriteLine(String.Format("Invalid date format for song: {0}. Error: {1}", song, ex.Message));
addedTime = DateTime.Now;
}
}

View File

@ -17,6 +17,7 @@ using SystemAction = System.Action;
using ZXingAction = ZXing.Action;
using System.Threading;
using System.Collections.Concurrent;
using DBObj;
namespace DualScreenDemo
{
public class HttpServer
@ -26,7 +27,7 @@ namespace DualScreenDemo
// 服务器类变量
private static SongListManager songListManager;
// 使用完整命名空间来避免歧义
//public static event ActionString OnDisplayBarrage;
public static event ActionString OnDisplayBarrage;
private static DateTime lastClickTime = DateTime.MinValue;
public static string randomFolderPath; // 声明全局变量
//private static OverlayForm form;
@ -961,16 +962,16 @@ namespace DualScreenDemo
}
}
}
catch (JsonException ex)
{
context.Response.StatusCode = 400;
Console.WriteLine("解析留言数据时出错");
}
catch (Exception ex)
{
context.Response.StatusCode = 500;
Console.WriteLine("服务器内部错误");
}
//catch (JsonException ex)
//{
// context.Response.StatusCode = 400;
// Console.WriteLine("解析留言数据时出错");
//}
//catch (Exception ex)
//{
// context.Response.StatusCode = 500;
// Console.WriteLine("服务器内部错误");
//}
finally
{
context.Response.Close();

View File

@ -6,13 +6,13 @@ namespace DualScreenDemo
{
public static class HttpServerManager
{
public static void StartServer()
public static async void StartServer()
{
int httpPort = 9090; // 你可以修改此端口
string baseDirectory = Path.Combine(Application.StartupPath, @"themes\superstar\_www");
CleanUpDirectory(baseDirectory);
HttpServer.StartServer(baseDirectory, httpPort, Program.songListManager);
await HttpServer.StartServer(baseDirectory, httpPort, Program.songListManager);
}

View File

@ -7,7 +7,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using DBObj;
namespace DualScreenDemo
{
public partial class OverlayForm

View File

@ -12,7 +12,7 @@ using Newtonsoft.Json;
using ZXing;
using ZXing.QrCode;
using System.Timers;
using DBObj;
namespace DualScreenDemo
{
public partial class OverlayForm : Form
@ -479,7 +479,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
private readonly object _lockObject = new object();
private void UnifiedTimer_Elapsed(object sender, EventArgs e)
private async void UnifiedTimer_Elapsed(object sender, EventArgs e)
{
// Console.WriteLine("UnifiedTimer_Elapsed called");
@ -496,28 +496,28 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
case UIState.SelectingLanguage:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
case UIState.SelectingArtistCategory:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
case UIState.SelectingAction:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
case UIState.SelectingSong:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
case UIState.SelectingArtist:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
case UIState.PlayHistory:
SetUIState(UIState.Initial);
HandleTimeout("");
await HandleTimeout("");
break;
}
}
@ -1313,7 +1313,7 @@ public void UpdateHistoryLabel(List<SongData> historySongs, List<PlayState> play
int mainTitleFontSize = 60;
int optionFontSize = 50;
int lineSpacing = 15;
int columnSpacing = 400;
//int columnSpacing = 400;
// 主標題
string mainTitle = messages[0];

View File

@ -4,7 +4,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using DBObj;
namespace DualScreenDemo
{
public partial class PrimaryForm

View File

@ -4,7 +4,7 @@ using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Collections.Generic;
using DBObj;
namespace DualScreenDemo
{
public partial class PrimaryForm

View File

@ -3,7 +3,7 @@ using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Linq;
using DBObj;
namespace DualScreenDemo
{
public partial class PrimaryForm

View File

@ -11,7 +11,7 @@ using NAudio.Wave;
using Microsoft.Ink;
using System.Text.RegularExpressions;
using WMPLib;
using DBObj;
namespace DualScreenDemo
{
public partial class PrimaryForm : Form

View File

@ -32,6 +32,7 @@ using Microsoft.Ink;
using Microsoft.Win32;
using System.Diagnostics;
using DualScreenDemo;
using DBObj;
namespace DualScreenDemo
{

View File

@ -106,7 +106,7 @@ namespace DualScreenDemo
}
catch (Exception processEx)
{
// Console.WriteLine($"處理資料時發生錯誤: {processEx.Message}");
Console.WriteLine($"處理資料時發生錯誤: {processEx.Message}");
}
});
}
@ -117,7 +117,7 @@ namespace DualScreenDemo
}
catch (Exception ex)
{
// Console.WriteLine($"接收資料時發生錯誤: {ex.Message}");
Console.WriteLine($"接收資料時發生錯誤: {ex.Message}");
}
}
@ -137,7 +137,7 @@ namespace DualScreenDemo
}
catch (Exception ex)
{
// Console.WriteLine($"關閉串列埠時發生錯誤: {ex.Message}");
Console.WriteLine($"關閉串列埠時發生錯誤: {ex.Message}");
}
}
}

View File

@ -8,7 +8,7 @@ using System.Threading.Tasks;
using System.IO; // 為 Path 和 File 提供支持
using System.Windows.Forms; // 為 Invoke 和 Form 控件提供支持
using System.Collections.Generic;
using DBObj;
namespace DualScreenDemo
{
public class TCPServer

View File

@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading.Tasks;
using DirectShowLib;
using DBObj;
namespace DualScreenDemo
{
public class VideoPlayerForm : Form
@ -399,7 +399,7 @@ namespace DualScreenDemo
}
catch (Exception ex)
{
// Console.WriteLine($"Exception in AddFilterByClsid: {ex.Message}");
Console.WriteLine($"Exception in AddFilterByClsid: {ex.Message}");
throw; // Rethrow the exception to handle it further up the call stack
}
}
@ -514,10 +514,10 @@ namespace DualScreenDemo
}
}
public void InitializePublicPlaylist(List<SongData> initialPlaylist)
public async void InitializePublicPlaylist(List<SongData> initialPlaylist)
{
publicPlaylist = initialPlaylist;
PlayPublicPlaylist(); // 开始播放公播歌单
await PlayPublicPlaylist(); // 开始播放公播歌单
}
public async Task SetPlayingSongList(List<SongData> songList)
@ -1528,6 +1528,7 @@ namespace DualScreenDemo
}
catch (Exception ex)
{
Console.WriteLine( ex.Message);
}
}
@ -1580,6 +1581,7 @@ namespace DualScreenDemo
}
catch (Exception ex)
{
Console.WriteLine( ex.Message);
}
}