示例#1
0
//----------------------------------------------------------------------------
//                                                                 ReportError
//----------------------------------------------------------------------------
        private void ReportError(Series.Cause eErrCause, Series.Exception eErrException)
        {
            UInt32 dwErrCause;
            UInt32 dwErrExcept;
            string strCode;
            string strMsg;
            string strNameCause;
            string strNameExcep;
            string strTitle;

// Init
            dwErrCause   = (UInt32)eErrCause;
            dwErrExcept  = (UInt32)eErrException;
            strNameCause = eErrCause.ToString();
            strNameExcep = eErrException.ToString();
// Prepare error message
            strCode  = $"0x{dwErrCause:X2}{dwErrExcept:X2}";
            strMsg   = $"{strCode}\r\n{strNameCause}\r\n{strNameExcep}\r\n\r\n{mstrDetail}";
            strTitle = moResources.GetString(EnumResx.ShortTitle, CProgram.CultureInfo);

            MessageBox.Show(strMsg, strTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop);

// Always close the app after an error
            meAction = EnumFormAction.DoCloseApp;
        }
示例#2
0
//----------------------------------------------------------------------------
//                                                                TakeNextStep
//----------------------------------------------------------------------------

/*
 *   TakeNextStep() controls progress through the several steps of deployment.
 *   This function can be called by manually clicking on a Next button, or
 *   directly from within a function to perform an automatic step forward.
 *
 *   stepDirection allows for more complex future forms which allow back
 *   stepping. However, at the moment it is not actively used.
 *
 *   Returns true if a change in the step counter was performed.
 */
        private Boolean TakeNextStep(EnumStep stepDirection)
        {
            WORD wStep;

// Move to next step
            wStep = mwStep;
// Distribute on direction
            switch (stepDirection)
            {
            case EnumStep.Next:
                // Attempt to move to next step
                wStep++;
                // Ignore if no forward steps remain
                if (wStep >= (WORD)EnumStep.NoMoreSteps)
                {
                    return(false);
                }
                break;

            case EnumStep.Back:
                // Attempt to move to next step
                wStep--;
                // Ignore if no backward steps remain
                if (wStep == 0)
                {
                    return(false);
                }
                break;
            }
// Prepare form for the next step
            mwStep   = wStep;
            meAction = EnumFormAction.DoStep;
            return(true);
        }
示例#3
0
//############################################################################
//                                                                 Event_Timer
//----------------------------------------------------------------------------

/*
 *   Event_Timer() is called every 100ms as specified in SetUpAutomation().
 *   With each call, the form command code is examined and acted on if it is
 *   set to a value other than "FormAction.DoNothing".
 *
 *   This effect was designed to operate while the Bossac programmer is
 *   operating to show that the Update utility is itself busy.
 */
        private void Event_Timer(Object oTimer, EventArgs eventArgs)
        {
            EnumFormAction action;

            Series.Cause     eErrCause;
            Series.Exception eErrException;

// Check if an error was detected
            if (meErrCause != Series.Cause.None)
            {
                // Controlled access to the error reporting methods
                eErrCause     = meErrCause;
                eErrException = meErrException;
                // Reset global members
                meErrCause     = Series.Cause.None;
                meErrException = Series.Exception.None;
                ReportError(eErrCause, eErrException);
            }
// Init
            action = meAction;
// Ignore if no action to be tacken yet
            if (meAction == EnumFormAction.DoNothing)
            {
                return;
            }
// Prevent from repeating incoming action
            meAction = EnumFormAction.DoNothing;

// Distribute control on action
            switch (action)
            {
            case EnumFormAction.DoStep:
                switch ((EnumStep)mwStep)
                {
                case EnumStep.SelectTargetFolders: DoSelectFolders(); break;

                case EnumStep.DeployProgramFiles:  DoDeployment();    break;

                case EnumStep.CloseApp:            DoCloseApp();      break;
                }
                break;

            case EnumFormAction.DoCloseApp:
                DoCloseApp();
                break;
            }
        }
示例#4
0
//****************************************************************************
//                                                                     Methods
//****************************************************************************


//============================================================================
//                                                                       CForm
//----------------------------------------------------------------------------
        public CForm()
        {
// Prepare form window
            WindowState   = FormWindowState.Normal;
            AutoScaleMode = AutoScaleMode.Dpi;
// Global inits
            moResources    = Strings.ResourceManager;
            meAction       = EnumFormAction.DoStep;
            meErrCause     = Series.Cause.None;
            meErrException = Series.Exception.None;
            mwStep         = (WORD)EnumStep.SelectTargetFolders;
// Start up window
            InitializeComponent();
// Fetch base folder names from environment
            mstrSystem   = Environment.GetFolderPath(Environment.SpecialFolder.System);
            mstrCommon   = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            mstrPrivate  = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            mstrSoftware = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
            mstrWorking  = Environment.CurrentDirectory;
            mstrAccount  = Environment.UserName;
// Set up automated form
            timing.Start();
        }