protected override int Execute(ActionData data) { try { ConfigManager manager = AppManager.ConfigManager; FileToInt32List zaehlstand = new FileToInt32List(manager.SdCardDir, "zaehlst.txt"); CounterSettings counterSettings = null; if (!zaehlstand.Empty) { AppManager.MainForm.Cursor = Cursors.WaitCursor; counterSettings = new CounterSettings(zaehlstand.ParamList); PropertiesForm dialog = new PropertiesForm(); dialog.Description = Resources.CounterListActionCounter; //@Language Resource dialog.FileInfo = zaehlstand.FileInfo; BasicPropertyBag bag = new BasicPropertyBag(new object[] { counterSettings }); dialog.SelectedObject = bag; dialog.PrintProperties = PrintProperty.GetPrintProperties(bag); dialog.ShowDialog(AppManager.MainForm); } } catch (Exception ex) { AppExtension.PrintStackTrace(ex); } finally { AppManager.MainForm.Cursor = Cursors.Default; } return(0); }
private void PrintRow(Graphics graphics, int index) { PrintProperty selected = parameterList[index]; builder.Length = 0; builder.Append(selected.DisplayName); for (int i = selected.DisplayName.Length; i < 64; i++) { builder.Append(' '); } //builder.Append(selected.Category); //for (int i = selected.Category.Length; i < 10; i++) { // builder.Append(' '); //} //builder.Append(selected.HeatingUser); //for (int i = selected.HeatingUser.Length; i < 34; i++) { // builder.Append(' '); //} //builder.Append(selected.PrintCategory.ToString()); //for (int i = selected.PrintCategory.ToString().Length; i < 26; i++) { // builder.Append(' '); //} builder.Append(selected.ValueString); graphics.DrawString(builder.ToString(), regularFont, Brushes.Black, printArea, format); printArea.Y += regularFont.Height + 3; graphics.DrawLine(pen, printArea.X, printArea.Y - 2, printArea.X + printArea.Width, printArea.Y - 2); Size size = TextRenderer.MeasureText(Tab10, regularFont); int x = printArea.X + (int)(size.Width * 6.4f); int y = printArea.Y - 3 - regularFont.Height; graphics.DrawLine(pen, x, y, x, printArea.Y); }
protected override int Execute(ActionData data) { try { ConfigManager manager = AppManager.ConfigManager; FileToInt32List paramact = new FileToInt32List(manager.SdCardDir, "paramact.txt"); if (!paramact.Empty) { AppManager.MainForm.Cursor = Cursors.WaitCursor; HeatCircuitSettings heatCircuitSettings1 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC1); HeatCircuitSettings heatCircuitSettings2 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC2); HeatCircuitSettings heatCircuitSettings3 = new HeatCircuitSettings(paramact.ParamList, HeatCircuit.HC3); HeatingSettings heatingSettings = new HeatingSettings(paramact.ParamList); WaterSettings waterSettings = new WaterSettings(paramact.ParamList); CirculationSettings circulationSettings = new CirculationSettings(paramact.ParamList); SolarSettings solarSettings = new SolarSettings(paramact.ParamList); SuppressMask suppressMask = (SuppressMask)AppManager.ConfigManager.SDCardSuppressMask; PropertiesForm dialog = new PropertiesForm(); dialog.Description = Resources.ParameterListActionParameters; //@Language Resource dialog.FileInfo = paramact.FileInfo; List <object> objects = new List <object>(); objects.Add(heatCircuitSettings1); if ((suppressMask & SuppressMask.HK2) == 0) { objects.Add(heatCircuitSettings2); } if ((suppressMask & SuppressMask.HK3) == 0) { objects.Add(heatCircuitSettings3); } //objects.Add(heatingSettings); objects.Add(waterSettings); objects.Add(circulationSettings); //objects.Add(solarSettings); object[] selectedObjects = objects.ToArray(); BasicPropertyBag bag = new BasicPropertyBag(selectedObjects); dialog.SelectedObject = bag; dialog.PrintProperties = PrintProperty.GetPrintProperties(bag); dialog.ShowDialog(AppManager.MainForm); } } catch (Exception ex) { AppExtension.PrintStackTrace(ex); } finally { AppManager.MainForm.Cursor = Cursors.Default; } return(0); }
public static IList <PrintProperty> GetPrintProperties(BasicPropertyBag bag) { List <PrintProperty> result = new List <PrintProperty>(); if (bag != null) { List <MetaProp> properties = bag.Properties; for (int i = 0; i < properties.Count; i++) { try { PrintProperty item = new PrintProperty(properties[i], bag); result.Add(item); } catch (NullReferenceException ex) { AppExtension.PrintStackTrace(ex); } } } return(result); }