//Adding data to dataView private void AddDataItems(ASPxDataView dvMaster, int lineId, int sectionId) { AssemblySection section = ProductionRepository.GetAssemblySection(sectionId); List <Station> stations = new List <Station>(); stations = ProductionRepository.GetStationsInAssemblySection(sectionId); if (stations.Any()) { foreach (Station sta in stations) { DataViewItem dvItem = new DataViewItem(); StationInfo info = new StationInfo(); info.StationId = sta.Id; info.StationName = sta.StationName; info.SectionId = sectionId; info.LineId = lineId; info.SectionTypeId = section.AssemblySectionTypeId; info.IsQGate = sta.IsQualityGate; info.Capacity = sta.Capacity; info.Items = ProductionRepository.GetProductionItems(info.LineId, info.StationId); dvItem.DataItem = info; dvMaster.Items.Add(dvItem); } dvMaster.SettingsTableLayout.ColumnCount = stations.Count; } }
public static Dictionary <Type, List <PropertyInfo> > GetProperties() { lock (SyncObject) { Stopwatch sw = Stopwatch.StartNew(); List <Task> tasksContainer = new List <Task>(); if (_properties != null) { sw.Stop(); Trace.WriteLine(string.Format("Total time taken to search assemblys: {0}ms", sw.ElapsedMilliseconds)); return(FindProperties._properties); } FindProperties._properties = new Dictionary <Type, List <PropertyInfo> >(); var assemblyElements = AssemblySection.GetAssemblies(); foreach (AssemblyElement assemblyElement in assemblyElements) { AssemblyElement element = assemblyElement; Task task = Task.Factory.StartNew(() => SearchAssemblyTask(element)); tasksContainer.Add(task); } Task.WaitAll(tasksContainer.ToArray()); sw.Stop(); Trace.WriteLine(string.Format("Total time taken to search assemblies: {0}ms", sw.ElapsedMilliseconds)); return(FindProperties._properties); } }
public static void AppendDissassembly(StringBuilder sb, out int hiStart, out int hiEnd, AssemblySection section, SourceFileSegment segment, SourceModule module, ref int lineCount) { sb.AppendLine(); sb.AppendLine(section.FunctionName); sb.AppendLine(); hiStart = 0; hiEnd = 0; foreach (var s in section.Segments) { if (section.FunctionName == segment.Function.Name && lineCount == segment.LineNumber) { hiStart = sb.Length; hiEnd = hiStart + s.Length; } sb.AppendLine(s); if (section.FunctionName == segment.Function.Name) { lineCount++; } } }
internal void Populate(Project project, CPUImage cpu) { if (typeface == null) { typeface = new Typeface(viewer.FontFamily, viewer.FontStyle, viewer.FontWeight, viewer.FontStretch); } SourceFileSegment segment; project.GetLineSegment(out segment, cpu.PC); AssemblySection section = GetSection(segment.Source, segment.Function.Name); if (section == null || segment.Function.Handle == IntPtr.Zero) { string s = "No assembly code at this location: " + cpu.PC; text = new FormattedText(s, culture, FlowDirection.LeftToRight, typeface, viewer.FontSize, Brushes.Black, 1.0); viewer.HiStart = 0; viewer.HiEnd = 0; viewer.Text = text; lastFunction = IntPtr.Zero; } else if (segment.Function.Handle != lastFunction) { int hiStart, hiEnd; var sb = new StringBuilder(4096); int lineCount = 0; AppendDissassembly(sb, out hiStart, out hiEnd, section, segment, ref lineCount); text = new FormattedText(sb.ToString(), culture, FlowDirection.LeftToRight, typeface, viewer.FontSize, Brushes.Black, 1.0); viewer.Width = text.Width; viewer.Height = text.Height; viewer.Text = text; viewer.HiStart = hiStart; viewer.HiEnd = hiEnd; if (hiEnd > hiStart) { BringScrollerIntoView(hiStart, hiEnd); } lastFunction = segment.Function.Handle; } else { int hiStart, hiEnd; var sb = new StringBuilder(4096); int lineCount = 0; AppendDissassembly(sb, out hiStart, out hiEnd, section, segment, ref lineCount); text = new FormattedText(sb.ToString(), culture, FlowDirection.LeftToRight, typeface, viewer.FontSize, Brushes.Black, 1.0); if (text != null && hiEnd > hiStart) { BringScrollerIntoView(hiStart, hiEnd); } viewer.Text = text; viewer.HiStart = hiStart; viewer.HiEnd = hiEnd; } viewer.InvalidateVisual(); }