internal Loader(string layoutXmlPath, string tempDllPath, CalculatorGateway calculatorGateway, Action <string> throwControlErrorAction, Func <string, IEnumerable <string>, Assembly> compileAssemblyFunc) { this.layoutXmlPath = layoutXmlPath; this.tempDllPath = tempDllPath; this.calculatorGateway = calculatorGateway; this.throwControlErrorAction = throwControlErrorAction; this.compileAssemblyFunc = compileAssemblyFunc; fontFactory = new LedFontFactory(this.calculatorGateway); if (File.GetAttributes(this.layoutXmlPath).HasFlag(FileAttributes.Directory)) { this.throwControlErrorAction.Invoke("LED レイアウトファイルのパス \"" + this.layoutXmlPath + "\" は無効です。"); } else if (!File.Exists(layoutXmlPath)) { this.throwControlErrorAction.Invoke("LED レイアウトファイル \"" + this.layoutXmlPath + "\" が見つかりませんでした。"); } else { XDocument layoutXml = XDocument.Load(this.layoutXmlPath); Element = layoutXml.Element("LedDisplayLayout"); if (Element is null) { this.throwControlErrorAction.Invoke("\"" + this.layoutXmlPath + "\" は LED レイアウトファイルではありません。"); } } }
public CalculationInfluenceAdapter( CalculatorGateway areaCalculator, CalculatorGateway salaryCalculator, CalculatorGateway admissionAtCalculator ) { _areaCalculator = areaCalculator; _salaryCalculator = salaryCalculator; _admissionAtCalculator = admissionAtCalculator; }
internal LedControllerConnector(DbsPluginConnector pluginConnector, List <LedControl> ledControls, CalculatorGateway calculatorGateway) { PluginConnector = pluginConnector; LedControls = ledControls; CalculatorGateway = calculatorGateway; }
internal LedFontFactory(CalculatorGateway calculatorGateway) { this.calculatorGateway = calculatorGateway; }
public void RegisterBitmap(CalculatorGateway calculatorGateway) { HasFlashElement = Text.Any(e => e.Flash); if (IsAutoWidth) { int width = 0; foreach (IRichTextElement element in Text) { if (element is Run) { Run run = (Run)element; if (run.InnerText != "") { width += calculatorGateway.GetStringWidth(run.InnerText, run.Font.FontIndex); } } else if (element is Image) { Image image = (Image)element; width += image.DrawWidth; } } Width = width; } byte[] stableBitmap = new byte[Width * Height * 3]; calculatorGateway.ClearDots(stableBitmap, Width, Height); byte[] flashBitmap = new byte[Width * Height * 3]; calculatorGateway.ClearDots(flashBitmap, Width, Height); List <int> stopPositions = new List <int>(); if (!(BiggestFont is null)) { int ascent = calculatorGateway.GetStringAscent(BiggestFont.FontIndex); int y = Height - calculatorGateway.GetStringHeight(BiggestFont.FontIndex); int x = 0; foreach (IRichTextElement element in Text) { if (x >= Width) { break; } if (element is Run) { Run run = (Run)element; if (run.InnerText != "") { calculatorGateway.WriteStringToDots( run.Flash ? flashBitmap : stableBitmap, run.InnerText, run.Font.FontIndex, run.FontColor, run.BackgroundColor, x, BiggestFont.FontIndex == run.Font.FontIndex ? y : y + ascent - calculatorGateway.GetStringAscent(run.Font.FontIndex), Width, Height); x += calculatorGateway.GetStringWidth(run.InnerText, run.Font.FontIndex); } } else if (element is Image) { Image image = (Image)element; calculatorGateway.WriteImageToDots( image.Flash ? flashBitmap : stableBitmap, image.Bitmap, x, Height - image.DrawHeight, image.Width, image.Height, image.DrawWidth, image.DrawHeight, Width, Height, image.XIndex, image.YIndex, false); x += image.DrawWidth; } else if (element is Stop) { stopPositions.Add(x); } } } StableBitmap = stableBitmap; FlashBitmap = flashBitmap; StopPositions = stopPositions.AsReadOnly(); HasBitmapRegistered = true; }