コード例 #1
0
    private void Awake()
    {
        GameObject[] managers = GameObject.FindGameObjectsWithTag("Manager");
        if (managers.Length > 1)
        {
            Destroy(gameObject);
            Destroy(this);
            return;
        }

        DontDestroyOnLoad(this.gameObject);

        if (instance == null)
        {
            instance = this;
        }

        GlobalSettingsModel = new GlobalSettingsModel();

        SceneManager.sceneLoaded += InitViews;

        ImportModels();
        ImportTextures();
        ImportRegions();
        ImportLightning();
        ImportCamera();

        //<TO EXPAND> Add new Import/Load Method
    }
コード例 #2
0
ファイル: GlobalSettingsHelper.cs プロジェクト: SwatInc/CD4
        private async void GlobalSettingsHelper_OnInitializeGlobalSettings(object sender, EventArgs e)
        {
            try
            {
                var settings = await _globalSettingsDataAccess.ReadAllGlobalSettingsAsync();

                Settings = new GlobalSettingsModel()
                {
                    VerifyNidPpOnOrder = settings.VerifyNidPpOnOrder,
                    IsAnalysisRequestBarcodeRequired = settings.IsAnalysisRequestBarcodeRequired,
                    ReportExportBasePath             = settings.ReportExportBasePath,
                    IsFullnameAbbreviated            = settings.IsFullnameAbbreviated,
                    HmsLinkQuery      = settings.HmsLinkQuery,
                    IsReportByEpisode = settings.IsReportByEpisode
                };
            }
            catch (Exception ex)
            {
                MessageBox.Show($"{ex.Message}\n{ex}");

                //handle any inner exceptions
                var inner        = ex.InnerException;
                var errorMessage = "Inner Stack Trace\n-------------------------\n";

                while (inner != null)
                {
                    errorMessage = $"{errorMessage}\n{inner.Message}\n{inner.StackTrace}";
                    //get the next inner exception for next iteration
                    inner = inner.InnerException;
                }

                MessageBox.Show(errorMessage);
            }
        }
コード例 #3
0
        public void CreateNeuralNetwork(GlobalSettingsModel settingsModel)
        {
            if (settingsModel.TrainingSet == null)
            {
                throw new Exception("Unable to Create Neural Network As There is No Data to Train..");
            }
            model.NetworkInput = settingsModel.AverageImageHeight * settingsModel.AverageImageWidth;
            int secondLayerNeurons = (int)((double)(model.NetworkInput + settingsModel.NumberOfPatterns) * .33);

            switch (settingsModel.NumberOfLayers)
            {
            case 0:
                NeuralNetwork = new NeuralNetwork
                                    (new SingleLayer(model.NetworkInput, settingsModel.NumberOfPatterns), settingsModel);
                break;

            case 1:
                NeuralNetwork = new NeuralNetwork
                                    (new DoubleLayer(model.NetworkInput, secondLayerNeurons, settingsModel.NumberOfPatterns), settingsModel);
                break;

            case 2:
                int hiddenLayerNeurons = (int)((double)(model.NetworkInput + settingsModel.NumberOfPatterns) * .11);
                NeuralNetwork = new NeuralNetwork
                                    (new TripleLayer(model.NetworkInput, secondLayerNeurons, hiddenLayerNeurons, settingsModel.NumberOfPatterns), settingsModel);
                break;
            }
        }
コード例 #4
0
        public ActionResult Index(GlobalSettingsModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (Directory.Exists(model.RepositoryPath))
                    {
                        UserConfiguration.Current.AllowAnonymousPush          = model.AllowAnonymousPush;
                        UserConfiguration.Current.Repositories                = model.RepositoryPath;
                        UserConfiguration.Current.AllowAnonymousRegistration  = model.AllowAnonymousRegistration;
                        UserConfiguration.Current.AllowUserRepositoryCreation = model.AllowUserRepositoryCreation;
                        UserConfiguration.Current.DefaultLanguage             = model.DefaultLanguage;
                        UserConfiguration.Current.Save();

                        this.Session["Culture"] = new CultureInfo(model.DefaultLanguage);

                        ViewBag.UpdateSuccess = true;
                    }
                    else
                    {
                        ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathNotExists);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathUnauthorized);
                }
            }

            return(View(model));
        }
