示例#1
0
        public static void ReloadProject(string _namespace)
        {
            string projectPath = GlobalClass.MainForm.txtCurOpenProj.Text;

            Logger.WriteInformationLog(LoggerMessages.GUI.BGWorker.Misc.Information.RELOAD_PROJ + PackageManagement.OpenedProject.DirectoryPath + ".", MethodBase.GetCurrentMethod().ToLogFormatFullName());
            GlobalClass.LocalPackControls.LoadInfoInstalledPackage(null as RMPackage, _namespace);
            LogDataList log = null;

            try
            {
                PackageManagement.OpenProject(projectPath, MethodBase.GetCurrentMethod().ToLogFormatFullName(), out log);
            }
            catch (Exception ex)
            {
                Logger.WriteErrorLog(LoggerMessages.GUI.BGWorker.Misc.Error.OpenProjFailed(projectPath), MethodBase.GetCurrentMethod().ToLogFormatFullName(), ex, BasicDebugLogger.DebugErrorType.Error);
                Helper.ShowMessageBox(MessageBoxStrings.GUI.RELOADING_PROJECT_ERROR + projectPath + ".", MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                GlobalClass.LocalPackControls.CloseProject(_namespace);
                GlobalClass.LocalPackControls.SetEnableSearchControls(false);
                return;
            }

            if (log != null && log.HasErrorsOrWarnings())
            {
                Helper.ShowMessageBox(MessageBoxStrings.General.HAS_ERRORS_WARNINGS, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                frmLogger loggerForm = new frmLogger(_logList: log);
                loggerForm.StartPosition = FormStartPosition.CenterParent;
                loggerForm.ShowDialog();
            }

            GlobalClass.MainForm.txtCurOpenProj.Text = projectPath;
            Helper.ShowMessageBox(MessageBoxStrings.GUI.RestoreProjectSuccess(projectPath), MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#2
0
        public static void OpenProject(Form parentForm, OpenFileDialog openFileDialog)
        {
            string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName();

            Logger.WriteUserEventLog(LoggerMessages.GUI.BGWorker.Misc.Information.OPEN_PROJ_BEGIN, LoggerMessages.GUI.ActionTaken.SHOW_OPEN_FILE_DLG, _namespace);
            openFileDialog.ResetValues(FileDialogFilters.MV_PROJ_FILE);

            DialogResult dResult = openFileDialog.ShowDialog(parentForm);

            if (dResult == DialogResult.Cancel)
            {
                Logger.WriteUserEventLog(LoggerMessages.GUI.BGWorker.Misc.Information.OPEN_PROJ_CANCELLED, _namespace);
                return;
            }

            LogDataList log = null;

            try
            {
                PackageManagement.OpenProject(openFileDialog.FileName, _namespace, out log);
            }
            catch (Exception ex)
            {
                Logger.WriteErrorLog(LoggerMessages.GUI.BGWorker.Misc.Error.OpenProjFailed(openFileDialog.FileName), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                Helper.ShowMessageBox(MessageBoxStrings.GUI.OPEN_PROJECT_ERROR + openFileDialog.FileName + ".", MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (log != null && log.HasErrorsOrWarnings())
            {
                Helper.ShowMessageBox(MessageBoxStrings.General.HAS_ERRORS_WARNINGS, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                frmLogger loggerForm = new frmLogger(_logList: log);
                loggerForm.StartPosition = FormStartPosition.CenterParent;
                loggerForm.ShowDialog();
            }

            Logger.WriteUserEventLog(LoggerMessages.GUI.BGWorker.Misc.Information.OpenProjSuccess(openFileDialog.FileName), _namespace);
            Helper.ShowMessageBox(MessageBoxStrings.GUI.OpenProjectSuccess(openFileDialog.FileName), MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
            GlobalClass.MainForm.txtCurOpenProj.Text = openFileDialog.FileName;
            GlobalClass.LocalPackControls.SetEnableSearchControls(true);
        }