public ExceptionReporterViewModel( IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, IProblemReporter problemReporter) : base(appCtx, dataCtx, parent) { if (problemReporter == null) throw new ArgumentNullException("problemReporter"); this.problemReporter = problemReporter; this._exceptions = new List<Tuple<Exception, Bitmap>>(); }
public ExceptionReporterViewModel( IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Exception ex, Bitmap screenShot, IProblemReporter problemReporter) : base(appCtx, dataCtx, parent) { if (problemReporter == null) throw new ArgumentNullException("problemReporter"); this.exception = ex; this.screenShot = screenShot; this.problemReporter = problemReporter; }
public ExceptionReporterViewModel( IViewModelDependencies appCtx, IZetboxContext dataCtx, ViewModel parent, Exception ex, Bitmap screenShot, IProblemReporter problemReporter) : base(appCtx, dataCtx, parent) { if (problemReporter == null) { throw new ArgumentNullException("problemReporter"); } this.exception = ex; this.screenShot = screenShot; this.problemReporter = problemReporter; }
/// <summary> /// Validates the specified <see cref="ConfigurationClass"/> and reports all discovered violations to the provided problem reporter for appropriate action. /// </summary> /// <param name="problemReporter">The problem reporter.</param> public void Validate(IProblemReporter problemReporter) { // A [ObjectDef] method may only be overloaded through inheritance. No single // [Configuration] class may declare two [ObjectDef] methods with the same name. const char hashDelim = '#'; Dictionary<String, int> methodNameCounts = new Dictionary<String, int>(); foreach (ConfigurationClassMethod method in _methods) { String dClassName = method.MethodMetadata.DeclaringType.FullName; String methodName = method.MethodMetadata.Name; string paramTypes = ParamTypesToString(method.MethodMetadata); String fqMethodName = dClassName + hashDelim + methodName + paramTypes; if (!methodNameCounts.ContainsKey(fqMethodName)) { methodNameCounts.Add(fqMethodName, 1); } else { int currentCount = methodNameCounts[fqMethodName]; methodNameCounts.Add(fqMethodName, currentCount++); } } foreach (String methodName in methodNameCounts.Keys) { int count = methodNameCounts[methodName]; if (count > 1) { String shortMethodName = methodName.Substring(methodName.IndexOf(hashDelim) + 1); problemReporter.Error(new ObjectMethodOverloadingProblem(shortMethodName, count, Resource, ConfigurationClassType)); } } if (Attribute.GetCustomAttribute(_configurationClassType, typeof(ConfigurationAttribute)) != null) { if (ConfigurationClassType.IsSealed) { problemReporter.Error(new SealedConfigurationProblem(SimpleName, Resource, ConfigurationClassType)); } foreach (ConfigurationClassMethod method in _methods) { method.Validate(problemReporter); } } }
public ReportProblemCommand(IViewModelDependencies appCtx, IProblemReporter reporter, IScreenshotTool screenShot, IZetboxContext dataCtx, ViewModel parent) : base(appCtx, dataCtx, parent, CommonCommandsResources.ReportProblemCommand_Name, CommonCommandsResources.ReportProblemCommand_Tooltip) { if (reporter == null) { throw new ArgumentNullException("reporter"); } if (screenShot == null) { throw new ArgumentNullException("screenShot"); } this._reporter = reporter; this._screenShot = screenShot; }
/// <summary> /// Validates the specified problem reporter. /// </summary> /// <param name="problemReporter">The problem reporter.</param> public void Validate(IProblemReporter problemReporter) { //TODO: investigate whether this should be "if method has ObjectDef attribute" instead of "if class has Configuration attribute" if ( Attribute.GetCustomAttribute(ConfigurationClass.ConfigurationClassType, typeof(ConfigurationAttribute)) != null) { if (MethodMetadata.IsStatic) { problemReporter.Error(new StaticMethodError(MethodMetadata.Name, ResourceLocation)); } if (!MethodMetadata.IsVirtual) { problemReporter.Error(new NonVirtualMethodError(MethodMetadata.Name, ResourceLocation)); } if (MethodMetadata.GetParameters().Length != 0) { problemReporter.Error(new MethodWithParametersError(MethodMetadata.Name, ResourceLocation)); } } }
/// <summary> /// Initializes a new instance of the ConfigurationClassObjectDefinitionReader class. /// </summary> /// <param name="registry"></param> /// <param name="problemReporter"></param> public ConfigurationClassObjectDefinitionReader(IObjectDefinitionRegistry registry, IProblemReporter problemReporter) { _registry = registry; _problemReporter = problemReporter; }
/// <summary> /// Initializes a new instance of the ConfigurationClassParser class. /// </summary> /// <param name="problemReporter"></param> public ConfigurationClassParser(IProblemReporter problemReporter) { _problemReporter = problemReporter; }
/// <summary> /// Validates the specified problem reporter. /// </summary> /// <param name="problemReporter">The problem reporter.</param> public void Validate(IProblemReporter problemReporter) { //TODO: investigate whether this should be "if method has Definition attribute" instead of "if class has Configuration attribute" if ( Attribute.GetCustomAttribute(ConfigurationClass.ConfigurationClassType, typeof (ConfigurationAttribute)) != null) { if (MethodMetadata.IsStatic) { problemReporter.Error(new StaticMethodError(MethodMetadata.Name, ResourceLocation)); } if (!MethodMetadata.IsVirtual) { problemReporter.Error(new NonVirtualMethodError(MethodMetadata.Name, ResourceLocation)); } if (MethodMetadata.GetParameters().Length != 0) { problemReporter.Error(new MethodWithParametersError(MethodMetadata.Name, ResourceLocation)); } } }
public ReportProblemCommand(IViewModelDependencies appCtx, IProblemReporter reporter, IScreenshotTool screenShot, IZetboxContext dataCtx, ViewModel parent) : base(appCtx, dataCtx, parent, CommonCommandsResources.ReportProblemCommand_Name, CommonCommandsResources.ReportProblemCommand_Tooltip) { if (reporter == null) throw new ArgumentNullException("reporter"); if (screenShot == null) throw new ArgumentNullException("screenShot"); this._reporter = reporter; this._screenShot = screenShot; }