コード例 #5
0
        public ActionResult Index(GlobalSettingsModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (Directory.Exists(model.RepositoryPath))
                    {
                        System.Security.AccessControl.DirectorySecurity ds = Directory.GetAccessControl(model.RepositoryPath);

                        UserConfiguration.Current.AllowAnonymousPush          = model.AllowAnonymousPush;
                        UserConfiguration.Current.Repositories                = model.RepositoryPath;
                        UserConfiguration.Current.AllowAnonymousRegistration  = model.AllowAnonymousRegistration;
                        UserConfiguration.Current.AllowUserRepositoryCreation = model.AllowUserRepositoryCreation;
                        UserConfiguration.Current.GitExePath = model.GitExePath;
                        UserConfiguration.Current.Save();

                        ViewBag.UpdateSuccess = true;
                    }
                    else
                    {
                        ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathNotExists);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathNotExists);
                }
            }

            return(View(model));
        }
コード例 #6
0
 public NeuralNetwork(IBackPropagation IBackPro, GlobalSettingsModel settingsModel)
 {
     _neuralNet              = IBackPro;
     _trainingSet            = settingsModel.TrainingSet;
     _distractionTrainingSet = settingsModel.DistractionTrainingSet;
     _neuralNet.InitializeNetwork(_trainingSet);
     _settingsModel = settingsModel;
 }
コード例 #7
0
ファイル: GlobalSettingsHelper.cs プロジェクト: SwatInc/CD4
        public GlobalSettingsHelper(IGlobalSettingsDataAccess globalSettingsDataAccess)
        {
            Settings = new GlobalSettingsModel();
            _globalSettingsDataAccess = globalSettingsDataAccess;
            InitializeGlobalSettings += GlobalSettingsHelper_OnInitializeGlobalSettings;

            InitializeGlobalSettings?.Invoke(this, EventArgs.Empty);
        }
コード例 #8
0
        public GlobalSettings(MainViewModel viewModel)
        {
            _viewModel    = viewModel;
            SettingsModel = new GlobalSettingsModel(_viewModel);
            NameValueCollection appSettings = ConfigurationManager.AppSettings;

            SettingsModel.PatternPath             = System.IO.Path.GetFullPath(appSettings["PatternsDirectory"]);
            SettingsModel.DistractionsPatternPath = System.IO.Path.GetFullPath(appSettings["DistractionsPatternsDirectory"]);
            SettingsModel.TestSamplesPath         = System.IO.Path.GetFullPath(appSettings["TestSamplesPatternsDirectory"]);
        }
コード例 #9
0
        public async Task <ActionResult> UpdateAdvancedSettings(GlobalSettingsModel model)
        {
            var instanceSettings = await _cloudOdsSettingsService.GetSettings(_appSettings.DefaultOdsInstance);

            instanceSettings.BearerTokenTimeoutInMinutes = model.AdvancedSettingsModel.BearerTokenTimeoutInMinutes;

            await _cloudOdsSettingsService.UpdateSettings(_appSettings.DefaultOdsInstance, instanceSettings);

            return(RedirectToActionJson <GlobalSettingsController>(
                       x => x.AdvancedSettings(), "Settings updated successfully"));
        }
コード例 #10
0
ファイル: GlobalSettings.cs プロジェクト: marquisdan/PestoBot
        /// <summary>
        /// Update global settings with any non default values
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static async Task SetGlobalSettings(GlobalSettingsModel model)
        {
            var updateModel = GetGlobalSettings();

            updateModel.Modified = DateTime.Now;
            updateModel.DebugRemindersEnabled = model.DebugRemindersEnabled;
            updateModel.DebugReminderHour     =
                model.DebugReminderHour != 0 ? model.DebugReminderHour : updateModel.DebugReminderHour;
            updateModel.DebugReminderMinutes =
                model.DebugReminderMinutes != 0 ? model.DebugReminderMinutes : updateModel.DebugReminderMinutes;
            await Repo.UpdateAsync(updateModel);
        }
コード例 #11
0
        public async Task <ActionResult> UpdateAdvancedSettings(GlobalSettingsModel model)
        {
            var instanceSettings = await _cloudOdsSettingsService.GetSettings(
                CloudOdsAdminAppSettings.Instance.OdsInstanceName, CloudOdsEnvironment.Production);

            instanceSettings.BearerTokenTimeoutInMinutes = model.AdvancedSettingsModel.BearerTokenTimeoutInMinutes;

            await _cloudOdsSettingsService.UpdateSettings(
                CloudOdsAdminAppSettings.Instance.OdsInstanceName, CloudOdsEnvironment.Production, instanceSettings);

            return(RedirectToActionJson <GlobalSettingsController>(
                       x => x.AdvancedSettings(), "Settings updated successfully"));
        }
