예제 #1
0
        public ApplicationManager(ICommunicationManager comMgr)
            : base()
        {
            string logMessage = string.Format("Class: {0}, Method: {1}", "ApplicationManager", "ApplicationManager(ICommunicationManager comMgr)");
            LogUtil.WriteLog(LogLevel.INFO, logMessage);

            Initialize(comMgr);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharactersManager"/> class.
 /// </summary>
 /// <param name="comms"></param>
 public CharactersManager(ICommunicationManager comms)
 {
     this.comms = comms;
     this.comms.Event(CharacterEvents.Selecting).FromServer().On <Character>((e, c) => this.Selecting?.Invoke(this, new CharacterEventArgs(c)));
     this.comms.Event(CharacterEvents.Selected).FromServer().On <CharacterSession>((e, c) => this.Selected?.Invoke(this, new CharacterSessionEventArgs(c)));
     this.comms.Event(CharacterEvents.Deselecting).FromServer().On <CharacterSession>((e, c) => this.Deselecting?.Invoke(this, new CharacterSessionEventArgs(c)));
     this.comms.Event(CharacterEvents.Deselected).FromServer().On <CharacterSession>((e, c) => this.Deselected?.Invoke(this, new CharacterSessionEventArgs(c)));
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DesignModeClient"/> class.
 /// </summary>
 /// <param name="communicationManager">
 /// The communication manager.
 /// </param>
 /// <param name="dataSerializer">
 /// The data Serializer.
 /// </param>
 /// <param name="platformEnvironment">
 /// The platform Environment
 /// </param>
 internal DesignModeClient(ICommunicationManager communicationManager, IDataSerializer dataSerializer, IEnvironment platformEnvironment)
 {
     this.communicationManager     = communicationManager;
     this.dataSerializer           = dataSerializer;
     this.platformEnvironment      = platformEnvironment;
     this.testSessionMessageLogger = TestSessionMessageLogger.Instance;
     this.testSessionMessageLogger.TestRunMessage += this.TestRunMessageHandler;
 }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestCaseEventHandler"/> class.
 /// </summary>
 /// <param name="communicationManager">
 /// </param>
 internal DataCollectionRequestHandler(ICommunicationManager communicationManager, IMessageSink messageSink, IDataCollectionManager dataCollectionManager, IDataCollectionTestCaseEventHandler dataCollectionTestCaseEventHandler)
 {
     this.communicationManager  = communicationManager;
     this.messageSink           = messageSink;
     this.dataCollectionManager = dataCollectionManager;
     this.dataCollectionTestCaseEventHandler = dataCollectionTestCaseEventHandler;
     this.cancellationTokenSource            = new CancellationTokenSource();
 }
예제 #5
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance, 
     IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance = persistance;
     _memoryManager = memoryManager;
     _commandLine = commandLine;
     _perfCounters = perfCounters;
 }
예제 #6
0
        public StrategyEngine(ICommunicationManager comMgr)
            : base()
        {
            string logMessage = string.Format("Class: {0}, Method: {1}, StrategyEngine Started", "StrategyEngine", "StrategyEngine(..)");
            LogUtil.WriteLog(LogLevel.INFO, logMessage);

            this.ComMgr = comMgr;
            comMgr.StrategyEngine = this;
        }
예제 #7
0
        public BankingController(ILogger logger, Configuration configuration, ICommunicationManager comms) : base(logger, configuration)
        {
            this.comms = comms;

            // Send configuration when requested
            this.comms.Event(BankingEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));
            this.comms.Event(BankingEvents.GetATMs).FromClients().OnRequest(e => e.Reply(this.GetATMs()));
            this.comms.Event(BankingEvents.GetBranches).FromClients().OnRequest(e => e.Reply(this.GetBranches()));
        }
예제 #8
0
 /// <summary>
 /// Create an instance of the profiler manager
 /// </summary>
 /// <param name="communicationManager"></param>
 /// <param name="persistance"></param>
 /// <param name="memoryManager"></param>
 /// <param name="commandLine"></param>
 /// <param name="perfCounters"></param>
 public ProfilerManager(ICommunicationManager communicationManager, IPersistance persistance,
                        IMemoryManager memoryManager, ICommandLine commandLine, IPerfCounters perfCounters)
 {
     _communicationManager = communicationManager;
     _persistance          = persistance;
     _memoryManager        = memoryManager;
     _commandLine          = commandLine;
     _perfCounters         = perfCounters;
 }
 public ProfilerManagerFactory(ICommunicationManager communicationManager,
                               IPersistance persistance,
                               IMemoryManager memoryManager,
                               ICommandLine commandLine)
 {
     _communicationManager = communicationManager;
     _persistance          = persistance;
     _memoryManager        = memoryManager;
     _commandLine          = commandLine;
 }
