/// <summary> /// Initializes a new instance of the NodeViewModel class for the Node with specified Guid with specified repository source. /// </summary> public NodeDetailsViewModel(IRepository<Node> pRepository, Guid pNodeGuid) { mRepository = pRepository; BindModel(Repository.Get(n => n.Guid == pNodeGuid)); ReplaceModelCommand = new ReplaceModelCommand(this); PhenomenaConverter = new PhenomenaConverter(); }
public void ReportNodesInformation() { var nodes = mNodeRepository.GetAll(); for(var i = 0; i < nodes.Count; i++) { var page = new PdfPage(mDocument); var contents = new PdfContents(page); if (i == 0) { contents.DrawText(mTimesNormal, 14.0, 10, 26, TextJustify.Center, "Informacje o węzłach dodanych do projektowanej sieci"); } contents.DrawText(mTimesNormal, 12.0, 1.5, 24, TextJustify.Left, string.Format("Nazwa: {0}", nodes[i].Name)); contents.DrawText(mTimesNormal, 12.0, 1.5, 23.5, TextJustify.Left, string.Format("Guid: {0}", nodes[i].Guid)); contents.DrawText(mTimesNormal, 12.0, 1.5, 23, TextJustify.Left, string.Format("Typ: {0}", nodes[i].TechnologyName)); contents.DrawText(mTimesNormal, 12.0, 1.5, 22.5, TextJustify.Left, string.Format("Częstotliwość: {0} MHz", nodes[i].Parameters.CentralFrequency / Tools.GetFrequencyMetricsWithValues()["[MHz]"])); contents.DrawText(mTimesNormal, 12.0, 1.5, 22, TextJustify.Left, string.Format("Moc nadawania: {0} dBm", nodes[i].Parameters.SignalStrength)); contents.DrawText(mTimesNormal, 12.0, 1.5, 21.5, TextJustify.Left, string.Format("Czułość: {0} dBm", nodes[i].Parameters.Sensitivity)); contents.DrawText(mTimesNormal, 12.0, 1.5, 21, TextJustify.Left, string.Format("Zysk: {0} dBi", nodes[i].Parameters.Gain)); contents.DrawText(mTimesNormal, 12.0, 1.5, 20.5, TextJustify.Left, string.Format("Czas uśpienia: {0} ms/sek", nodes[i].Parameters.SleepTime)); contents.DrawText(mTimesNormal, 12.0, 1.5, 20, TextJustify.Left, string.Format("Czas nadawania: {0} ms/sek", nodes[i].Parameters.TxTime)); contents.DrawText(mTimesNormal, 12.0, 1.5, 19.5, TextJustify.Left, string.Format("Czas odbierania: {0} ms/sek", nodes[i].Parameters.RxTime)); contents.DrawText(mTimesNormal, 12.0, 1.5, 19, TextJustify.Left, string.Format("Prąd pobierany podczas uśpienia: {0} uA", nodes[i].Parameters.SleepCurrent)); contents.DrawText(mTimesNormal, 12.0, 1.5, 18.5, TextJustify.Left, string.Format("Prąd pobierany podczas nadawania: {0} mA", nodes[i].Parameters.TxCurrent)); contents.DrawText(mTimesNormal, 12.0, 1.5, 18, TextJustify.Left, string.Format("Prąd pobierany podczas odbioru: {0} mA", nodes[i].Parameters.RxCurrent)); contents.DrawText(mTimesNormal, 12.0, 1.5, 17.5, TextJustify.Left, string.Format("Czas życia: {0} dni", nodes[i].Parameters.BatteryLife.ToString("F"))); contents.DrawText(mTimesNormal, 12.0, 1.5, 17, TextJustify.Left, string.Format("Pojemność baterii: {0} mAh", nodes[i].Parameters.BatteryCapacitance)); contents.DrawText(mTimesNormal, 12.0, 1.5, 16.5, TextJustify.Left, string.Format("Nazwa baterii: {0}", nodes[i].Parameters.BatteryName)); contents.DrawText(mTimesNormal, 12.0, 1.5, 16, TextJustify.Left, string.Format("Cena węzła z czujnikami: {0} zł", nodes[i].Parameters.Price)); for (var j = 0; j < nodes[i].Parameters.SensingPhenomenas.Count; j++) { var name = new PhenomenaConverter().Convert(nodes[i].Parameters.SensingPhenomenas[j], typeof(SensingPhenomena), null, null); var price = double.Parse(XmlParser.GetValue("Phenomena", nodes[i].Parameters.SensingPhenomenas[j].ToString())); contents.DrawText(mTimesNormal, 12.0, 1.5, 15.5 - j*0.5, TextJustify.Left, string.Format("Czujnik: {0}, Cena: {1} zł", name, price)); } contents.CommitToPdfFile(false); } }