コード例 #12
0
        public async Task <IActionResult> GetGlobalSettings()
        {
            try
            {
                GlobalSettingsModel settings = await _globalSettingsService.GetGlobalSettings();

                return(Ok(settings));
            }

            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
コード例 #13
0
        public async Task <IActionResult> SetGlobalSettings([FromBody] GlobalSettingsModel settings)
        {
            try
            {
                await _globalSettingsService.SetGlobalSettings(settings);

                return(Ok());
            }

            catch (Exception ex)
            {
                return(BadRequest(ex));
            }
        }
コード例 #14
0
        public ActionResult Index(GlobalSettingsModel model)
        {
            if (AuthenticationSettings.DemoModeActive)
            {
                return(RedirectToAction("Unauthorized", "Home"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (Directory.Exists(Path.IsPathRooted(model.RepositoryPath)
                                         ? model.RepositoryPath
                                         : HttpContext.Server.MapPath(model.RepositoryPath)))
                    {
                        UserConfiguration.Current.AllowAnonymousPush          = model.AllowAnonymousPush;
                        UserConfiguration.Current.RepositoryPath              = model.RepositoryPath;
                        UserConfiguration.Current.AllowAnonymousRegistration  = model.AllowAnonymousRegistration;
                        UserConfiguration.Current.AllowUserRepositoryCreation = model.AllowUserRepositoryCreation;
                        UserConfiguration.Current.AllowPushToCreate           = model.AllowPushToCreate;
                        UserConfiguration.Current.DefaultLanguage             = model.DefaultLanguage;
                        UserConfiguration.Current.SiteTitle                   = model.SiteTitle;
                        UserConfiguration.Current.SiteLogoUrl                 = model.SiteLogoUrl;
                        UserConfiguration.Current.SiteFooterMessage           = model.SiteFooterMessage;
                        UserConfiguration.Current.SiteCssUrl                  = model.SiteCssUrl;
                        UserConfiguration.Current.IsCommitAuthorAvatarVisible = model.IsCommitAuthorAvatarVisible;
                        UserConfiguration.Current.LinksRegex                  = model.LinksRegex;
                        UserConfiguration.Current.LinksUrl = model.LinksUrl;
                        UserConfiguration.Current.Save();

                        this.Session["Culture"] = new CultureInfo(model.DefaultLanguage);

                        TempData["UpdateSuccess"] = true;
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        Log.Error($"Is Path Rooted: {Path.IsPathRooted(model.RepositoryPath)} Path: {model.RepositoryPath}");
                        ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathNotExists);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathUnauthorized);
                }
            }

            return(View(model));
        }
コード例 #15
0
        public async Task <GlobalSettingsModel> GetGlobalSettings()
        {
            GlobalSettingsModel settings = await _context.GlobalSettings.FirstOrDefaultAsync(x => x.Id == 1);

            if (settings != null)
            {
                return(settings);
            }
            else
            {
                NullReferenceException ex = new NullReferenceException();
                ex.Data.Add("message", "NO_GLOBAL_SETTINGS");
                throw ex;
            }
        }
コード例 #16
0
        public ActionResult ClaimSets()
        {
            var model = new GlobalSettingsModel
            {
                ClaimSetEditorModel = new ClaimSetEditorModel
                {
                    ClaimSets = _getClaimSetsByApplicationNameQuery.Execute(CloudOdsAdminApp.SecurityContextApplicationName)
                },
                GlobalSettingsTabEnumerations =
                    _tabDisplayService.GetGlobalSettingsTabDisplay(
                        GlobalSettingsTabEnumeration.ClaimSets)
            };

            return(View(model));
        }
コード例 #17
0
        public ActionResult Users()
        {
            var users = _getAdminAppUsersQuery.Execute();

            var model = new GlobalSettingsModel
            {
                UserIndexModel = new UserIndexModel
                {
                    Users = _mapper.Map <List <UserModel> >(users)
                },
                GlobalSettingsTabEnumerations =
                    _tabDisplayService.GetGlobalSettingsTabDisplay(
                        GlobalSettingsTabEnumeration.Users)
            };

            return(View(model));
        }
コード例 #18
0
        public async Task <ActionResult> AdvancedSettings()
        {
            var currentSettings = await _cloudOdsSettingsService.GetSettings(_appSettings.DefaultOdsInstance);

            var model = new GlobalSettingsModel
            {
                AdvancedSettingsModel = new AdvancedSettingsModel
                {
                    BearerTokenTimeoutInMinutes = currentSettings.BearerTokenTimeoutInMinutes
                },
                GlobalSettingsTabEnumerations =
                    _tabDisplayService.GetGlobalSettingsTabDisplay(
                        GlobalSettingsTabEnumeration.AdvancedSettings)
            };

            return(View(model));
        }
コード例 #19
0
        public async Task SetDebugReminders(string enabled = "")
        {
            if (new List <string> {
                "true", "1", "on", "false", "0", "off"
            }.Contains(enabled.ToLower()))
            {
                bool enabledSetting = enabled.ToLower() == "true" || enabled == "1" || enabled.ToLower() == "on";
                var  model          = new GlobalSettingsModel {
                    DebugRemindersEnabled = enabledSetting
                };
                await GlobalSettings.SetGlobalSettings(model);
                await ReplyAsync(TextUtils.GetInfoText($"Setting Debug reminders to {enabledSetting}"));
            }

            var currentVal = GlobalSettings.AreDebugRemindersEnabled().ToString();

            await ReplyAsync(TextUtils.GetInfoText($"Debug reminder value is: {currentVal}"));
        }
コード例 #20
0
        public async Task <ActionResult> AdvancedSettings()
        {
            var currentSettings = await _cloudOdsSettingsService.GetSettings(
                CloudOdsAdminAppSettings.Instance.OdsInstanceName, CloudOdsEnvironment.Production);

            var model = new GlobalSettingsModel
            {
                AdvancedSettingsModel = new AdvancedSettingsModel
                {
                    BearerTokenTimeoutInMinutes = currentSettings.BearerTokenTimeoutInMinutes
                },
                GlobalSettingsTabEnumerations =
                    _tabDisplayService.GetGlobalSettingsTabDisplay(
                        GlobalSettingsTabEnumeration.AdvancedSettings)
            };

            return(View(model));
        }
コード例 #21
0
        public async Task UpdateGlobalSetting(GlobalSettingsModel globalSettings)
        {
            if (globalSettings is null)
            {
                throw new Exception("Global settings cannot be null");
            }
            try
            {
                var storedProcedure = "[dbo].[usp_UpdateGlobalSettings]";
                var parameter       = new { JsonSettings = JsonConvert.SerializeObject(globalSettings) };

                _ = await LoadDataAsync <dynamic>(storedProcedure);
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #22
0
        public ActionResult Vendors()
        {
            var vendors = _getVendorsQuery
                          .Execute();

            var model = new GlobalSettingsModel
            {
                VendorListModel = new VendorsListModel
                {
                    Vendors = _mapper.Map <List <VendorOverviewModel> >(vendors)
                },
                GlobalSettingsTabEnumerations =
                    _tabDisplayService.GetGlobalSettingsTabDisplay(
                        GlobalSettingsTabEnumeration.Vendors)
            };

            return(View(model));
        }
コード例 #23
0
        public ActionResult Index(GlobalSettingsModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (Directory.Exists(model.RepositoryPath))
                    {
                        UserConfiguration.Current.AllowAnonymousPush          = model.AllowAnonymousPush;
                        UserConfiguration.Current.Repositories                = model.RepositoryPath;
                        UserConfiguration.Current.AllowAnonymousRegistration  = model.AllowAnonymousRegistration;
                        UserConfiguration.Current.AllowUserRepositoryCreation = model.AllowUserRepositoryCreation;
                        UserConfiguration.Current.DefaultLanguage             = model.DefaultLanguage;
                        UserConfiguration.Current.SiteTitle                   = model.SiteTitle;
                        UserConfiguration.Current.SiteLogoUrl                 = model.SiteLogoUrl;
                        UserConfiguration.Current.SiteFooterMessage           = model.SiteFooterMessage;
                        UserConfiguration.Current.IsCommitAuthorAvatarVisible = model.IsCommitAuthorAvatarVisible;
                        UserConfiguration.Current.Save();

                        this.Session["Culture"] = new CultureInfo(model.DefaultLanguage);

                        TempData["UpdateSuccess"] = true;
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathNotExists);
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    ModelState.AddModelError("RepositoryPath", Resources.Settings_RepositoryPathUnauthorized);
                }
            }

            return(View(model));
        }
コード例 #24
0
 public async Task SetGlobalSettings(GlobalSettingsModel settings)
 {
     _context.GlobalSettings.Update(settings);
     await _context.SaveChangesAsync();
 }
コード例 #25
0
 public InitializeNeutralNetwork(GlobalSettingsModel settingsModel, MainViewModel mainViewModel)
 {
     model = mainViewModel;
     CreateNeuralNetwork(settingsModel);
 }