예제 #10
0
        public ChatController(ILogger logger, Configuration configuration, ICommunicationManager comms) : base(logger, configuration)
        {
            this._comms = comms;

            // Send configuration when requested
            comms.Event(ChatEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));

            // Listen to new client messages
            comms.Event(ChatEvents.MessageEntered).FromClients().On <string>(MessageEntered);
        }
예제 #11
0
        public CharactersCustomizationController(ILogger logger, CharactersCustomizationConfiguration configuration, ICommunicationManager comms, IClientList clientList, CharactersManager charactersManager) : base(logger, configuration)
        {
            this.comms             = comms;
            this.clientList        = clientList;
            this.charactersManager = charactersManager;

            // Send configuration when requested
            this.comms.Event(CharacterCustomizationEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));

            charactersManager.Selected += OnCharacterSelected;
        }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestRequestSender"/> class.
        /// </summary>
        /// <param name="communicationManager">Communication Manager for sending and receiving messages.</param>
        /// <param name="connectionInfo">ConnectionInfo to set up transport layer</param>
        /// <param name="dataSerializer">Serializer for serialization and deserialization of the messages.</param>
        /// <param name="protocolConfig">Protocol related information</param>
        internal TestRequestSender(ICommunicationManager communicationManager, TestHostConnectionInfo connectionInfo, IDataSerializer dataSerializer, ProtocolConfig protocolConfig)
        {
            this.highestSupportedVersion = protocolConfig.Version;
            this.communicationManager    = communicationManager;

            // The connectionInfo here is that of RuntimeProvider, so reverse the role of runner.
            connectionInfo.Role = connectionInfo.Role == ConnectionRole.Host
                                                ? ConnectionRole.Client
                                                : ConnectionRole.Host;

            this.transport      = new SocketTransport(communicationManager, connectionInfo);
            this.dataSerializer = dataSerializer;
        }
예제 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel(ILogger logger, ICommunicationManager communicationManager)
        {
            this.logger = logger ?? throw new ArgumentNullException(paramName: nameof(logger));
            this.communicationManager = communicationManager ?? throw new ArgumentNullException(paramName: nameof(communicationManager));

            this.communicationManager.OnNewMessage += (s, e) =>
            {
                if (this.connected)
                {
                    while (this.messages.Count >= MaxMessageCount)
                    {
                        this.messages.TryDequeue(out var message);
                    }

                    UserViewModel user;
                    if (this.users.TryGetValue(e.Message.OwnerId, out user))
                    {
                        this.messages.Enqueue(new MessageViewModel(e.Message, user.User));
                        this.RaisePropertyChanged(() => this.Messages);
                    }
                }
            };

            this.communicationManager.OnUserUpdate += async(s, e) =>
            {
                if (this.connected)
                {
                    if (e.FullUpdate || !this.users.ContainsKey(e.UserId))
                    {
                        this.users[key : e.UserId] = new UserViewModel(await this.communicationManager.LoadUserAsync(e.UserId));
                        this.RaisePropertyChanged(() => this.UserName);
                        this.RaisePropertyChanged(() => this.Image);
                        this.RaisePropertyChanged(() => this.HasImage);
                        this.RaisePropertyChanged(() => this.NeedImage);
                    }
                    else if (this.users.ContainsKey(e.UserId))
                    {
                        if (e.State == Model.UserState.Deleted)
                        {
                            this.users.TryRemove(e.UserId, out var user);
                        }
                        else
                        {
                            this.users[e.UserId].State = e.State;
                        }
                    }

                    this.RaisePropertyChanged(() => this.Users);
                }
            };
        }
