/// <summary>
        /// Default constructor, Options should be obtained from public properties
        /// </summary>
        static AutoOptionsResolution()
        {
            NoActionRes = new AutoOptionsResolution()
            {
                Resolution          = AutoOptionsResolutionType.NoAction,
                FriendlyCaption     = "No Action",
                FriendlyDescription = "Continue with default Revit failure behaivor"
            };
            //todo: add default res
            CancelRes = new AutoOptionsResolution()
            {
                Resolution          = AutoOptionsResolutionType.CancelTransaction,
                FriendlyCaption     = "Cancel Transaction",
                FriendlyDescription = "Cancel the action that produced the failure"
            };
            DeleteRes = new AutoOptionsResolution()
            {
                Resolution          = AutoOptionsResolutionType.DeleteAffected,
                FriendlyCaption     = "Delete Elements",
                FriendlyDescription = "Delete all affected elements"
            };
            HideRes = new AutoOptionsResolution()
            {
                Resolution          = AutoOptionsResolutionType.HideWarning,
                FriendlyCaption     = "Hide Warning",
                FriendlyDescription = "Hide the warning"
            };

            ErrorResolutions = new List <FailureResolutionOption> {
                NoActionRes, CancelRes, DeleteRes
            };
            WarningResolutions = new List <FailureResolutionOption> {
                NoActionRes, CancelRes, DeleteRes, HideRes
            };
        }
        public AutoFailureHandlingOptions(FailureDefinitionAccessor fda) : this()
        {
            FailureGuid = fda.GetId().Guid;
            BuiltInFailuresInternalName = fda.GetBuiltInFailuresInternalName();
            UserDescription             = fda.GetDescriptionText();
            BuiltInFailuresSubCategory  = fda.GetBuiltInFailuresSubCategory();

            switch (fda.GetSeverity())
            {
            case FailureSeverity.None:
                SeverityDescription = "None";
                break;

            case FailureSeverity.Warning:
                SeverityDescription = "Warning";
                break;

            case FailureSeverity.Error:
                SeverityDescription = "Error";
                break;

            case FailureSeverity.DocumentCorruption:
                SeverityDescription = "Document Corruption";
                break;

            default:
                break;
            }

            HasResolutions = fda.HasResolutions();

            if (fda.GetSeverity() == FailureSeverity.Warning)
            {
                AvailableResolutions = AutoOptionsResolution.WarningResolutions.Concat(fda.GetRevitFailureResolutionOptions()).ToList();
            }
            else if (fda.GetSeverity() == FailureSeverity.Error)
            {
                AvailableResolutions = AutoOptionsResolution.ErrorResolutions.Concat(fda.GetRevitFailureResolutionOptions()).ToList();
            }
            else
            {
                AvailableResolutions = new List <FailureResolutionOption>();
            }

            HasResolutions = fda.HasResolutions();
            FailureResolutionOption noActionRes = AvailableResolutions
                                                  .Where(x => x is AutoOptionsResolution)
                                                  .Cast <AutoOptionsResolution>()
                                                  .Where(x => x.Resolution == ((AutoOptionsResolution)AutoOptionsResolution.NoActionRes).Resolution)
                                                  .FirstOrDefault();

            SelectedResIndex = AvailableResolutions.IndexOf(noActionRes);
        }
 /// <summary>
 /// Sets all FailureOptions to do nothing
 /// </summary>
 public void ResetAllSelectedOptions()
 {
     foreach (AutoFailureHandlingOptions opt in AllFailureOptions)
     {
         FailureResolutionOption noActionRes = opt.AvailableResolutions
                                               .Where(x => x is AutoOptionsResolution)
                                               .Cast <AutoOptionsResolution>()
                                               .Where(x => x.Resolution == ((AutoOptionsResolution)AutoOptionsResolution.NoActionRes).Resolution)
                                               .FirstOrDefault();
         Int32 SelectedResIndex =
             opt.SelectedResIndex = opt.AvailableResolutions.IndexOf(noActionRes);
     }
 }