/// <summary> /// Starting actions are executed in a separate thread to keep the OnStart Method clean and fast. /// </summary> private void startingActions() { AppDomain.CurrentDomain.SetShadowCopyFiles(); WorkstationLogger.WriteLog("Initializing webservice."); WorkstationWebServiceClient ws = ServerConnection.GetWorkstationWebService(); WorkstationLogger.WriteLog("Logging " + ServerConnection.GetWorkstationName() + " in. " + " MAC: " + ServerConnection.GetMacAdress()); try { if (ServerConnection.SignIn((byte)MISD.Core.Platform.Windows)) { WorkstationLogger.WriteLog("Successfully signed in."); } else { WorkstationLogger.WriteLog("Couldn't sign in."); } WorkstationLogger.WriteLog("Starting schedulers."); Scheduling.Scheduler.Instance.Start(); } catch (Exception e) { WorkstationLogger.WriteLog("Error: " + e.Message); } }
protected override void OnStop() { WorkstationLogger.WriteLog("Stoping schedulers."); Scheduling.Scheduler.Instance.Stop(); WorkstationLogger.WriteLog("Signing " + ServerConnection.GetWorkstationName() + " out."); ServerConnection.SignOut(); WorkstationLogger.Close(); }
/// <summary> /// logs the an event sent from a workstation. /// </summary> /// <param name="message">event description</param> /// <param name="type">event type</param> /// <returns></returns> public static void WriteLog(string message, LogType type) { try { GetWorkstationWebService().WriteLog(message, type); } catch (Exception e) { WorkstationLogger.WriteLog("Couldn't write log to remote system."); } }
public static Tuple <string, long?>[] GetUpdateIntervals(string pluginName, Tuple <string, long?>[] oldUpdateIntervals) { try { return(GetWorkstationWebService().GetUpdateIntervals(ServerConnection.GetMacAdress(), pluginName)); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call GetUpdateInterval() at server."); return(oldUpdateIntervals); } }
public static bool UploadIndicatorValues(string pluginName, Tuple <string, object, DataType, DateTime>[] indicatorValues) { try { return(GetWorkstationWebService().UploadIndicatorValues(ServerConnection.GetMacAdress(), pluginName, indicatorValues)); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call UploadIndicatorValue() at server."); return(false); } }
public static Core.PluginFile[] DownloadPlugins(string[] pluginNames) { try { return(GetWorkstationWebService().DownloadPlugins(ServerConnection.GetMacAdress(), pluginNames)); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call DownloadPlugins() at server."); return(null); } }
public static TimeSpan GetMainUpdateInterval(TimeSpan oldMainUpdateIntervall) { try { return(GetWorkstationWebService().GetMainUpdateInterval()); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call GetMainUpdateInterval() at server."); return(oldMainUpdateIntervall); } }
public static Core.PluginMetadata[] GetPluginList() { try { return(GetWorkstationWebService().GetPluginList(ServerConnection.GetMacAdress())); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call GetPluginList() at server."); return(new Core.PluginMetadata[0]); } }
public static bool SignOut() { try { return(GetWorkstationWebService().SignOut(ServerConnection.GetMacAdress())); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call SignOut() at server."); return(false); } }
public static bool SignIn(byte operatingSystem) { while (true) { try { return(GetWorkstationWebService().SignIn(ServerConnection.GetWorkstationName(), ServerConnection.GetMacAdress(), operatingSystem)); } catch (Exception) { WorkstationLogger.WriteLog("Unable to call SignIn() at server."); Thread.Sleep(5000); } } }