예제 #14
0
        public TimeController(ILogger logger, Configuration configuration, ICommunicationManager comms) : base(logger, configuration)
        {
            this.comms = comms;

            // Send configuration when requested
            this.comms.Event(TimeEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));

            // Send current time when requested
            this.comms.Event(TimeEvents.Sync).FromClients().OnRequest(e => e.Reply(this.Configuration.RealTime ? DateTime.UtcNow.TimeOfDay : this.serverTime));

            // Send sync configuration to other plugins when requested
            this.comms.Event(TimeEvents.IsRealTime).FromServer().OnRequest(e => e.Reply(this.Configuration.RealTime));

            // Send current time to other plugins when requested
            this.comms.Event(TimeEvents.Get).FromServer().OnRequest(e => e.Reply(this.serverTime));

            // Listen for time update requests from other plugins
            this.comms.Event(TimeEvents.Set).FromServer().On <TimeSpan>((e, t) =>
            {
                if (this.Configuration.RealTime)
                {
                    return;
                }

                this.serverTime = t;

                Broadcast();
            });

            // Setup start time
            this.serverTime   = this.Configuration.BootTime;
            this.previousTime = DateTime.UtcNow;

            // Start timers
            this.timeUpdateTimer = new Timer
            {
                AutoReset = true,
                Enabled   = true,
                Interval  = 1000
            };
            this.timeUpdateTimer.Elapsed += Update;

            this.timeBroadcastTimer = new Timer
            {
                AutoReset = true,
                Enabled   = true,
                Interval  = this.Configuration.SyncRate.TotalMilliseconds
            };
            this.timeBroadcastTimer.Elapsed += (s, e) => Broadcast();
        }
예제 #15
0
        protected Service(ILogger logger, ITickManager ticks, ICommunicationManager comms, ICommandManager commands, IOverlayManager overlayManager, User user)
        {
            this.Logger         = logger;
            this.Ticks          = ticks;
            this.Comms          = comms;
            this.Commands       = commands;
            this.OverlayManager = overlayManager;
            this.User           = user;

            // Load empty default catalog
            this.Catalog = new LocaleCatalog(new Catalog(CultureInfo.InvariantCulture));

            var type = GetType();

            // Get all embedded resources
            var catalogs = type.Assembly.GetManifestResourceNames();

            if (!catalogs.Any())
            {
                return;
            }

            // Match found cultures with server cultures
            var matches = ClientConfiguration.Locale.Culture.Where(c => catalogs.Contains($"{type.Namespace}.Locales.{c.Name}.mo")).ToList();

            foreach (var culture in matches)
            {
                using (var resourceStream = type.Assembly.GetManifestResourceStream($"{type.Namespace}.Locales.{culture.Name}.mo"))
                {
                    if (resourceStream == null)
                    {
                        continue;
                    }

                    try
                    {
                        // Load MO file locale
                        this.Catalog = new LocaleCatalog(new Catalog(new MoLoader(resourceStream, new MoFileParser(Encoding.UTF8, false)), culture));

                        this.Logger.Debug($"Loaded locale: {type.Namespace}.Locales.{culture.Name}.mo");

                        break;
                    }
                    catch (Exception ex)
                    {
                        this.Logger.Error(ex, $"Loading plugin locale catalog failed: {type.Namespace}.Locales.{culture.Name}.mo");
                    }
                }
            }
        }
예제 #16
0
        public OdometryBoard(ICommunicationManager communicationManager, double wheelClicks, double wheelRadius, double wheelDistance)
        {
            manager       = communicationManager;
            WheelClicks   = wheelClicks;
            WheelDistance = wheelDistance;
            WheelRadius   = wheelRadius;
            var tmp = (from command in Observable.FromEventPattern <CommandCompletedEventArgs>(manager, "CommandCompleted")
                       where command.EventArgs.UserState == this
                       select ParseOdometryResponse(command.EventArgs.Response, WheelClicks, WheelRadius, WheelDistance))
                      .Select((m, i) => i < 1 ? new OdometryMeasurement() : m).Publish();

            tmp.Connect();
            Odometry = tmp;
        }
예제 #17
0
        public MarkersController(ILogger logger, Configuration configuration, ICommunicationManager comms, MarkersManager markerManager) : base(logger, configuration)
        {
            this.comms         = comms;
            this.markerManager = markerManager;

            // Send configuration when requested
            comms.Event(MarkersEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));

            comms.Event(MarkersEvents.GetAllMarkers).FromClients().OnRequest(GetAllMarkersEvent);
            if (this.Configuration.editMode)
            {
                comms.Event(MarkersEvents.AddMarker).FromClients().OnRequest <Marker>(AddMarkerEvent);
                comms.Event(MarkersEvents.RemoveMarker).FromClients().OnRequest <Guid>(RemoveMarkerEvent);
            }
        }
