//------------------------------------------------------------------------------------------ //-------------- Commands ------------------------------------------------------------- //------------------------------------------------------------------------------------------- // Execute the "RefreshData" command public void RefreshData() { Latitude = "5.728043"; Longitude = "45.184320"; Distance = "500"; Data.Clear(); LinesToDisplay.Clear(); }
//--------------- Fill ObservableCollections ------------------------------------------------------------- // fill LinesToDisplay public void SetLinesToDisplay(LinesNearDescription linesNearDescription) { linesNearDescription.LinesNear.ForEach(delegate(LinesNear linesNear) { List <Lines> lines = SetLines(linesNearDescription.LinesDescription, linesNear); LinesToDisplay linesToDisplay = new LinesToDisplay(linesNear.Name, linesNear.Zone, linesNearDescription.Message, lines); LinesToDisplay.Add(linesToDisplay); }); }
// Executes the "Display Transport" command public void DisplayTransportMessage() { //clear the list LinesToDisplay.Clear(); //instanciate sendrequest if (IsOnline) { SendRequest = new SendRequestOnLine(); } else { SendRequest = new SendRequestOffLine(); }; // getData GetLinesNearDescription getData = new GetLinesNearDescription(SendRequest, coordonates.Latitude, coordonates.Longitude, coordonates.Distance); Data = getData.LinesNearDescription; SetLinesToDisplay(Data); }
void bgwQueueOutputWorker_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker thisWorker = sender as BackgroundWorker; while (true) { if (thisWorker.CancellationPending) { break; } try { if (cqLinesToLog.Count > 0) { while (cqLinesToLog.Count > 0) { LinesToDisplay currLine = new LinesToDisplay(); while (!cqLinesToLog.TryDequeue(out currLine)) { Application.DoEvents(); Thread.Sleep(0); } ThreadSafeOperations.SetTextTB(textBox1, currLine.textLine, currLine.appendMode); Application.DoEvents(); Thread.Sleep(0); } } else { Application.DoEvents(); Thread.Sleep(0); continue; } } catch (Exception) { Application.DoEvents(); Thread.Sleep(0); continue; } } }