Exemplo n.º 1
0
        public static string SendInitialJSONFromDataCollection(out DateTime lastModifiedTimeutc)
        {
            Dictionary <string, DataSet> tdd = new Dictionary <string, DataSet>(IODataCollection.dataDict);

            lastModifiedTimeutc = DateTime.Now;
            IODataUpdater.AddChangeEventForIODataCollection();

            string  JSON = "";
            JObject o    = new JObject(from tt in tdd
                                       where IODataCollection.FindNameListItemByName(tt.Key) != null
                                       let ds = tt.Value.Tables
                                                select new JProperty(tt.Key,
                                                                     new JObject(from DataTable table in ds
                                                                                 select new JProperty(table.TableName,
                                                                                                      new JObject((from DataRow rr in table.Rows
                                                                                                                   let rs = rr["IOName"] as string
                                                                                                                            where rs != ""
                                                                                                                            let rss = GetIOName(tt.Key, rs)
                                                                                                                                      group rss by rss into rsg
                                                                                                                                      orderby rsg.Key ascending
                                                                                                                                      select new JProperty(rsg.Key,
                                                                                                                                                           GenJSONJArrayFromDataCollection(tdd, tt.Key, table.TableName, rsg.Key)
                                                                                                                                                           )).OrderBy(k => k.Name, new CustomCompare()))))));

            JSON = o.ToString();
            return(JSON);
        }
Exemplo n.º 2
0
 private void StopListen()
 {
     try
     {
         _socketListener.StopListen();
     }
     catch
     {
     }
     IODataUpdater.RemoveChangeEventForIODataCollection();
     listening = !listening;
     toggleListenButton.Text = "Start Listen!";
 }