private void EvaluateDependency(Dependency dependencyToEvalulate, IEvaluationContext context) { try { if (context.Evaluate(dependencyToEvalulate.Check)) { this.pictureBox1.Image = Resources.Checked; this.llDownloadUrl.Visible = false; this.lblExplanation.Visible = false; this.Height = 25; this.lblTitle.ForeColor = this.titleSavedColor; this.lblTitle.Top = 4; this.DependencyStatus = true; } else { this.pictureBox1.Image = Resources.Unchecked; this.pictureBox1.Top = 10; this.lblTitle.ForeColor = Color.Red; this.DependencyStatus = false; this.lblExplanation.Visible = true; this.llDownloadUrl.Visible = true; } } catch (Exception exception) { this.pictureBox1.Image = Resources.Unchecked; this.pictureBox1.Top = 10; this.lblTitle.ForeColor = Color.Red; this.lblExplanation.Visible = true; this.DependencyStatus = false; this.llDownloadUrl.Visible = false; string errorMessage = string.Format( "'{0}' dependency could not be verified. Install components above this one first.", dependencyToEvalulate.Title); this.lblExplanation.Text = errorMessage; this.toolTip1.SetToolTip(this.lblExplanation, errorMessage); this.errorService.LogError(errorMessage, exception); } }
private bool Interpret(PropExpression e, IEvaluationContext context) { if (e is PropIdentifier) { var pi = (PropIdentifier)e; return(context.Evaluate(context[pi.Name])); } if (e is PropConjunction) { var pc = (PropConjunction)e; return(this.Interpret(pc.Left, context) && this.Interpret(pc.Right, context)); } if (e is PropDisjunction) { var pd = (PropDisjunction)e; return(this.Interpret(pd.Left, context) || this.Interpret(pd.Right, context)); } if (e is PropNegation) { var pn = (PropNegation)e; return(!this.Interpret(pn.Inner, context)); } throw new NotImplementedException(); }