Пример #1
0
 public static bool IsModifier(TypeGV typeGV)
 {
     return(DefsGM.From(typeGV) != DefsGM.TypeGM.Invalid);
 }
Пример #2
0
        private void CallGV(DefsGV.TypeGV typeGV)
        {
            /*
             *        TRY/CATCH function
             */

            /*
             *        MEANING:    UNCONDITIONAL call of action
             */

            GErrList gerrlist = null;

            try
            {
                this.statusGV[(int)typeGV].StatusExec = StatusGV.TypeStatusExec.Aborted;
                this.statusGV[(int)typeGV].StatusRes  = StatusGV.TypeStatusRes.Undef;
                gerrlist = new GErrList();

                if (DefsGV.IsModifier(typeGV))
                {
                    this.fm.OnGM(this.index, DefsGM.From(typeGV), true);
                }

                // check that pre-required tests are performed
                if (!this.CanBeExec(typeGV))
                {
                    this.statusGV[(int)typeGV].StatusExec =
                        StatusGV.TypeStatusExec.UnableToExec;
                }

                // call Validate.. function
                System.Exception excValidation = null;
                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.UnableToExec)
                {
                    try
                    {
                        string     strTypeCV  = Enum.GetName(typeof(DefsGV.TypeGV), typeGV);
                        MethodInfo infoMethod = this.GetType().GetMethod(strTypeCV,
                                                                         System.Reflection.BindingFlags.Instance |
                                                                         System.Reflection.BindingFlags.NonPublic);
                        if (infoMethod != null)
                        {
                            object[] pars = { gerrlist };

                            // statusGV can be set to:
                            // Completed || UnableToExec || Aborted
                            try
                            {
                                this.statusGV[(int)typeGV].StatusExec = (StatusGV.TypeStatusExec)
                                                                        infoMethod.Invoke(this, pars);
                            }
                            catch (System.Reflection.TargetInvocationException TIException)
                            {
                                throw TIException.InnerException;
                            }

                            GErrSign.Sign(gerrlist, typeGV, this.index);
                        }
                        if (this.statusGV[(int)typeGV].StatusExec ==
                            StatusGV.TypeStatusExec.Completed)
                        {
                            this.statusGV[(int)typeGV].StatusRes =
                                gerrlist.StatusResGV(typeGV);
                        }
                    }
                    catch (System.Exception exc)
                    {
                        excValidation = exc;
                        this.statusGV[(int)typeGV].StatusExec =
                            StatusGV.TypeStatusExec.Aborted;
                    }
                }

                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.Completed)
                {
                    this.CleanUpOnNonCompletedGV(typeGV);
                    GErrValidation gerrVal = new GErrValidation(this.index,
                                                                this.typeGlyph,
                                                                typeGV,
                                                                this.statusGV[(int)typeGV].StatusExec,
                                                                excValidation);
                    gerrlist.Add(gerrVal);
                }

                GErrSign.Sign(gerrlist, typeGV, this.index);
                this.fm.OnGV(this.index, typeGV, gerrlist);
                gerrlist.ClearRelease();
            }

            catch (Exception excManagement) // exception thrown by the fm management structures
            {
                this.statusGV[(int)typeGV].StatusExec =
                    StatusGV.TypeStatusExec.Aborted;
                this.CleanUpOnNonCompletedGV(typeGV);    // T/C function
                GErrValidation gerrVal = new GErrValidation(this.index,
                                                            this.typeGlyph,
                                                            typeGV,
                                                            StatusGV.TypeStatusExec.Aborted,
                                                            excManagement);
                this.fm.ReportFailure(gerrVal);            // T/C function
                if (gerrlist != null)
                {
                    try { gerrlist.ClearRelease(); }
                    catch (Exception) {}
                }
            }
        }