mirror of
https://github.com/ZetaKebab/MpcNET.git
synced 2025-07-01 08:47:36 +00:00
Connect and disconnect from mpd in test app implemented.
This commit is contained in:
@ -14,17 +14,29 @@ namespace LibMpcApp
|
|||||||
var connected = mpc.ConnectAsync().GetAwaiter().GetResult();
|
var connected = mpc.ConnectAsync().GetAwaiter().GetResult();
|
||||||
if (connected)
|
if (connected)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("Connected to MPD.");
|
||||||
StartReadCommands(mpc);
|
StartReadCommands(mpc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("Could not connect to MPD");
|
Console.WriteLine("Could not connect to MPD.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mpc.DisconnectAsync().GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void StartReadCommands(Mpc mpc)
|
private static void StartReadCommands(Mpc mpc)
|
||||||
{
|
{
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
Console.Write("Command: ");
|
||||||
|
var command = Console.ReadLine();
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(command))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user