/// <summary>
        /// Sets up the configuration for the application
        /// </summary>
        /// <param name="services"></param>
        /// <param name="setupType"></param>
        public static void BootstrapConfig(IServiceCollection services, SetupType setupType = SetupType.Debug)
        {
            // Switch the setup type based on the compile time constant
#if RELEASE
            if (setupType != SetupType.Test)
            {
                setupType = SetupType.Release;
            }
#endif

            if (services == null)
            {
                services = new ServiceCollection();
            }

            // Create a new instance of the configuration service using the setup type
            var configService = new ConfigurationService(setupType.GetDescription());

            services.AddSingleton <IConfigurationService>(x => configService);
            services.AddSingleton <ISettings>(x => configService.Get <Settings>("Settings"));
            services.AddSingleton <IApiSettings>(x => configService.Get <ApiSettings>("ApiSettings"));

            var provider = services.BuildServiceProvider();

            Settings             = provider.GetService <ISettings>();
            ApiSettings          = provider.GetService <IApiSettings>();
            ConfigurationService = provider.GetService <IConfigurationService>();
        }
Exemple #2
0
        public static void GoToSetup(SetupType setupType)
        {
            Driver.Instance.FindElement(By.Id("module-picker-link")).Click();
            Driver.Instance.FindElement(By.Id("select-scheduler")).Click();

            var schedulerSetupItems   = Driver.Instance.FindElement(By.Id("scheduler-setup-sub-menu-items"));
            var schedulerSetupItemsLi = schedulerSetupItems.FindElements(By.TagName("li"));

            if (!schedulerSetupItemsLi[1].Displayed)
            {
                Driver.Instance.FindElement(By.Id("scheduler-setup-sub-menu-header")).Click();
            }

            switch (setupType)
            {
            case SetupType.DailyRules:
                Driver.Instance.FindElement(By.Id("dailyRule-link")).Click();

                break;

            case SetupType.WeeklyRules:
                Driver.Instance.FindElement(By.Id("weeklyRules-link")).Click();

                break;
            }
        }
Exemple #3
0
 public virtual void BeforeTest(ITest test)
 {
     TestName = test.MethodName;
     if (type == SetupType.Unknown)
     {
         type = SetupType.TestAction;
     }
 }
Exemple #4
0
 public virtual void Setup(BaseTestCase nmsTest)
 {
     TestName = TestContext.CurrentContext.Test.MethodName;
     if (type == SetupType.Unknown)
     {
         type = SetupType.TestSetup;
     }
 }
