Esempio n. 1
0
        private static async void HandleAutoRunMode()
        {
            string phase = "Running in Automatic Execution Mode";

            Reporter.ToLog(eLogLevel.INFO, phase);

            AutoLogProxy.LogAppOpened();
            AppSplashWindow.LoadingInfo(phase);

            var result = await App.RunsetExecutor.RunRunSetFromCommandLine();

            Reporter.ToLog(eLogLevel.INFO, "Closing Ginger automatically...");
            App.MainWindow.CloseWithoutAsking();
            //TODO: find a way not to open Main window at all
            Reporter.ToLog(eLogLevel.INFO, "Ginger UI Closed.");

            //setting the exit code based on execution status
            if (result == 0)
            {
                Reporter.ToLog(eLogLevel.DEBUG, ">> Run Set executed and passed, exit code: 0");
                Environment.ExitCode = 0;//success
            }
            else
            {
                Reporter.ToLog(eLogLevel.DEBUG, ">> No indication found for successful execution, exit code: 1");
                Environment.ExitCode = 1;//failure
            }

            AutoLogProxy.LogAppClosed();
            Environment.Exit(Environment.ExitCode);
        }
Esempio n. 2
0
        public static void InitApp()
        {
            // Add event handler for handling non-UI thread exceptions.
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += new UnhandledExceptionEventHandler(StandAloneThreadExceptionHandler);

            Reporter.WorkSpaceReporter = new GingerWorkSpaceReporter();

            if (Environment.GetCommandLineArgs().Count() > 1)
            {
                // When running from unit test there are args, so we set a flag in GingerAutomator to make sure Ginger will Launch
                // and will not try to process the args for RunSet auto run
                if (RunningFromUnitTest)
                {
                    // do nothing for now, but later on we might want to process and check auto run too
                }
                else
                {
                    // This Ginger is running with run set config will do the run and close Ginger
                    WorkSpace.RunningInExecutionMode = true;
                    Reporter.ReportAllAlsoToConsole  = true; //needed so all reportering will be added to Consol
                    //Reporter.AppLogLevel = eAppReporterLoggingLevel.Debug;//needed so all reportering will be added to Log file
                }
            }

            string phase = string.Empty;

            RepositoryItemHelper.RepositoryItemFactory = new RepositoryItemFactory();

            //Helper.RuntimeObjectFactory = new RuntimeObjectFactory();

            AutomateTabGingerRunner = new GingerRunner(eExecutedFrom.Automation);

            WorkSpaceEventHandler WSEH = new WorkSpaceEventHandler();

            WorkSpace.Init(WSEH);

            WorkSpace.Instance.BetaFeatures = BetaFeatures.LoadUserPref();
            WorkSpace.Instance.BetaFeatures.PropertyChanged += BetaFeatureChanged;

            AutomateBusinessFlowEvent += App_AutomateBusinessFlowEvent;

            if (WorkSpace.Instance.BetaFeatures.ShowDebugConsole)
            {
                DebugConsoleWindow.Show();
                WorkSpace.Instance.BetaFeatures.DisplayStatus();
            }

            Reporter.ToLog(eLogLevel.INFO, "######################## Application version " + App.AppVersion + " Started ! ########################");

            AppSplashWindow.LoadingInfo("Init Application");
            WorkSpace.AppVersion = App.AppShortVersion;
            // We init the classes dictionary for the Repository Serializer only once
            InitClassTypesDictionary();

            // TODO: need to add a switch what we get from old ginger based on magic key

            phase = "Loading User Profile";
            Reporter.ToLog(eLogLevel.DEBUG, phase);
            AppSplashWindow.LoadingInfo(phase);
            WorkSpace.UserProfile = UserProfile.LoadUserProfile();

            phase = "Configuring User Type";
            Reporter.ToLog(eLogLevel.DEBUG, phase);
            AppSplashWindow.LoadingInfo(phase);
            WorkSpace.UserProfile.LoadUserTypeHelper();


            phase = "Loading User Selected Resource Dictionaries";
            Reporter.ToLog(eLogLevel.DEBUG, phase);
            AppSplashWindow.LoadingInfo(phase);
            if (WorkSpace.UserProfile != null)
            {
                LoadApplicationDictionaries(Amdocs.Ginger.Core.eSkinDicsType.Default, WorkSpace.UserProfile.TerminologyDictionaryType);
            }
            else
            {
                LoadApplicationDictionaries(Amdocs.Ginger.Core.eSkinDicsType.Default, GingerCore.eTerminologyType.Default);
            }

            Reporter.ToLog(eLogLevel.DEBUG, "Loading user messages pool");
            UserMsgsPool.LoadUserMsgsPool();
            StatusMsgsPool.LoadStatusMsgsPool();

            Reporter.ToLog(eLogLevel.DEBUG, "Init the Centralized Auto Log");
            AutoLogProxy.Init(App.AppVersion);

            Reporter.ToLog(eLogLevel.DEBUG, "Initializing the Source control");
            AppSplashWindow.LoadingInfo(phase);

            phase = "Loading the Main Window";
            Reporter.ToLog(eLogLevel.DEBUG, phase);
            AppSplashWindow.LoadingInfo(phase);
            MainWindow = new Ginger.MainWindow();
            MainWindow.Show();
            MainWindow.Init();

            // If we have command line params process them and do not load MainWindow
            if (WorkSpace.RunningInExecutionMode == true)
            {
                HandleAutoRunMode();
            }

            //AppSplashWindow.LoadingInfo("Ready!");
            App.AppSplashWindow = null;

            AutoLogProxy.LogAppOpened();

            if ((WorkSpace.UserProfile.Solution != null) && (WorkSpace.UserProfile.Solution.ExecutionLoggerConfigurationSetList != null))
            {
            }

            // Register our own Ginger tool tip handler
            //--Canceling customize tooltip for now due to many issues and no real added value

            phase = "Application was loaded and ready";
            Reporter.ToLog(eLogLevel.INFO, phase);
            mIsReady = true;
        }