Esempio n. 1
0
        /// <summary>
        /// Request switch.
        /// </summary>
        /// <param name="singleSwitch">Command.</param>
        public void RequestSwitch(FunctionSwitch singleSwitch)
        {
            try
            {
                loggerPool.Log(singleSwitch.ServiceType.ServiceType, new LogContentEntity()
                {
                    Message = singleSwitch.Command.ToString()
                });

                commandInvoker.Invoke <ExecuteResult>(singleSwitch);

                callback.Notify(MessageEntity.NormalInfo(singleSwitch.ServiceType, singleSwitch.Command.ToString()));
            }
            catch (Exception ex)
            {
                var fex = new FaultException(new FaultReason(ex.Message), new FaultCode("002"), "RequestSwitch");

                loggerPool.Log(singleSwitch.ServiceType.ServiceType, new LogContentEntity(fex.Message + fex.StackTrace)
                {
                    Level = "Error"
                });

                throw fex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// UnRegister a servicetype.
        /// </summary>
        /// <param name="serviceType">The given servicetype.</param>
        public void UnRegister(EServiceType serviceType)
        {
            callback = OperationContext.Current.GetCallbackChannel <IMessageCallback>();

            loggerPool.Log(serviceType.ServiceType, new LogContentEntity("Unregister!"));
            callback.Notify(MessageEntity.NormalInfo(serviceType, " Unregister"));

            Observers.Remove(serviceType, callback);
        }