/// <summary> /// Adds input data to DataTable. /// </summary> /// <returns><c>True</c> if successful execution. <c>Fasle</c> if unsuccessful</returns> public bool AddToDataTable(string RawData) { lock (_lock) //locks method to prevent multiple executions to keep thread safe { string deviceCode = DataClean(RawData, 1); if (PreferncesStatic.DeviceIdExists(deviceCode) == true) //check if the device code of the sender is valid { RawDataTable.DT.Rows.Add(deviceCode, DataClean(RawData, 2), DataClean(RawData, 3)); //Adds data to datatable return(true); } else { return(false); } } }
public void OptionSelect() { var ServerStart = new ServerInitializer(); Header(2); ConsoleKeyInfo info = Console.ReadKey(true); Deserializer(); switch (info.Key) { case ConsoleKey.D1: Header(3); Console.WriteLine("Pressed 1"); Pref(); break; case ConsoleKey.D2: Header(3); Console.WriteLine("Pressed 2"); DeviceManage(); break; case ConsoleKey.D3: Header(3); PreferncesStatic.DeviceIds = p.DeviceIds.ToArray(); PreferncesStatic.UpdateValues(p.DbType, p.ConnectionString, p.DBUpdateTime); ServerStart.Initializer(); break; case ConsoleKey.F12: Environment.Exit(0); break; default: Header(3); Console.WriteLine("Invalid Input"); OptionSelect(); break; } }