private XElement createStringDistance(PolicyConfigurationModel settings) { var stringDst = new XElement("stringDistancePolicy"); var dist = new XElement("minDistance"); dist.Value = settings.StringDistanceMinDist.ToString(); stringDst.Add(dist); return(stringDst); }
private XElement createReadingDirection(PolicyConfigurationModel settings) { var reading = new XElement("readingDirectionPolicy"); var left = new XElement("leftToRight"); left.Value = settings.ReadingDirectionLeftRight.ToString().ToLower(); var top = new XElement("topToBottom"); top.Value = settings.ReadingDirectionTopBottom.ToString().ToLower(); reading.Add(left); reading.Add(top); return(reading); }
private XElement createOneAmongOthers(PolicyConfigurationModel settings) { var oneAmong = new XElement("oneAmongOthersPolicy"); var style = new XElement("environmentStyle"); style.Value = settings.OneAmongOthersStyle; var length = new XElement("environmentLength"); length.Value = settings.OneAmongOthersLength.ToString(); oneAmong.Add(style); oneAmong.Add(length); return(oneAmong); }
private XElement createFormulaComplexity(PolicyConfigurationModel settings) { var formulaRule = new XElement("formulaComplexityPolicy"); var maxNesting = new XElement("maxNesting"); maxNesting.Value = settings.FormulaComplexityMaxDepth.ToString(); var maxOperations = new XElement("maxOperations"); maxOperations.Value = settings.FormulaComplexityMaxOperations.ToString(); formulaRule.Add(maxNesting); formulaRule.Add(maxOperations); return(formulaRule); }
/// <summary> /// Sets Settings for non consider constants /// </summary> /// <param name="settings"></param> private void SetNonConCon(PolicyConfigurationModel settings) { if (settings.NonConsideredConstants) { CB_NonConsideredConstants.Checked = true; NCC_A.Enabled = true; NCC_M.Enabled = true; if (!settings.NonConsideredConstantsAutomatic) { NCC_M.Checked = true; } else { NCC_A.Checked = true; } } }
/// <summary> /// Sets the settings for No Constants in Formulas /// </summary> /// <param name="settings"></param> private void SetNoConstants(PolicyConfigurationModel settings) { if (settings.NoConstantsInFormulas) // if the Constraints box was previously selected and is stored in the settings { CB_NoConstantsInFormulas.Checked = true; // display the Constraints box as checked NCIF_A.Enabled = true; // and enable the Always and Manual radio buttons NCIF_M.Enabled = true; if (settings.NoConstantsInFormulasAutomatic) // The frequency is set to Always by default. If it is changed to false (aka Manual) { NCIF_A.Checked = true; // display the frequency as Manual } else { NCIF_M.Checked = true; // otherwise, keep the defaul setting of Always } } }
/// <summary> /// Sets the Settings for Multiple same References in a formula /// </summary> /// <param name="settings"></param> private void SetMultSamRef(PolicyConfigurationModel settings) { if (settings.MultipleSameRef) { CB_MultipleSameRef.Checked = true; MSR_A.Enabled = true; MSR_M.Enabled = true; if (!settings.MultipleSameRefAutomatic) { MSR_M.Checked = true; } else { MSR_A.Checked = true; } } }
/// <summary> /// Sets the Settings for Formula Complexity /// </summary> /// <param name="settings"></param> private void SetFormuCompl(PolicyConfigurationModel settings) { if (settings.FormulaComplexity) { CB_FormulaComplexity.Checked = true; FC_A.Enabled = true; FC_M.Enabled = true; if (!settings.FormulaComplexityAutomatic) { FC_M.Checked = true; } else { FC_A.Checked = true; } } }
public void LoadExtraInformation() { String error = ""; try { // Load cell definitions this.Accept(new XMLToCellDefinitionVisitor(XMLPartManager.Instance.LoadXMLPart(this, "CellDefinitions"))); } catch (Exception) { error += "Loading the cell definitions failed.\n"; } try { // Load the scenarios this.Accept(new XMLToScenarioVisitor(XMLPartManager.Instance.LoadXMLPart(this, "Scenario"))); } catch (Exception) { error += "Loading the scenarios failed.\n"; } try { // Load the violations var violationsXml = XMLPartManager.Instance.LoadXMLPart(this, "Violations"); if (violationsXml != null) { // Add them to the violations collection (from p in violationsXml.Elements(XName.Get("violation")) select new Violation(p, workbook)).ToList().ForEach(p => this.Violations.Add(p)); } } catch (Exception) { error += "Loading the displayed violations failed.\n"; } try { // Load the ignored var ignoredXml = XMLPartManager.Instance.LoadXMLPart(this, "IgnoredViolations"); if (ignoredXml != null) { // Add them to the ignored violations collection (from p in ignoredXml.Elements(XName.Get("ignoredviolations")) select new Violation(p, workbook)).ToList().ForEach(p => this.IgnoredViolations.Add(p)); } } catch (Exception) { error += "Loading the ignored violations failed.\n"; } try { // Load the later violations var laterXml = XMLPartManager.Instance.LoadXMLPart(this, "LaterViolations"); if (laterXml != null) { // Add them to the later violations collection (from p in laterXml.Elements(XName.Get("laterviolation")) select new Violation(p, workbook)).ToList().ForEach(p => this.LaterViolations.Add(p)); } } catch (Exception) { error += "Loading the 'later' violations failed.\n"; } try { // Load the archived violations var archivedXml = XMLPartManager.Instance.LoadXMLPart(this, "ArchivedViolations"); if (archivedXml != null) { // Add them to the archived violations collection (from p in archivedXml.Elements(XName.Get("archivedviolation")) select new Violation(p, workbook)).ToList().ForEach(p => this.SolvedViolations.Add(p)); } } catch (Exception) { error += "Loading the archived violations failed.\n"; } XElement polSettings = XMLPartManager.Instance.LoadXMLPart(this, "policySettings"); PolicyConfigurationModel polModel = new PolicyConfigurationModel(); try { polModel.loadXML(polSettings); } catch (Exception e) { // no settings existed, use the default config polModel = new PolicyConfigurationModel(); } this.policySettings = polModel; if (!String.IsNullOrWhiteSpace(error)) { MessageBox.Show("The following parts were unable to load:\n" + error, "Loading from workbook failed"); } }
/// <summary> /// Loads all the data related to violations and scenarios /// </summary> public void LoadExtraInformation() { disableScreenUpdating(); var error = string.Empty; try { var violationsElement = XMLPartManager.Instance.LoadXMLPart(this, "ArrayOfViolation"); if (violationsElement != null) { _violations = XMLPartManager.Instance.Deserialize <ObservableCollection <Violation> >( violationsElement.ToString()); NotifyPropertyChanged("Violations"); } } catch (Exception) { error += "Loading the violations failed.\n"; } try { var rulesElement = XMLPartManager.Instance.LoadXMLPart(this, "ArrayOfRule"); if (rulesElement != null) { _rules = XMLPartManager.Instance.Deserialize <ObservableCollection <Rule> >(rulesElement.ToString()); NotifyPropertyChanged("Rules"); } } catch (Exception) { error += "Loading the Rules failed.\n"; } try { var scenariosElement = XMLPartManager.Instance.LoadXMLPart(this, "ArrayOfScenario"); if (scenariosElement != null) { _scenarios = XMLPartManager.Instance .Deserialize <ObservableCollection <Scenario> >(scenariosElement.ToString()); NotifyPropertyChanged("Scenarios"); } } catch (Exception) { error += "Loading the scenarios failed.\n"; } try { var policyElement = XMLPartManager.Instance.LoadXMLPart(this, "PolicyConfigurationModel"); if (policyElement != null) { _policySettings = XMLPartManager.Instance.Deserialize <PolicyConfigurationModel>(policyElement.ToString()); } } catch (Exception) { error += "Loading the policy settings failed.\n"; } enableScreenUpdating(); if (!string.IsNullOrWhiteSpace(error)) { MessageBox.Show(Resources.tl_Load_Failed + error, Resources.tl_Load_Failed_Title); } else { // iterate over all violations and update cells UpdateCellViolations(); // recalulate visibility for violations RecalculateViewModel(); } }
/// <summary> /// Sets the Settings for the reference to null in a cell /// </summary> /// <param name="settings"></param> private void SetRefToNull(PolicyConfigurationModel settings) { if (settings.RefToNull) { CB_RefToNull.Checked = true; RTN_A.Enabled = true; RTN_M.Enabled = true; if (!settings.RefToNullAutomatic) { RTN_M.Checked = true; } else { RTN_A.Checked = true; } } }
private XElement createNonConsideredValues(PolicyConfigurationModel settings) { var nonConsidered = new XElement("nonConsideredValuesPolicy"); return(nonConsidered); }
private XElement createRefToNull(PolicyConfigurationModel settings) { var refToNull = new XElement("refToNullPolicy"); return(refToNull); }
private XElement createMultipleSameRef(PolicyConfigurationModel settings) { var msr = new XElement("multipleSameRefPolicy"); return(msr); }
private XElement createErrorInCells(PolicyConfigurationModel settings) { var eic = new XElement("errorContainingCellPolicy"); return(eic); }
/// <summary> /// Sets settings for the one among others rule /// </summary> /// <param name="settings"></param> private void SetOneAmongOth(PolicyConfigurationModel settings) { if (settings.OneAmongOthers) { CB_OneAmongOthers.Checked = true; OAO_A.Enabled = true; OAO_M.Enabled = true; if (!settings.OneAmongOthersAutomatic) { OAO_M.Checked = true; } else { OAO_A.Checked = true; } } }
/// <summary> /// Sets the settings for the Reading Direction /// </summary> /// <param name="settings"></param> private void SetReadingDir(PolicyConfigurationModel settings) { if (settings.ReadingDirection) { CB_ReadingDirection.Checked = true; RD_A.Enabled = true; RD_M.Enabled = true; if (!settings.ReadingDirectionAutomatic) { RD_M.Checked = true; } else { RD_A.Checked = true; } } }
private XElement createNoConstants(PolicyConfigurationModel settings) { var noConstant = new XElement("noConstantsInFormulasPolicy"); return(noConstant); }
/// <summary> /// Sets the Setting for the string distance /// </summary> /// <param name="settings"></param> private void SetStringDist(PolicyConfigurationModel settings) { if (settings.StringDistance) { CB_StringDistance.Checked = true; SD_A.Enabled = true; SD_M.Enabled = true; if (!settings.StringDistanceAutomatic) { SD_M.Checked = true; } else { SD_A.Checked = true; } SD_Amount.Text = settings.StringDistanceMaxDist.ToString(); } else { SD_Amount.Enabled = false; } }
/// <summary> /// Sets the setting for Error in Cells /// </summary> /// <param name="settings"></param> private void SetErrorinCell(PolicyConfigurationModel settings) { if (settings.ErrorInCells) { CB_ErrorInCells.Checked = true; EIC_A.Enabled = true; EIC_M.Enabled = true; if (!settings.OneAmongOthersAutomatic) { EIC_M.Checked = true; } else { EIC_A.Checked = true; } } }
private XElement createStringDistance(PolicyConfigurationModel settings) { XElement stringDst = new XElement("stringDistancePolicyRule"); XElement dist = new XElement("stringDistanceDifference"); dist.Value = settings.StringDistanceMaxDist.ToString(); stringDst.Add(dist); return stringDst; }