예제 #1
0
 void ExecuteOnce(HubInfo hubInfo)
 {
     if (!IsExecuted())
     {
         Execute(hubInfo);
     }
 }
예제 #2
0
        void TimerCallback(Object stateInfo)
        {
            var hubInfo = new HubInfo
            {
                Url      = HubUrl,
                User     = ApiUser,
                Password = ApiPassword,
                Key      = ApiKey,
            };

            loggingConnection.ExecuteOnceAsync(hubInfo);
#if DEBUG
            Stopwatch watch = new Stopwatch();
            watch.Start();
#endif
            queueBuffer.SendAll(loggingConnection);

#if DEBUG
            watch.Stop();
            if (watch.ElapsedMilliseconds > 1)
            {
                Console.WriteLine("Send all in milliseconds: " + watch.ElapsedMilliseconds);
            }
#endif

            timer.Change(1000, Timeout.Infinite);// 1 second is a good number, with optimal performance, 0.5 second does not make performance noticablly better.
        }
예제 #3
0
        void TimerCallback(Object stateInfo)
        {
            var hubInfo = new HubInfo
            {
                Url      = HubUrl,
                User     = ApiUser,
                Password = ApiPassword,
                Key      = ApiKey,
            };

            loggingConnection.ExecuteOnceAsync(hubInfo);
#if DEBUG
            Stopwatch watch = new Stopwatch();
            watch.Start();
#endif
            var status = queueBuffer.SendAll((ts) => { return(loggingConnection.Invoke("UploadTraces", ts)); });

#if DEBUG
            watch.Stop();
            if (status == QueueStatus.Sent)
            {
                Console.WriteLine("Send all in milliseconds: " + watch.ElapsedMilliseconds);
            }
            else if (status == QueueStatus.Failed)
            {
                Console.WriteLine("Traces buffered not sent yet because of network problems.");
            }
#endif

            timer.Change(1000, Timeout.Infinite);// 1 second is a good number, with optimal performance, 0.5 second does not make performance noticablly better.
        }
예제 #4
0
        bool Execute(HubInfo hubInfo)
        {
            this.hubInfo = hubInfo;
            if (String.IsNullOrEmpty(hubInfo.Url))
            {
                throw new AbortException("The config file does not define app setting loggingHub which should be the URL that this program should listen to. Please input one and press Enter, or just press Enter to exit.");
            }

            isAnonymous = String.Equals(hubInfo.User, "anonymous", StringComparison.CurrentCultureIgnoreCase);

            var ok = DoFunctionRepeatedly(20, ConnectHub);

            return(ok);
        }
예제 #5
0
        public void ExecuteOnceAsync(HubInfo hubInfo)
        {
            Action <HubInfo> d = ExecuteOnce;

            d.BeginInvoke(hubInfo, null, null);
        }