public Scan(Wizard sb) { InitializeComponent(); Focus(); _scanBase = sb; // Start timer _timerUpdate.Interval = 250; _timerUpdate.Elapsed += timerUpdate_Elapsed; _timerUpdate.Start(); // Set taskbar progress bar Main.TaskbarProgressState = TaskbarItemProgressState.Normal; Main.TaskbarProgressValue = 0; // Set the progress bar ProgressBar.Minimum = 0; ProgressBar.Maximum = EnabledScanners.Count; ProgressBar.Value = 0; // Populate ListView foreach (var lvi in EnabledScanners.Select(scanBase => new ScannerListViewItem(scanBase.ScannerName))) { SectionsCollection.Add(lvi); } _mainTaskScan = new Task(StartScanning, _cancellationTokenSource.Token); _mainTaskScan.Start(); }
public Track(ISimulator sim, string name) { if (name == null) { return; } Route = new RouteCollection(); Apexes = new ApexCollection(); Sections = new SectionsCollection(); // TODO: Make possible without Telemetry.m.Sim available! if (sim.Garage != null && sim.Garage.Available && sim.Garage.Available_Tracks) { ITrack track = sim.Garage.SearchTrack(name); if (track != null) { track.Scan(); track.ScanRoute(); Location = track.Location; Type = track.Type; Name = track.Name; Route = (RouteCollection)track.Route.Clone(); } } LapLogger = new Timer(); LapLogger.Interval = 2; LapLogger.Elapsed += LapLogger_Elapsed; LapLogger.AutoReset = true; LapLogger.Start(); }
public Section() { ContentType = new ContentType(); ContentDisposition = new ContentDisposition(); TransferEncoding = new ContentTransfer(); Content = ""; Headers = new HeadersCollection(); Sections = new SectionsCollection(); }
private void PredictionChart_DataClick(object sender, ChartPoint chartPoint) { try{ tickclick++; if (tickclick == 3) { tickclick = 0; predictionChart.AxisX.Clear(); x = 0; y = 0; from.Text = x.ToString(); to.Text = y.ToString(); return; } if (tickclick == 1) { x = Convert.ToInt32(chartPoint.X); } if (x != 0 && x != y && tickclick == 2) { y = Convert.ToInt32(chartPoint.X); } from.Text = x.ToString(); to.Text = y.ToString(); if (x != 0 && y != 0) { SectionsCollection Sections = new SectionsCollection { new AxisSection { Value = Convert.ToInt32(from.Text), SectionWidth = Convert.ToInt32(to.Text) - Convert.ToInt32(from.Text), Fill = new System.Windows.Media.SolidColorBrush { Color = System.Windows.Media.Color.FromRgb(254, 132, 132), Opacity = .4 } } }; Axis a = new Axis(); a.MaxValue = data.Length; a.MinValue = 0; a.Sections = Sections; predictionChart.AxisX.Clear(); predictionChart.AxisX.Add(a); } } catch { } }
public Track(RouteCollection route) { Route = route; Apexes = new ApexCollection(); Sections = new SectionsCollection(); Location = "??"; Type = "??"; Name = "??"; // Laplogger? }
private SectionsCollection GetSections(bool getToday, bool getWeekends) { var axisSections = new SectionsCollection(); if (getToday) { var todayAxisSection = new AxisSection { Draggable = false, SectionOffset = 0.5 + (DateTime.Today - period.startDate).Days, SectionWidth = 1, Fill = Application.Current.Resources["Alpha-Green"] as SolidColorBrush }; axisSections.Add(todayAxisSection); } if (getWeekends) { var start = period.startDate; int daysUntilSaturday = ((int)DayOfWeek.Saturday - (int)start.DayOfWeek + 7) % 7; var saturday = start.AddDays(daysUntilSaturday); while ((period.endDate - saturday).Days >= 0) { var weekendSection = new AxisSection { Draggable = false, SectionOffset = 0.5 + (saturday - period.startDate).Days, SectionWidth = 2, Fill = Application.Current.Resources["Alpha-Gray-1"] as SolidColorBrush }; axisSections.Add(weekendSection); saturday = saturday.AddDays(7); } } return(axisSections); }
/// <summary> /// Interpreta las secciones hijo /// </summary> private static SectionsCollection ParseSectionsChild(string strBoundaryParent, ParserLines objParser, ref string strLastLine) { SectionsCollection objColSections = new SectionsCollection(); string strLine; // Lee la primera línea (o recupera la anterior if (!string.IsNullOrEmpty(strLastLine)) strLine = strLastLine; else strLine = objParser.ReadLine(); // Quita las líneas anteriores al boundary si es necesario if (!string.IsNullOrEmpty(strBoundaryParent) && !IsStartBoundary(strLine, strBoundaryParent)) { // Lee la siguiente línea while (!objParser.IsEof && !IsStartBoundary(strLine, strBoundaryParent)) strLine = objParser.ReadLine(); } // Si es la línea de boundary if (IsStartBoundary(strLine, strBoundaryParent)) { bool blnEnd = false; // Recorre las secciones hija while (!objParser.IsEof && !blnEnd) if (!string.IsNullOrEmpty(strLastLine) && IsEndBoundary(strLastLine, strBoundaryParent)) blnEnd = true; else { Section objSection = ParseSection(objParser, strBoundaryParent, ref strLastLine); // Añade la sección a la colección objColSections.Add(objSection); // Comprueba la última línea leída if (IsEndBoundary(strLastLine, strBoundaryParent)) { // Vacía la última línea al ser un final de sección para pasar a la siguiente lectura // sin una cadena de lectura atrasada (al fin y al cabo, la hemos tratado en el // IsEndBoundary if (!objParser.IsEof) { strLastLine = objParser.ReadLine(); if (strLastLine == "") strLastLine = objParser.ReadLine(); } else strLastLine = ""; // Indica que es el final de sección blnEnd = true; } else if (objSection.ContentType.IsMultipart) objSection.Sections.AddRange(ParseSectionsChild(objSection.ContentType.Boundary, objParser, ref strLastLine)); } } else throw new Exception("Boundary mal formado"); // Devuelve las secciones return objColSections; }