예제 #1
0
        // Token: 0x0600018C RID: 396 RVA: 0x000079D4 File Offset: 0x00005BD4
        private async void CalculateCounters()
        {
            try
            {
                RemoteClientInformation[]   items            = this.Logs.Collection.ToArray <RemoteClientInformation>();
                Dictionary <string, double> countrisCounters = await this.CalcCountries(items);

                this.CountrisCounters = countrisCounters;
                object obj = this.countryLock;
                lock (obj)
                {
                    this.Top10.Clear();
                    this.Top10.Add(string.Format("  {0,-10} {1,9}", "Country", "Count"));
                    this.Top10.Add(string.Empty);
                    if (this.CountrisCounters.Count > 0)
                    {
                        this.Top10.Add(from item in (from x in this.CountrisCounters
                                                     orderby x.Value descending
                                                     select x).Take(10)
                                       select string.Format("    {0,-8} {1,7}", item.Key, item.Value));
                    }
                }
            }
            catch (Exception ex)
            {
                SystemMessageHandler onSystemLog = this.OnSystemLog;
                if (onSystemLog != null)
                {
                    onSystemLog("LogsViewModel", "CalculateCounters error: " + ex.ToString());
                }
            }
        }
예제 #2
0
        public IQFeed()
        {
            Random rand = new Random();

            hIqFeed = rand.Next(1, 99);

            IQFeedCBObjRef = this;                    // used for static return by OnIQFeedLoggedIn

            htWatchSymbols = new Hashtable(2 * 1300); // 2 * max symbols from iqfeed

            HandleSystemMessage      += new SystemMessageHandler(ProcessSystemMessage);
            HandleUpdateMessage      += new UpdateMessageHandler(SymbolSpecificUpdateMessage);
            HandleSummaryMessage     += new SummaryMessageHandler(SymbolSpecificSummaryMessage);
            HandleFundamentalMessage += new FundamentalMessageHandler(SymbolSpecificFundamentalMessage);
            HandleNewsMessage        += new NewsMessageHandler(SymbolSpecificNewsMessage);

            RegistryKey rk = Registry.LocalMachine.OpenSubKey("Software\\DTN\\IQFeed");

            sIQ32DLLPath = (string)rk.GetValue("EXEDIR", "");
            rk.Close();
            string newPath = Environment.GetEnvironmentVariable("Path");

            newPath += ";" + sIQ32DLLPath;
            Environment.SetEnvironmentVariable("Path", newPath);
        }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     _TweetPanelManager    = GameObject.Find("TweetPanelManager").GetComponent <TweetPanelManager>();
     _SystemMessageHandler = GameObject.Find("SystemMessageHandler").GetComponent <SystemMessageHandler>();
     _NotificationHandler  = GameObject.Find("NotificationHandler").GetComponent <NotificationHandler>();
     Invoke("StartMyStream", 1f);
 }
예제 #4
0
        /// <summary>
        /// This method is run by the calling thread of Run so as not to interupt the
        /// message processing pump.
        /// </summary>
        /// <param name="msg"></param>
        private void DoDispatchMessage(IMessage msg)
        {
            if (msg.Type == Enums.SystemPacketType.CarType)
            {
                CarMessageHandler.Invoke(msg);
            }
            else if (msg.Type == Enums.SystemPacketType.ControlType)
            {
                if (ControlMessageHandler != null)
                {
                    ControlMessageHandler.Invoke(msg);
                }
            }
            else
            {
                if (msg is EndOfSession)
                {
                    // Tell the thread to stop blocking and exit after it's processed the remainder of messages.
                    Stop(JoinMethod.DontJoin, false);
                }

                if (msg is EventId)
                {
                    CurrentEventType = (msg as EventId).EventType;
                }

                SystemMessageHandler.Invoke(msg);
            }
        }
예제 #5
0
        // Token: 0x0600018E RID: 398 RVA: 0x00007A60 File Offset: 0x00005C60
        public override void Load()
        {
            this.StorageOfCounters.Load();
            this.PathsToLogs.Load();
            this.Logs.Collection.ListChanged += delegate(object _, ListChangedEventArgs args)
            {
                this.CalculateCounters();
            };
            SystemMessageHandler onSystemLog = this.OnSystemLog;

            if (onSystemLog == null)
            {
                return;
            }
            onSystemLog("LogsViewModel", "Loaded");
        }
예제 #6
0
 // Token: 0x0600018D RID: 397 RVA: 0x00007A10 File Offset: 0x00005C10
 private async Task <Dictionary <string, double> > CalcCountries(IEnumerable <RemoteClientInformation> items)
 {
     return(await Task.Factory.StartNew <Dictionary <string, double> >(delegate()
     {
         Dictionary <string, double> result;
         try
         {
             result = items.CountBy((RemoteClientInformation x) => x.Country);
         }
         catch (Exception ex)
         {
             SystemMessageHandler onSystemLog = this.OnSystemLog;
             if (onSystemLog != null)
             {
                 onSystemLog("LogsViewModel", "CalcCountriesTask error: " + ex.ToString());
             }
             result = new Dictionary <string, double>();
         }
         return result;
     }));
 }
예제 #7
0
 public void RegisterMessageState(string message, SystemMessageHandler handler)
 {
     _systemMessageHandlers[message] = handler;
 }