Esempio n. 1
0
        /// <summary>
        /// Load XML data from a file and create a TCPCommands instance from it.
        /// </summary>
        /// <param name="filePath">Contains the path to the XML file</param>
        /// <returns>A new TCPCommands instance with data.</returns>
        public static TCPCommands LoadFromFile(String filePath)
        {
            TCPCommands tempResult = TCPCommands.LoadFromFileInternal(filePath);

            tempResult.InitializeDictionaries();

            return(tempResult);
        }
 /// <summary>
 /// Deserializes workflow markup into an TCPCommands object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output TCPCommands object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out TCPCommands obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(TCPCommands);
     try
     {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
        /// <summary>
        /// Initializes a new <see cref="ZusiTcpClientConnection"/> object that uses the specified event handlers to pass datasets to the client application.
        /// </summary>
        /// <param name="clientId">Identifies the client to the server. Use your application's name for this.</param>
        /// <param name="priority">Client priority. Determines measurement update frequency. Recommended value for control desks: "High"</param>
        /// <param name="commands">A set of commands.</param>
        public ZusiTcpClientConnection(string clientId, ClientPriority priority, TCPCommands commands)
        {
            if (SynchronizationContext.Current == null)
            {
                throw new ZusiTcpException("Cannot create TCP connection object: SynchronizationContext.Current is null. " +
                                           "This happens when the object is created before the context is initialized in " +
                                           "Application.Run() or equivalent. " +
                                           "Possible solution: Create object later, e.g. when the user clicks the \"Connect\" button.");
            }

            ClientId       = clientId;
            ClientPriority = priority;

            _hostContext = SynchronizationContext.Current;

            _commands = commands;
        }
 public static bool LoadFromFileInternal(string fileName, out TCPCommands obj)
 {
     System.Exception exception = null;
     return LoadFromFileInternal(fileName, out obj, out exception);
 }
 public static bool LoadFromFileInternal(string fileName, out TCPCommands obj, out System.Exception exception)
 {
     return LoadFromFileInternal(fileName, Encoding.UTF8, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TCPCommands object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TCPCommands object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFileInternal(string fileName, System.Text.Encoding encoding, out TCPCommands obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TCPCommands);
     try
     {
         obj = LoadFromFileInternal(fileName, encoding);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out TCPCommands obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an TCPCommands object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output TCPCommands object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out TCPCommands obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TCPCommands);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 /// <summary>
 /// Initializes a new <see cref="ZusiTcpClientConnection"/> object that uses the specified event handlers to pass datasets to the client application.
 /// </summary>
 /// <param name="clientId">Identifies the client to the server. Use your application's name for this.</param>
 /// <param name="priority">Client priority. Determines measurement update frequency. Recommended value for control desks: "High"</param>
 /// <param name="commandsetPath">Path to the XML file containing the command set.</param>
 public ZusiTcpClientConnection(string clientId, ClientPriority priority, String commandsetPath = "commandset.xml") :
     this(clientId, priority, TCPCommands.LoadFromFile(commandsetPath))
 {
 }
 public ZusiTcpConn(string clientId, ClientPriority priority, TCPCommands commands) : base(clientId, priority, commands)
 {
 }
 public static bool LoadFromFileInternal(string fileName, out TCPCommands obj)
 {
     System.Exception exception = null;
     return(LoadFromFileInternal(fileName, out obj, out exception));
 }
 public static bool LoadFromFileInternal(string fileName, out TCPCommands obj, out System.Exception exception)
 {
     return(LoadFromFileInternal(fileName, Encoding.UTF8, out obj, out exception));
 }
 /// <summary>
 /// Deserializes xml markup from file into an TCPCommands object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TCPCommands object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFileInternal(string fileName, System.Text.Encoding encoding, out TCPCommands obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(TCPCommands);
     try
     {
         obj = LoadFromFileInternal(fileName, encoding);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
 public static bool Deserialize(string xml, out TCPCommands obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }