public static void ProgressDialogProcessStep(Dnp.Utils.ProgressDialog pd)
 {
     if (pd.ProgressBar.Value < pd.ProgressBar.Maximum)
     {
         pd.ProgressBar.Value += 1;
     }
 }
 public static Dnp.Utils.ProgressDialog GetNewProgressDialog(int length)
 {
     Dnp.Utils.ProgressDialog pd = new Dnp.Utils.ProgressDialog();
     pd.ProgressBar.Minimum = 1;
     pd.ProgressBar.Maximum = length;
     pd.ProgressBar.Value   = 1;
     return(pd);
 }
 public ProgressDialogWrapper(Dnp.Utils.ProgressDialog progressDialog)
 {
     _progressDialog = progressDialog;
     script          = ScriptSettings.GetInstance();
 }
 public ProgressDialogWrapper(Dnp.Utils.ProgressDialog progressDialog)
 {
     _progressDialog = progressDialog;
     script = ScriptSettings.GetInstance();
 }
Exemple #5
0
        /// <summary>
        /// Call this method first. This initializes everything that is
        /// necessary to run the application.
        /// </summary>
        /// <param name="MyMeta"></param>
        /// <param name="zeus"></param>
        public void Init(MyMeta.dbRoot MyMeta, Zeus.IZeusContext zeus, IZeusInput input, Dnp.Utils.Utils dnp, Dnp.Utils.ProgressDialog progressDialog)
        {
            // Initialize the ScriptSettings and save the input values from the MyGeneration form.
            try
            {
                _scriptSettings = ScriptSettings.InitInstance(input, MyMeta, dnp, _version);
                //_scriptSettings = new ScriptSettings(input, MyMeta, dnp, _version);
                _scriptSettings.SaveSettings();
            }
            catch (Exception ex)
            {
                if (ex.InnerException != null)
                {
                    throw new Exception("Error Saving ScriptSettings (inner): " + ex.InnerException.Message);
                }
                throw new Exception("Error Saving ScriptSettings: " + ex.Message + " - " + ex.StackTrace.ToString());
            }


            // Populate the RequestContext class with all the values
            // needed to be passed to every code generating class.
            RequestContext context = new RequestContext();

            context.Zeus           = zeus;                                           // Pass along the MyGeneration output context for saving files
            context.MyMeta         = MyMeta;                                         // Pass along the Database meta properties
            context.FileList       = _fileList;                                      // Start the ArrayList for printing the generated files
            context.ScriptSettings = _scriptSettings;                                // Store the saved form values
            context.Dialog         = new ProgressDialogWrapper(progressDialog);      // Get instance of Dialog wrapper
            context.Database       = MyMeta.Databases[_scriptSettings.DatabaseName]; // Get the selected database
            context.Utility        = new CommonUtility();                            // Get instance of helper utility

            _context = context;
        }