Exemplo n.º 1
0
 public BMyEnvironment(Program Assembly)
 {
     this.Assembly = Assembly;
     Log           = new BMyLog4PB(Assembly, BMyLog4PB.E_ALL, new BMyLog4PB.BMyCustomDataAppender(Assembly));
     DrawPlugins   = new BMyPluginBag <BMyDrawPlugin>(this);
     Log.Debug("Environment initialized.");
 }
Exemplo n.º 2
0
                public bool TryRunDraw(BMyDrawingCommand command, BMyCanvas canvas)
                {
                    Log?.PushStack("BMyEnvironment.TryRunDraw(BMyDrawingCommand command, BMyCanvas canvas)");
                    List <BMyDrawPlugin> DrawPluginsForCommand = DrawPlugins.FindAllByName(command.Key);

                    Log?.Debug("found {0} commands for {1}", DrawPluginsForCommand.Count, command.Key);
                    bool successfull = false;

                    if (DrawPluginsForCommand.Count > 0)
                    {
                        for (int i = 0; i < DrawPluginsForCommand.Count && !successfull; i++)
                        {
                            successfull = DrawPluginsForCommand[i].TryRun(command, canvas, this);
                            Log?.Debug("{0}: Plugin {1}/{2} with \"{3}\"", successfull?"OK":"FAIL", DrawPluginsForCommand[i].Vendor, DrawPluginsForCommand[i].Name, command);
                        }
                    }
                    Log?.Debug("{0}: Drawing of \"{1}\"", successfull ? "OK" : "FAIL", command);
                    Log?.PopStack();
                    return(successfull);
                }