Fix NC comunication
Added UI connection tooltip
This commit is contained in:
@@ -17,22 +17,15 @@ namespace Step.UI
|
||||
{
|
||||
String HomePageUI;
|
||||
String TestJSPageUI;
|
||||
|
||||
bool ncStatus = false;
|
||||
public ServerControlWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
HomePageUI = "http://localhost:" + ServerConfig.ServerPort.ToString() + "/index.html";
|
||||
TestJSPageUI = "http://localhost:" + ServerConfig.ServerPort.ToString() + "/Testjavascript//index.html";
|
||||
MessageServices.Current.Subscribe(SEND_MESSAGE, (a, b) =>
|
||||
{
|
||||
// Cast object to ErrorMessageModel
|
||||
ErrorMessageModel message = (ErrorMessageModel)a;
|
||||
// If error has a fatal level, icon must be error
|
||||
message.ErrorLevel = message.ErrorLevel > (int)ERROR_LEVEL.ERROR ? (int)ERROR_LEVEL.ERROR : message.ErrorLevel;
|
||||
// Open BalloonTip with data
|
||||
StepNotifyIcon.ShowBalloonTip(1000, message.Title, message.Message, (ToolTipIcon)message.ErrorLevel);
|
||||
});
|
||||
|
||||
InitializeMessageListeners();
|
||||
}
|
||||
|
||||
private static ServerControlWindow ctrlwindow = null;
|
||||
@@ -106,15 +99,15 @@ namespace Step.UI
|
||||
{
|
||||
//Setup the Path Variable
|
||||
String CMSClientPath = "";
|
||||
|
||||
|
||||
//Check if the system is 64/32 bit
|
||||
if (Environment.Is64BitOperatingSystem && File.Exists(Environment.CurrentDirectory + @"\Client\x64\CMS_Client.exe"))
|
||||
CMSClientPath = Environment.CurrentDirectory + @"\Client\x64\CMS_Client.exe";
|
||||
|
||||
else if (File.Exists(Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe"))
|
||||
CMSClientPath = Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe";
|
||||
CMSClientPath = Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe";
|
||||
|
||||
if(!String.IsNullOrEmpty(CMSClientPath))
|
||||
if (!String.IsNullOrEmpty(CMSClientPath))
|
||||
Process.Start(CMSClientPath, url);
|
||||
else
|
||||
MessageBox.Show("CMS_Client.Exe not found");
|
||||
@@ -126,5 +119,41 @@ namespace Step.UI
|
||||
|
||||
StartCMSClient(TestJSPageUI);
|
||||
}
|
||||
|
||||
private void InitializeMessageListeners()
|
||||
{
|
||||
MessageServices.Current.Subscribe(SEND_MESSAGE, (a, b) =>
|
||||
{
|
||||
// Cast object to ErrorMessageModel
|
||||
ErrorMessageModel message = (ErrorMessageModel)a;
|
||||
// If error has a fatal level, icon must be error
|
||||
message.ErrorLevel = message.ErrorLevel > (int)ERROR_LEVEL.ERROR ? (int)ERROR_LEVEL.ERROR : message.ErrorLevel;
|
||||
// Open BalloonTip with data
|
||||
StepNotifyIcon.ShowBalloonTip(1000, message.Title, message.Message, (ToolTipIcon)message.ErrorLevel);
|
||||
});
|
||||
|
||||
MessageServices.Current.Subscribe(NC_STATUS, (a, b) =>
|
||||
{
|
||||
bool newNcStatus = (bool)a;
|
||||
|
||||
if(ncStatus != newNcStatus)
|
||||
{
|
||||
ncStatus = newNcStatus;
|
||||
string title = "NC not connected";
|
||||
string message = "Check NC connection";
|
||||
ToolTipIcon toolTipIcon = ToolTipIcon.Error;
|
||||
|
||||
if (ncStatus == true)
|
||||
{
|
||||
title = "Nc connection established";
|
||||
message = "Comunication started";
|
||||
toolTipIcon = ToolTipIcon.Info;
|
||||
}
|
||||
|
||||
// Open BalloonTip with data
|
||||
StepNotifyIcon.ShowBalloonTip(1000, title, message, toolTipIcon);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user