私はC#の初心者です
私はこのコードを持っています
FileStream D = new FileStream("C:/PersonalAssistant/RecentMeetingDetails.txt", FileMode.Open, FileAccess.Read);
StreamReader DR = new StreamReader(D);
DR.BaseStream.Seek(0, SeekOrigin.Begin);
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("ALERT! ALERT!! ALERT!!!");
Console.WriteLine("\nYour Closest Appointment is on " + rd + " and has the following info");
string data = DR.ReadLine();
while (data != null)
{
Console.WriteLine(data);
data = DR.ReadLine();
}
D.Close();
DR.Close();
このコードが欲しい
Console.WriteLine("ALERT! ALERT!! ALERT!!!");
他の詳細がファイルから読み取られて画面に表示されている間、点滅します
私はこれを試しました
private static void WriteBlinkingText(string text, int delay)
{
bool visible = true;
while (true)
{
Console.Write("\r" + (visible ? text : new String(' ', text.Length)));
System.Threading.Thread.Sleep(delay);
visible = !visible;
}
}
そして、console.writeline を次のように変更します。
WriteBlinkingText("ALERT! ALERT!! ALERT!!!",500);
それは機能しましたが、他の詳細は表示されませんでした...
このコードを修正するのを手伝ってください