/// <summary>
        /// Sets the caption and builds the message that will be presented to the user whenever
        /// a <see cref="iClickerQuizPts.AppExceptions.InvalidWshListObjPairException"/> is thrown.
        /// </summary>
        /// <param name="pr">The <see langword="struc"/> which is missing either or both the name of the list object and
        /// the name of the parent worksheet.</param>
        public static void SetInvalidWshListObjPairMsg(WshListobjPair pr)
        {
            // Plug in a "Missing Value" value where appropriate...
            string wshNm = pr.WshNm;
            string tblNm = pr.ListObjName;

            if (string.IsNullOrEmpty(pr.WshNm))
            {
                wshNm = MSG_VAL;
            }
            if (string.IsNullOrEmpty(pr.ListObjName))
            {
                tblNm = MSG_VAL;
            }


            _caption = "Code Missing a Value";

            // Build msg...
            const string S1 =
                "There is a problem with this application's code.";
            const string S2 =
                "The code requires a value for both the name of an Excel ListObject (i.e., Table) and of its parent worksheet.  ";
            const string S3 = "However, at least one of these values is missing.";

            _msg = string.Format($"{S1}\n\n{S2}{S3}\n\n\tWsh name:\t{wshNm}\n\n\tTable name:\t{tblNm}\n\n{CANNOT_CONTINUE}");
        }
        /// <summary>
        /// Sets the caption and builds the message that will be presented to the user whenever
        /// a <see cref="iClickerQuizPts.AppExceptions.MissingWorksheetException"/> is thrown.
        /// </summary>
        /// <param name="pr">The <see langword="struc"/> which contains the name of the missisng
        /// worksheet.</param>
        public static void SetMissingWshMsg(WshListobjPair pr)
        {
            _caption = "This Workbook Has Been Altered";

            // Build msg...
            const string S1 =
                "We cannot find at least one of the Worksheets originally built into this workbook. ";

            _msg = string.Format($"{S1}\n\n\tMissing worksheet:\n\t\t{pr.WshNm}\n\n{CANNOT_CONTINUE}");
        }
        /// <summary>
        /// Sets the caption and builds the message that will be presented to the user whenever
        /// a <see cref="iClickerQuizPts.AppExceptions.MissingListObjectException"/> is thrown.
        /// </summary>
        /// <param name="pr">The <see langword="struc"/> which contains the name of the missisng
        /// list object and the name of the parent worksheet.</param>
        public static void SetMissingListObjMsg(WshListobjPair pr)
        {
            _caption = "This Workbook Has Been Altered";

            // Build msg...
            const string S1 =
                "We cannot find at least one of the ListObjects (Tables) required to run this application. ";

            _msg = string.Format($"{S1}\n\n\tMissing ListObject(Table):\n\t\t{pr.ListObjName}");
            _msg = string.Format($"{_msg}\n\n\tWorksheet:\n\t\t{pr.WshNm}\n\n{CANNOT_CONTINUE}");
        }
Example #4
0
        /// <summary>
        /// Instantiates the (currently) 2 fields of List Object wrapper classes.
        /// </summary>
        public virtual void InstantiateListObjWrapperClasses()
        {
            // Define the wsh-ListObj pairs...
            WshListobjPair quizDataLOInfo =
                new WshListobjPair("tblClkrQuizGrades", Globals.Sheet1.Name);
            WshListobjPair dblDpprsLOInfo =
                new WshListobjPair("tblDblDippers", Globals.Sheet2.Name);

            // Instantiate quiz data class...
            try
            {
                _qdLOWrppr = new QuizDataLOWrapper(quizDataLOInfo);
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
            try
            {
                _qdLOWrppr.SetListObjAndParentWshPpts();
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }

            // Instantiate double dippers class...
            try
            {
                _ddsLOWrppr = new DblDippersLOWrapper(dblDpprsLOInfo);
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
            try
            {
                _ddsLOWrppr.SetListObjAndParentWshPpts();
            }
            catch (ApplicationException ex)
            {
                throw ex;
            }
        }