diff --git a/ClientServerLib/ClientServerLib/CServer.cs b/ClientServerLib/ClientServerLib/CServer.cs
index 950b0cbe..ac50a6d5 100644
--- a/ClientServerLib/ClientServerLib/CServer.cs
+++ b/ClientServerLib/ClientServerLib/CServer.cs
@@ -203,9 +203,9 @@ namespace ServerLib
_Init(port, encrypted);
}
- public static string GetLocalAddress()
+ public string GetBaseAddress()
{
- return Dns.GetHostName();
+ return _BaseAddress.AbsoluteUri;
/*IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress ip in ips)
@@ -216,6 +216,11 @@ namespace ServerLib
return "";*/
}
+ public bool IsRunning()
+ {
+ return _Host.State == CommunicationState.Opened;
+ }
+
#region server control
private void _Init(int port, bool encrypted)
diff --git a/Output/Languages/English.xml b/Output/Languages/English.xml
index 609598d0..ec88de0d 100644
--- a/Output/Languages/English.xml
+++ b/Output/Languages/English.xml
@@ -216,4 +216,5 @@
Bottom right
Volume
Server address
+ Server is not running. Please check config.xml!
diff --git a/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml
index 94038a48..6bf09478 100644
--- a/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml
+++ b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml
@@ -131,6 +131,36 @@
+
+
+ 640
+ 265
+
+ -2,00
+
+ 45
+
+ 600
+
+
+ StaticColor
+
+
+ TextSColor
+
+ Center
+
+ Center
+
+
+
+ Outline
+
+ TR_SCREENPSERVERQR_NOTRUNNING
+
+
+
+
640
diff --git a/Vocaluxe/Base/Server/CVocaluxeServer.cs b/Vocaluxe/Base/Server/CVocaluxeServer.cs
index 3f0c404c..13072356 100644
--- a/Vocaluxe/Base/Server/CVocaluxeServer.cs
+++ b/Vocaluxe/Base/Server/CVocaluxeServer.cs
@@ -88,6 +88,19 @@ namespace Vocaluxe.Base.Server
//_Discover.Stop();
}
+ public static string GetServerAddress()
+ {
+ return _Server == null ? "" : _Server.GetBaseAddress();
+ }
+
+ public static bool IsServerRunning()
+ {
+ if (_Server == null)
+ return false;
+
+ return _Server.IsRunning();
+ }
+
private static bool _SendKeyEvent(string key)
{
bool result = false;
diff --git a/Vocaluxe/Screens/CPopupScreenServerQR.cs b/Vocaluxe/Screens/CPopupScreenServerQR.cs
index 47400f17..fbf4a8e8 100644
--- a/Vocaluxe/Screens/CPopupScreenServerQR.cs
+++ b/Vocaluxe/Screens/CPopupScreenServerQR.cs
@@ -17,6 +17,7 @@
using ServerLib;
using Vocaluxe.Base;
+using Vocaluxe.Base.Server;
using VocaluxeLib;
using VocaluxeLib.Menu;
using VocaluxeLib.Draw;
@@ -45,25 +46,37 @@ namespace Vocaluxe.Screens
private const string _StaticQRWindowsPhone = "StaticQRWindowsPhone";
private const string _TextServerAddress = "TextServerAddress";
+ private const string _TextServerNotRunning = "TextServerNotRunning";
public override void Init()
{
base.Init();
_ThemeStatics = new string[] { _StaticQRServer, _StaticQRAndroid, _StaticQRSymbian, _StaticQRWebOS, _StaticQRWindowsPhone };
- _ThemeTexts = new string[] { _TextServerAddress };
+ _ThemeTexts = new string[] { _TextServerAddress, _TextServerNotRunning };
}
public override void LoadTheme(string xmlPath)
{
base.LoadTheme(xmlPath);
- _GenerateQRs();
- _Statics[_StaticQRServer].Texture = _QRServerAddress;
- _Statics[_StaticQRAndroid].Texture = _QRAndroidLink;
- _Statics[_StaticQRSymbian].Texture = _QRSymbianLink;
- _Statics[_StaticQRWebOS].Texture = _QRWebOSLink;
- _Statics[_StaticQRWindowsPhone].Texture = _QRWindowsPhoneLink;
- _Texts[_TextServerAddress].Text = CServer.GetLocalAddress() + ":" + CConfig.ServerPort;
+ }
+
+ public override void OnShow()
+ {
+ base.OnShow();
+ if (_QRServerAddress == null)
+ {
+ _GenerateQRs();
+ _Statics[_StaticQRServer].Texture = _QRServerAddress;
+ _Statics[_StaticQRAndroid].Texture = _QRAndroidLink;
+ _Statics[_StaticQRSymbian].Texture = _QRSymbianLink;
+ _Statics[_StaticQRWebOS].Texture = _QRWebOSLink;
+ _Statics[_StaticQRWindowsPhone].Texture = _QRWindowsPhoneLink;
+ _Texts[_TextServerAddress].Text = CVocaluxeServer.GetServerAddress();
+ }
+ _Texts[_TextServerAddress].Visible = CVocaluxeServer.IsServerRunning();
+ _Statics[_StaticQRServer].Visible = CVocaluxeServer.IsServerRunning();
+ _Texts[_TextServerNotRunning].Visible = !CVocaluxeServer.IsServerRunning();
}
public override bool HandleMouse(SMouseEvent mouseEvent)
@@ -94,7 +107,7 @@ namespace Vocaluxe.Screens
QRCodeGenerator qr = new QRCodeGenerator();
//ServerAddress
- QRCodeGenerator.QRCode qrcode = qr.CreateQrCode(CServer.GetLocalAddress() + ":" + CConfig.ServerPort, QRCodeGenerator.ECCLevel.H);
+ QRCodeGenerator.QRCode qrcode = qr.CreateQrCode(CVocaluxeServer.GetServerAddress(), QRCodeGenerator.ECCLevel.H);
_QRServerAddress = CDraw.AddTexture(qrcode.GetGraphic(20));
//Android