private void CheckElementWarning(object sender, FailuresProcessingEventArgs args)
        {
            try
            {
                if (isElementChanged)
                {
                    FailuresAccessor fa = args.GetFailuresAccessor();

                    WarningWindow warningWindow = new WarningWindow(reportingInfo);
                    if ((bool)warningWindow.ShowDialog())
                    {
                        args.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
                        FailureHandlingOptions option = fa.GetFailureHandlingOptions();
                        option.SetClearAfterRollback(true);
                        fa.SetFailureHandlingOptions(option);
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                MessageBox.Show("Failed to promt users for a warning message.\n" + ex.Message, "Check Element Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                isElementChanged = false;
            }
        }
        public static void ProcessFailure(object sender, FailuresProcessingEventArgs args)
        {
            try
            {
                if (isElementModified && null != currentDoc)
                {
                    FailuresAccessor fa = args.GetFailuresAccessor();

                    DTMWindow dtmWindow = new DTMWindow(currentDoc, elementModified);
                    if ((bool)dtmWindow.ShowDialog())
                    {
                        args.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
                        FailureHandlingOptions option = fa.GetFailureHandlingOptions();
                        option.SetClearAfterRollback(true);
                        fa.SetFailureHandlingOptions(option);
                    }
                    isElementModified = false;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                LogUtil.AppendLog("DTMFailure-ProcessFailure:" + ex.Message);
            }
        }
        private void Application_FailuresProcessing(object sender, FailuresProcessingEventArgs e)
        {
            FailuresAccessor failuresAccessor = e.GetFailuresAccessor();

            failuresAccessor.DeleteAllWarnings();

            IList <FailureMessageAccessor> fmas = failuresAccessor.GetFailureMessages();

            var options = failuresAccessor.GetFailureHandlingOptions();

            options.SetClearAfterRollback(true);
            options.SetForcedModalHandling(false);

            failuresAccessor.SetFailureHandlingOptions(options);
        }
Exemple #4
0
        public static void ProcessFailure(object sender, FailuresProcessingEventArgs args)
        {
            try
            {
                if (isDoorFailed)
                {
                    FailuresAccessor fa = args.GetFailuresAccessor();
                    IList <FailureMessageAccessor> failList = new List <FailureMessageAccessor>();
                    failList = fa.GetFailureMessages();
                    bool foundFailingElement = false;
                    foreach (FailureMessageAccessor failure in failList)
                    {
                        foreach (ElementId id in failure.GetFailingElementIds())
                        {
                            if (failingDoorId.IntegerValue == id.IntegerValue)
                            {
                                foundFailingElement = true;
                            }
                        }
                    }
                    if (foundFailingElement)
                    {
                        args.SetProcessingResult(FailureProcessingResult.ProceedWithRollBack);
                        FailureHandlingOptions option = fa.GetFailureHandlingOptions();
                        option.SetClearAfterRollback(true);
                        fa.SetFailureHandlingOptions(option);
                    }

                    isDoorFailed = false;
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
                LogUtil.AppendLog("DoorFailure-ProcessFailure:" + ex.Message);
            }
        }