예제 #18
0
        public DifferentialSteeringBoard(ICommunicationManager communicationManager, double wheelRadius, int wheelClicks, float accelerationWeight, float breakingWeight)
        {
            previousVelocity = new WheelVelocity();
            currentVelocity  = new WheelVelocity();
            manager          = communicationManager;
            CommandChecksum  = from command in Observable.FromEventPattern <CommandCompletedEventArgs>(manager, "CommandCompleted")
                               where command.EventArgs.UserState == this
                               select ParseMotorActuatorResponse(command.EventArgs.Response);

            WheelRadius = wheelRadius;
            WheelClicks = wheelClicks;;

            this.accelerationWeight = accelerationWeight;
            this.breakingWeight     = breakingWeight;
        }
예제 #19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataCollectionRequestHandler"/> class.
 /// </summary>
 /// <param name="communicationManager">
 /// The communication manager.
 /// </param>
 /// <param name="messageSink">
 /// The message sink.
 /// </param>
 /// <param name="dataCollectionManager">
 /// The data collection manager.
 /// </param>
 /// <param name="dataCollectionTestCaseEventHandler">
 /// The data collection test case event handler.
 /// </param>
 /// <param name="dataSerializer">
 /// Serializer for serialization and deserialization of the messages.
 /// </param>
 /// <param name="fileHelper">
 /// File Helper
 /// </param>
 protected DataCollectionRequestHandler(
     ICommunicationManager communicationManager,
     IMessageSink messageSink,
     IDataCollectionManager dataCollectionManager,
     IDataCollectionTestCaseEventHandler dataCollectionTestCaseEventHandler,
     IDataSerializer dataSerializer,
     IFileHelper fileHelper)
 {
     this.communicationManager  = communicationManager;
     this.messageSink           = messageSink;
     this.dataCollectionManager = dataCollectionManager;
     this.dataSerializer        = dataSerializer;
     this.dataCollectionTestCaseEventHandler = dataCollectionTestCaseEventHandler;
     this.cancellationTokenSource            = new CancellationTokenSource();
     this.fileHelper = fileHelper;
 }
예제 #20
0
        private static void SendData2(ICommunicationManager communicationManager, Stopwatch watch)
        {
            var dataBytes = new byte[65536];

            for (int i = 0; i < dataBytes.Length; i++)
            {
                dataBytes[i] = 0x65;
            }

            var dataBytesStr = System.Text.Encoding.UTF8.GetString(dataBytes);

            watch.Start();
            for (int i = 0; i < 20000; i++)
            {
                communicationManager.SendRawMessage(dataBytesStr);
            }
        }
예제 #21
0
        protected Node(NodeInfo identity, NodeConfiguration config)
        {
            Config      = config;
            Identity    = identity;
            Predecessor = Identity;

            Clock = Config.Clock;
            CorrelationFactory = Config.CorrelationFactory;
            Janitor            = new DisposableStack();
            MessageBus         = new MemoryBus();
            Poller             = Janitor.Push(new NetMQPoller());
            Logger             = Config.LoggerDelegate;
            Marshaller         = Config.MarshallerFactory.Create();

            ExpiryCalculator = Config.ExpiryCalculator;

            Log($"Binding to {Config.NodeSocketFactory.BindingConnectionString(Identity.HostAndPort)}");
            ListeningSocket   = Janitor.Push(Config.NodeSocketFactory.CreateBindingSocket(Identity.HostAndPort));
            ForwardingSockets = Janitor.Push(new SocketCache(Config.NodeSocketFactory, Clock)); // Chicken and egg scenario where we require an actor!

            CommunicationManager = config.CommunicationManagerFactory.Create(Identity, Marshaller, ForwardingSockets, MessageBus, Log);

            Actor = Janitor.Push(CreateActor());
            ForwardingSockets.AddActor(Identity.HostAndPort, Actor);

            Janitor.Push(new DisposableAction(() => { Poller.Remove(ListeningSocket); }));
            Janitor.Push(new DisposableAction(
                             () => { ListeningSocket.ReceiveReady += ListeningSocketReceiveReady; },
                             () => { ListeningSocket.ReceiveReady -= ListeningSocketReceiveReady; }));

            ActionScheduler = Janitor.Push(new NodeActionScheduler(Clock, Config.ActionTimerFactory.Create(), Marshaller, Actor));
            MessageBus.Subscribe(new NodeHandler(this, ActionScheduler));
            var awaitHandler = Janitor.Push(new AwaitAckHandler(ActionScheduler, ExpiryCalculator, Marshaller, Actor, Log, Config.AwaitSettings));

            MessageBus.Subscribe(awaitHandler);
            MessageBus.Subscribe(new JoinNetworkHandler(this, CommunicationManager));
            MessageBus.Subscribe(new StabilizeHandler(this, CommunicationManager));
            MessageBus.Subscribe(new RectifyHandler(this, CommunicationManager));
            MessageBus.Subscribe(new NotifyHandler(this, CommunicationManager));

            FingerTable    = new FingerTable(Identity, Identity.RoutingHash.BitCount);
            SuccessorTable = new SuccessorTable(Identity, Config.SuccessorCount);

            // Let everything know we're ready to go.
            CommunicationManager.SendInternal(new NodeInitialised());
        }
