Example #1
0
 private void OutputUpdate(List <string> list, OutputItem.OutputItemType type)
 {
     if ((list == null) || !list.Any())
     {
         return;
     }
     _dispatcher.BeginInvoke(() =>
     {
         List <OutputItem> newItems = new List <OutputItem> {
             new OutputItem(list[0], type)
         };
         if (list.Count > 1)
         {
             list.RemoveAt(0);
             newItems.AddRange(list.Select(item => new OutputItem(item, type, 1)).ToList());
         }
         _commsLogStore.AddRange(newItems);
         if (_commsLogTypes.Contains(type))
         {
             List <OutputItem> currentList = CommsLog.ToList();
             currentList.AddRange(newItems);
             while (currentList.Count > 1000)
             {
                 currentList.RemoveAt(0);
             }
             CommsLog         = new ObservableCollection <OutputItem>(currentList);
             CommsLogSelected = CommsLog.Last();
         }
     });
 }
Example #2
0
 private void OutputUpdate(string item, OutputItem.OutputItemType type)
 {
     _dispatcher.BeginInvoke(() =>
     {
         OutputItem outputItem = new OutputItem(item, type);
         _commsLogStore.Add(outputItem);
         if (_commsLogTypes.Contains(type))
         {
             while (CommsLog.Count >= 1000)
             {
                 CommsLog.RemoveAt(0);
             }
             CommsLog.Add(outputItem);
             CommsLogSelected = CommsLog.Last();
         }
     });
 }
Example #3
0
 private void Connect()
 {
     if (ELLDevicePort.IsConnected)
     {
         OutputUpdate("Disconnecting...", OutputItem.OutputItemType.Normal);
         BackgroundThreadManager.RunBackgroundFunction((s, e) => DisconnectEx(), delegate
         {
             UpdateUI();
             OutputUpdate("Disconnected", OutputItem.OutputItemType.Normal);
         });
     }
     else
     {
         _commsLogStore.Clear();
         CommsLog.Clear();
         OutputUpdate("Connecting...", OutputItem.OutputItemType.Normal);
         BackgroundThreadManager.RunBackgroundFunction((s, e) => ConnectEx(), (e) => UpdateUI());
     }
 }