Exemple #5
0
        public static bool IsNeedSetupProfile(WorkEqp weqp, IHandlingBatch hb)
        {
            try
            {
                MicronBEAssyEqp eqp = null;
                if (InputMart.Instance.MicronBEAssyEqp.ContainsKey(weqp.Target.EqpID))
                {
                    eqp = InputMart.Instance.MicronBEAssyEqp[weqp.Target.EqpID];
                }

                if (eqp == null)
                {
                    return(false);
                }

                MicronBEAssyBELot lot = hb as MicronBEAssyBELot;

                BEStep     step = lot.CurrentStep;
                StepMaster sm   = InputMart.Instance.StepMasterView.FindRows(step.StepID).FirstOrDefault();

                if (sm == null)
                {
                    return(false);
                }

                foreach (var info in InputMart.Instance.SetupInfo.DefaultView)
                {
                    if (info.LINE_ID != eqp.LineID)
                    {
                        continue;
                    }

                    //if (UtilityHelper.StringToEnum(info.STEP_GROUP, StepGroup.NONE) != eqp.StepGroup)
                    //    continue;

                    //if (LikeUtility.Like(eqp.EqpModel, info.EQP_MODEL) == false)
                    //    continue;

                    SetupType type = SimulationHelper.CheckSetupProfile(weqp, hb);

                    if (type != SetupType.NONE)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                return(false);
            }
            catch (Exception e)
            {
                WriteHelper.WriteErrorHistory(ErrorLevel.FATAL, string.Format("ErrorMessage : {0}   MethodName : {1}", e.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name));
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// Registers service implementations with the DI container,
        /// based on the setup type
        /// </summary>
        public static void Bootstrap(IServiceCollection services, SetupType setupType = SetupType.Debug)
        {
#if RELEASE
            if (setupType != SetupType.Test)
            {
                setupType = SetupType.Release;
            }
#endif

            if (services == null)
            {
                services = new ServiceCollection();
            }

            switch (setupType)
            {
            case SetupType.Release:
                services.AddSingleton <ISettings, Settings>();

                break;

            case SetupType.Debug:
                services.AddSingleton <ISettings, SettingsDev>();

                break;

            case SetupType.Test:
                services.AddSingleton <ISettings, SettingsTest>();

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(setupType), setupType, null);
            }

            services.AddTransient <IApiClient, ApiClient>();
            services.AddTransient <ILogger, ApplicationInsightsLogger>();

            services.AddTransient <ICatRepository, CatRepository>();
            //container.AddTransient<IMessageBroker<Cat>, AzureMessageBroker<Cat>>();
            services.AddTransient <IMessageBrokerConsumer, MessageBrokerConsumer>();
            services.AddTransient <ICatService, CatService>();
            services.AddTransient <IMainViewModel, MainViewModel>();

            var serviceProvider = services.BuildServiceProvider();

            IocWrapper.Instance = new IocWrapper(serviceProvider);
        }
        public static Grid CreateGameFromJsonFile(SetupType setupType, string pathname) //should take in a string of json
        {
            if (string.IsNullOrEmpty(pathname))
            {
                throw new ApplicationException("Invalid path");
            }

            try
            {
                File.Exists(pathname);
                _setupDict[SetupType.PathName] = new PathNameGameSetupHandler(pathname); //ui should handle reading json
                return(GenerateInitialGrid(setupType));
            }
            catch (Exception e)
            {
                throw new ApplicationException("Invalid path", e);
            }
        }
        /// <summary>
        /// Resets the object's properties.
        /// </summary>
        void Reset()
        {
            // Reset the key child components.
            _cameraSetup          = CameraSetup.CreateOrResetCameraSetup(transform);
            _dataHandler          = DataHandler.CreateOrResetDataHandler(transform);
            _previewCameraManager = PreviewCameraManager.CreateOrResetPreviewCameraManager(transform);
#if UNITY_EDITOR
            // Reset parameters to their default values.
            _cameraPrefab     = null;
            _cameraCount      = new Vector2Int(4, 4);
            _acquireDepthData = false;
            _copyGlobalMesh   = false;
            _setupType        = SetupType.Grid;
            _setupDirection   = SetupDirection.Outwards;
            _lockSetup        = false;
            // Update the acquisition camera poses to reflect the updated setup.
            ComputeAcquisitionCameraPoses();
            // Create a preview camera from the prefab.
            CreatePreviewCameraFromPrefab();
#endif //UNITY_EDITOR
        }
        /// <summary>
        /// Provides means to registry different service implementations
        /// based on the setup type
        /// </summary>
        public static void Bootstrap(SetupType setupType = SetupType.Debug)
        {
            var container = new UnityContainer();

            switch (setupType)
            {
            case SetupType.Release:
                container.RegisterType <ISettings, Settings>();

                break;

            case SetupType.Debug:
                container.RegisterType <ISettings, SettingsDev>();

                break;

            case SetupType.Test:
                container.RegisterType <ISettings, SettingsTest>();

                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(setupType), setupType, null);
            }

            container.RegisterType <IApiClient, ApiClient>();
            container.RegisterType <ILogger, ApplicationInsightsLogger>();

            container.RegisterType <ICatRepository, CatRepository>();
            container.RegisterType <IMessageBroker <Cat>, AzureMessageBroker <Cat> >();
            container.RegisterType <IMessageBrokerConsumer, MessageBrokerConsumer>();
            container.RegisterType <ICatService, CatService>();
            container.RegisterType <IMainViewModel, MainViewModel>();

            IocWrapper.Instance = new IocWrapper(container);
        }
        /// <summary>
        /// Registers services with the DI container,
        /// based on the setup type
        /// </summary>
        public static void Bootstrap(IServiceCollection services, SetupType setupType = SetupType.Debug)
        {
            BootstrapConfig(services, setupType);

            RegisterServices(services);
        }
 private static Grid GenerateInitialGrid(SetupType setupType)
 {
     return(_setupDict[setupType].CreateInitialGrid());
 }
Exemple #12
0
        private bool RunSetup(SetupType type, bool closeOnSuccess)
        {
            this.WindowState = FormWindowState.Minimized;

            // Install or uninstall openPDC
            Process openPDCInstall = new Process();

            openPDCInstall.StartInfo.FileName = "msiexec.exe";

            if (type == SetupType.Uninstall)
            {
                // Attempt to shutdown processes before uninstall
                AttemptToStopKeyProcesses();

                // Uninstall any version of the openPDC
                openPDCInstall.StartInfo.Arguments = "/x " + ProductCode + " /qr";
            }
            else
            {
                // Install current version of the openPDC
                openPDCInstall.StartInfo.Arguments = "/i Installers\\openPDCSetup.msi";
            }

            openPDCInstall.StartInfo.UseShellExecute = false;
            openPDCInstall.StartInfo.CreateNoWindow  = true;
            openPDCInstall.Start();
            openPDCInstall.WaitForExit();

            if (openPDCInstall.ExitCode == 0)
            {
                // Run configuration setup utility post installation of openPDC, but not for uninstalls
                if (type == SetupType.Install)
                {
                    // Read registry installation parameters
                    string installPath, targetBitSize, configurationSetupUtility;

                    // Read values from primary registry location
                    installPath               = AddPathSuffix(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "InstallPath", "").ToString().Trim());
                    targetBitSize             = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "TargetBitSize", "64bit").ToString().Trim();
                    configurationSetupUtility = installPath + "ConfigurationSetupUtility.exe";

                    // Note that if user only installs tools, i.e., skips openPDC and Manager, the CSU will not be installed
                    if (File.Exists(configurationSetupUtility))
                    {
                        try
                        {
                            // Run configuration setup utility
                            Process configSetupUtility = new Process();

                            configSetupUtility.StartInfo.FileName        = configurationSetupUtility;
                            configSetupUtility.StartInfo.Arguments       = "-install -" + targetBitSize;
                            configSetupUtility.StartInfo.UseShellExecute = false;
                            configSetupUtility.Start();
                            configSetupUtility.WaitForExit();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Setup program was not able to launch the openPDC Configuration Setup Utility due to an exception. You will need to run this program manually before starting the openPDC.\r\n\r\nError: " + ex.Message, "Configuration Setup Utility Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }

                // Install or uninstall PMU Connection Tester
                if (checkBoxConnectionTester.Checked)
                {
                    Process connectionTesterInstall = new Process();

                    connectionTesterInstall.StartInfo.FileName = "msiexec.exe";

                    if (type == SetupType.Uninstall)
                    {
                        // Uninstall any version of the PMU Connection Tester
                        connectionTesterInstall.StartInfo.Arguments = "/x Installers\\PMUConnectionTesterSetup64.msi /passive";
                    }
                    else
                    {
                        // Install current version of the PMU Connection Tester
                        connectionTesterInstall.StartInfo.Arguments = "/i Installers\\PMUConnectionTesterSetup64.msi";
                    }

                    connectionTesterInstall.StartInfo.UseShellExecute = false;
                    connectionTesterInstall.StartInfo.CreateNoWindow  = true;
                    connectionTesterInstall.Start();
                    connectionTesterInstall.WaitForExit();

                    if (closeOnSuccess)
                    {
                        this.Close();
                    }
                    else
                    {
                        this.WindowState = FormWindowState.Normal;
                    }

                    return(true);
                }

                if (closeOnSuccess)
                {
                    this.Close();
                }
                else
                {
                    this.WindowState = FormWindowState.Normal;
                }

                return(true);
            }

            this.WindowState = FormWindowState.Normal;
            return(false);
        }
Exemple #13
0
        public void OnGUI()
        {
            if (logoImage == null)
            {
                logoImage = Resources.Load <Texture2D>("Easy performant outline/EP Outline logo");
            }

            var height = 180;

            GUILayout.Space(height);

            var imagePosition = new Rect(Vector2.zero, new Vector2(position.width, height));

            GUI.DrawTexture(imagePosition, logoImage, ScaleMode.ScaleAndCrop, true);

            GUILayout.Space(10);

            scroll = GUILayout.BeginScrollView(scroll);

            if (EditorApplication.isPlaying)
            {
                EditorGUILayout.HelpBox("Please stop running the app to start setup process", MessageType.Info);

                if (GUILayout.Button("Stop"))
                {
                    EditorApplication.isPlaying = false;
                }

                GUILayout.EndScrollView();
                return;
            }

            if (EditorApplication.isCompiling)
            {
                EditorGUILayout.HelpBox(new GUIContent("Compiling... please wait."));
                return;
            }

            EditorGUILayout.HelpBox("Warning!\n Don't add integrations that is not available in your project. This will lead to compilation errors", MessageType.Warning);

            EditorGUILayout.LabelField("Integrations");

            EditorGUI.indentLevel = 1;

            var shouldAddDotween = EditorGUILayout.Toggle(new GUIContent("DOTween support"), CheckHasEPODotween());

            if (shouldAddDotween)
            {
                AddDOTweenDefinition();
            }
            else
            {
                RemoveDOTweenDefinition();
            }

            EditorGUILayout.Space();

            EditorGUI.indentLevel = 0;

            setupType = (SetupType)EditorGUILayout.EnumPopup("Setup type", setupType);

            switch (setupType)
            {
            case SetupType.BuiltIn:
                DrawBuiltInSetup();
                break;

            case SetupType.URP:
                DrawURPSetup();
                break;

            case SetupType.HDRP:
                DrawHDRPSetup();
                break;
            }

            GUILayout.EndScrollView();
        }
        /// <summary>
        /// Enables the user to define the acquisition setup.
        /// </summary>
        private void SectionSetup()
        {
            string label   = "Lock: ";
            string tooltip = "You should lock the setup once you have finished setting the overall parameters.";

            tooltip += " This will enable modifying individual cameras, e.g. to move them to specific positions.";
            tooltip += " Unlocking will reset all cameras in the setup with the values displayed below.";
            _propertyLockSetup.boolValue = EditorGUILayout.Toggle(new GUIContent(label, tooltip), _propertyLockSetup.boolValue);
            bool isGUIEnabled = GUI.enabled;

            GUI.enabled = isGUIEnabled && !_propertyLockSetup.boolValue;
            Vector2Int oldCameraCount           = _propertyCameraCount.vector2IntValue;
            int        newHorizontalCameraCount = oldCameraCount.x;
            int        newVerticalCameraCount   = oldCameraCount.y;

            label   = "Type: ";
            tooltip = "Shape of the acquisition setup.";
            EditorGUILayout.PropertyField(_propertySetupType, new GUIContent(label, tooltip));
            int       maxHorizontalCount = 64;
            int       maxVerticalCount   = 64;
            SetupType setupType          = (SetupType)_propertySetupType.intValue;

            if (setupType == SetupType.Sphere || setupType == SetupType.Cylinder)
            {
                label   = "Direction: ";
                tooltip = "Whether the cameras face inward or outward.";
                EditorGUILayout.PropertyField(_propertySetupDirection, new GUIContent(label, tooltip));
            }
            if (setupType == SetupType.Grid)
            {
                label   = "Per row: ";
                tooltip = "Number of cameras per row.";
            }
            else if (setupType == SetupType.Sphere)
            {
                label              = "Per H arc: ";
                tooltip            = "Number of cameras per horizontal arc.";
                maxHorizontalCount = 128;
            }
            else if (setupType == SetupType.Cylinder)
            {
                label   = "Per circle section: ";
                tooltip = "Number of cameras per circular section.";
            }
            newHorizontalCameraCount = EditorGUILayout.IntSlider(new GUIContent(label, tooltip), oldCameraCount.x, 1, maxHorizontalCount);
            if (setupType == SetupType.Grid)
            {
                label   = "Per column: ";
                tooltip = "Number of cameras per column.";
            }
            else if (setupType == SetupType.Sphere)
            {
                label   = "Per V arc: ";
                tooltip = "Number of cameras per vertical arc.";
            }
            else if (setupType == SetupType.Cylinder)
            {
                label   = "Along the height: ";
                tooltip = "Number of cameras along a vertical side.";
            }
            newVerticalCameraCount = EditorGUILayout.IntSlider(new GUIContent(label, tooltip), oldCameraCount.y, 1, maxVerticalCount);
            _propertyCameraCount.vector2IntValue = new Vector2Int(newHorizontalCameraCount, newVerticalCameraCount);
            GUI.enabled = isGUIEnabled;
        }
 public bool CheckType(SetupType type)
 {
     return(setupType == type);
 }
Exemple #16
0
        private bool RunSetup(SetupType type, bool closeOnSuccess)
        {
            this.WindowState = FormWindowState.Minimized;

            // Install or uninstall openPDC
            Process openPDCInstall = new Process();

            openPDCInstall.StartInfo.FileName = "msiexec.exe";

            if (type == SetupType.Uninstall)
            {
                // Attempt to shutdown processes before uninstall
                AttemptToStopKeyProcesses();

                // Uninstall any version of the openPDC
                openPDCInstall.StartInfo.Arguments = "/x " + ProductCode + " /qr";
            }
            else
            {
                // Install current version of the openPDC
                openPDCInstall.StartInfo.Arguments = "/i Installers\\openPDCSetup.msi";
            }

            openPDCInstall.StartInfo.UseShellExecute = false;
            openPDCInstall.StartInfo.CreateNoWindow = true;
            openPDCInstall.Start();
            openPDCInstall.WaitForExit();

            if (openPDCInstall.ExitCode == 0)
            {
                // Run configuration setup utility post installation of openPDC, but not for uninstalls
                if (type == SetupType.Install)
                {
                    // Read registry installation parameters
                    string installPath, targetBitSize, configurationSetupUtility;

                    // Read values from primary registry location
                    installPath = AddPathSuffix(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "InstallPath", "").ToString().Trim());
                    targetBitSize = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "TargetBitSize", "64bit").ToString().Trim();
                    configurationSetupUtility = installPath + "ConfigurationSetupUtility.exe";

                    // Note that if user only installs tools, i.e., skips openPDC and Manager, the CSU will not be installed
                    if (File.Exists(configurationSetupUtility))
                    {
                        try
                        {
                            // Run configuration setup utility
                            Process configSetupUtility = new Process();

                            configSetupUtility.StartInfo.FileName = configurationSetupUtility;
                            configSetupUtility.StartInfo.Arguments = "-install -" + targetBitSize;
                            configSetupUtility.StartInfo.UseShellExecute = false;
                            configSetupUtility.Start();
                            configSetupUtility.WaitForExit();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Setup program was not able to launch the openPDC Configuration Setup Utility due to an exception. You will need to run this program manually before starting the openPDC.\r\n\r\nError: " + ex.Message, "Configuration Setup Utility Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }

                // Install or uninstall PMU Connection Tester
                if (checkBoxConnectionTester.Checked)
                {
                    Process connectionTesterInstall = new Process();

                    connectionTesterInstall.StartInfo.FileName = "msiexec.exe";

                    if (type == SetupType.Uninstall)
                    {
                        // Uninstall any version of the PMU Connection Tester
                        connectionTesterInstall.StartInfo.Arguments = "/x Installers\\PMUConnectionTesterSetup64.msi /passive";
                    }
                    else
                    {
                        // Install current version of the PMU Connection Tester
                        connectionTesterInstall.StartInfo.Arguments = "/i Installers\\PMUConnectionTesterSetup64.msi";
                    }

                    connectionTesterInstall.StartInfo.UseShellExecute = false;
                    connectionTesterInstall.StartInfo.CreateNoWindow = true;
                    connectionTesterInstall.Start();
                    connectionTesterInstall.WaitForExit();

                    if (closeOnSuccess)
                        this.Close();
                    else
                        this.WindowState = FormWindowState.Normal;

                    return true;
                }

                if (closeOnSuccess)
                    this.Close();
                else
                    this.WindowState = FormWindowState.Normal;

                return true;
            }

            this.WindowState = FormWindowState.Normal;
            return false;
        }
 public static Grid CreateGridFromArray(SetupType setupType, string[,] initArray)
 {
     _setupDict[SetupType.StringInput] = new StringArrayGameSetupHandler(initArray);
     return(GenerateInitialGrid(setupType));
 }
        internal static void SetupModules(SetupType setupType)
        {
            if (!Directory.Exists(BaseDirectory))
            {
                return;
            }

            LemonEnumerator <ModuleListing> enumerator = new LemonEnumerator <ModuleListing>(Modules);

            while (enumerator.MoveNext())
            {
                string ModulePath = Path.Combine(BaseDirectory, enumerator.Current.FileName);
                if (!File.Exists(ModulePath))
                {
                    continue;
                }

                try
                {
                    if (enumerator.Current.LoadSpecifier != null)
                    {
                        ModuleListing.LoadSpecifierArgs args = new ModuleListing.LoadSpecifierArgs();
                        args.SetupType = setupType;
                        enumerator.Current.LoadSpecifier(args);

                        if (!args.ShouldLoad)
                        {
                            continue;
                        }

                        if (args.ShouldDelete)
                        {
                            File.Delete(ModulePath);
                            continue;
                        }
                    }

                    Assembly assembly = Assembly.LoadFrom(ModulePath);
                    if (assembly == null)
                    {
                        continue;
                    }
                    Type[] ModuleTypes = assembly.GetValidTypes(x => x.IsSubclassOf(typeof(Module))).ToArray();
                    if ((ModuleTypes.Length <= 0) || (ModuleTypes[0] == null))
                    {
                        continue;
                    }

                    Module moduleInstance = Activator.CreateInstance(ModuleTypes[0], BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, null, null) as Module;
                    if (moduleInstance == null)
                    {
                        continue;
                    }

                    moduleInstance.Setup();
                    enumerator.Current.Interface = moduleInstance;
                    MelonDebug.Msg($"Loaded Compatibility Layer: {enumerator.Current.FileName}");
                }
                catch (Exception ex) { MelonDebug.Error($"Compatibility Layer [{enumerator.Current.FileName}] threw an Exception: {ex}"); continue; }
            }
        }
 /// <summary>
 /// Registers the services with the DI container,
 /// by using a new service collection
 /// </summary>
 /// <param name="setupType"></param>
 public static void Bootstrap(SetupType setupType = SetupType.Debug)
 {
     Bootstrap(new ServiceCollection(), setupType);
 }
Exemple #20
0
 public InitForm(SetupType setupType)
 {
     this.setupType = setupType;
     InitializeComponent();
 }
 public static Grid CreateGrid(SetupType setupType)
 {
     return(GenerateInitialGrid(setupType));
 }