예제 #22
0
        private static void SendData(ICommunicationManager communicationManager)
        {
            // Having less than the buffer size in SocketConstants.BUFFERSIZE.
            var dataBytes = new byte[2048];

            for (int i = 0; i < dataBytes.Length; i++)
            {
                dataBytes[i] = 0x65;
            }

            var dataBytesStr = Encoding.UTF8.GetString(dataBytes);

            for (int i = 0; i < 5; i++)
            {
                communicationManager.SendRawMessage(dataBytesStr);
            }
        }
예제 #23
0
    private void InitializeControlCenter(GameObject self, BehaviourStrategy defaultStrategy)
    {
        StrategyManager = new StrategyManager(defaultStrategy)
        {
            EnableBehaviourSwitcing  = false,
            EnableMultipleStrategies = false
        };

        ArbitrationManager = new ArbitrationManager
        {
            EnableArbitrationRules = false,
        };

        CommunicationManager = new CommunicationManager(self)
        {
            EnableBroadcasting = false
        };
    }
        /// <summary>
        /// Creates singleton instance of DataCollectionRequestHandler.
        /// </summary>
        /// <param name="communicationManager">
        /// Handles socket communication.
        /// </param>
        /// <param name="messageSink">
        /// Message sink for sending messages to execution process.
        /// </param>
        /// <returns>
        /// The instance of <see cref="DataCollectionRequestHandler"/>.
        /// </returns>
        public static DataCollectionRequestHandler Create(ICommunicationManager communicationManager, IMessageSink messageSink)
        {
            if (Instance == null)
            {
                ValidateArg.NotNull(communicationManager, nameof(communicationManager));
                ValidateArg.NotNull(messageSink, nameof(messageSink));

                lock (syncObject)
                {
                    if (Instance == null)
                    {
                        Instance = new DataCollectionRequestHandler(communicationManager, messageSink, DataCollectionManager.Create(messageSink), new DataCollectionTestCaseEventHandler());
                    }
                }
            }

            return(Instance);
        }
예제 #25
0
        //----< Connect repeatedly tries to send messages to service >-------

        public bool Connect(string RemoteURL)
        {
            if (UtilityMethods.verbose)
            {
                sendMsgNotify("attempting to connect");
            }
            if (isConnected(RemoteURL))
            {
                return(true);
            }
            Proxy = CreateProxy(RemoteURL);
            int     attemptNumber = 0;
            Message startMsg      = new Message();

            startMsg.FromURL        = LocalURL;
            startMsg.ToURL          = RemoteURL;
            startMsg.TimeSent       = DateTime.Now;
            startMsg.MessageContent = "connection start message";
            while (attemptNumber < MaxConnectAttempts)
            {
                try
                {
                    Proxy.sendMessage(startMsg);                                          // will throw if server isn't listening yet
                    ProxyAndDeadLetterQ ProxyAndDLQ = new ProxyAndDeadLetterQ();
                    ProxyAndDLQ.PROXY  = Proxy;
                    ProxyDB[RemoteURL] = ProxyAndDLQ;  // remember this Proxy


                    if (UtilityMethods.verbose)
                    {
                        sendMsgNotify("connected");
                    }
                    return(true);
                }
                catch
                {
                    ++attemptNumber;
                    sendAttemptNotify(attemptNumber);
                    Thread.Sleep(100);
                }
            }
            return(false);
        }
예제 #26
0
        public MainPage()
        {
            var useGoogle = true;

            InitializeComponent();

            var host = "https://westeurope.tts.speech.microsoft.com/cognitiveservices/v1";

            communicationManager = useGoogle
                ? new CommunicationManagerGoogle()
                : (ICommunicationManager) new CommunicationManagerAzure(host);
            communicationManager.TranscriptReceived += CommunicationManager_TranscriptReceived;

            SystemNavigationManagerPreview.GetForCurrentView().CloseRequested +=
                async(sender, args) =>
            {
                args.Handled = true;
                Application.Current.Exit();
            };
        }
예제 #27
0
        public NFundamentalsCharactersController(ILogger logger, CharactersConfiguration config, ICommunicationManager comms) : base(logger, config)
        {
            this.comms = comms;
            // Send configuration when requested
            comms.Event(CharacterEvents.Configuration).FromClients().OnRequest(e => e.Reply(this.Configuration));

            // Character events
            comms.Event(CharacterEvents.GetAllForUser).FromClients().OnRequest(GetAllCharactersForUser);
            comms.Event(CharacterEvents.Create).FromClients().OnRequest <Character>(CreateCharacter);
            comms.Event(CharacterEvents.Delete).FromClients().OnRequest <Guid>(DeleteCharacter);
            comms.Event(CharacterEvents.Select).FromClients().OnRequest <Guid>(SelectCharacter);
            comms.Event(CharacterEvents.SaveCharacter).FromClients().On <Character>(SaveCharacter);
            comms.Event(CharacterEvents.SavePosition).FromClients().On <Guid, Position>(SaveCharacterPosition);
            comms.Event(CharacterEvents.GetById).FromClients().OnRequest <Guid>(GetCharacterById);

            // Get all active character sessions
            comms.Event(CharacterEvents.GetActiveSessions).FromServer().OnRequest(e => e.Reply(this.CharacterSessions));

            // SessionManager plugin event when a client disconnects
            comms.Event(SessionEvents.DisconnectPlayer).FromServer().On <IClient, Session>(OnPlayerDisconnected);
        }
예제 #28
0
        public ResilientCommunicationManager(ILogger <ResilientCommunicationManager> logger, ServiceFactory serviceFactory)
        {
            _policy = Policy.Handle <Exception>()
                      .Or <SocketException>()
                      .WaitAndRetryAsync(
                // number of retries
                3,
                // exponential backofff
                retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)),
                // on retry
                (exception, timeSpan, retryCount, context) =>
            {
                var msg = $"Retry {retryCount} implemented with Polly's " +
                          $"of {context.PolicyKey} " +
                          $"at {context.OperationKey}, " +
                          $"due to: {exception}.";

                logger.LogError(exception, msg);
            });

            _instance = serviceFactory.GetInstance <ComunicationManager>();
        }
예제 #29
0
 internal VsTestConsoleRequestSender(ICommunicationManager communicationManager, IDataSerializer dataSerializer, ITestPlatformEventSource testPlatformEventSource)
 {
     this.communicationManager    = communicationManager;
     this.dataSerializer          = dataSerializer;
     this.testPlatformEventSource = testPlatformEventSource;
 }
예제 #30
0
 public TimeManager(ICommunicationManager comms)
 {
     this.comms = comms;
 }
예제 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataCollectionRequestSender"/> class.
 /// </summary>
 /// <param name="communicationManager">
 /// The communication manager.
 /// </param>
 /// <param name="dataSerializer">
 /// The data serializer.
 /// </param>
 internal DataCollectionRequestSender(ICommunicationManager communicationManager, IDataSerializer dataSerializer)
 {
     this.communicationManager = communicationManager;
     this.dataSerializer       = dataSerializer;
 }
예제 #32
0
 public TestableDataCollectionRequestHandler(ICommunicationManager communicationManager, IMessageSink messageSink, IDataCollectionManager dataCollectionManager, IDataCollectionTestCaseEventHandler dataCollectionTestCaseEventHandler)
     : base(communicationManager, messageSink, dataCollectionManager, dataCollectionTestCaseEventHandler)
 {
 }
예제 #33
0
        private void Initialize(ICommunicationManager comMgr)
        {
            string logMessage = string.Format("Class: {0}, Method: {1}", "ApplicationManager", "Initialize(CommunicationManager comMgr)");
            LogUtil.WriteLog(LogLevel.INFO, logMessage);

            this.StgEngine = new StrategyEngine(comMgr);
            this.DataMgr = new DataManager();
        }
예제 #34
0
 internal TestableDesignModeClient(ICommunicationManager communicationManager,
                                   IDataSerializer dataSerializer)
     : base(communicationManager, dataSerializer)
 {
 }
 static SocketCommService()
 {
     SignonManagerInstance = SignonManager.SignonMgr as ISignonManager;
     CommunicationManagerInstance = CommunicationManager.CommMgr as ICommunicationManager;
 }