Esempio n. 1
0
        private CacheWorkerInitializer <TMap, TKey, TValue> CacheWorkerInitializer(InitInput config)
        {
            Expression <Func <TKey, string> > expr = key => CacheQueryForMissingKey(key);

            return(new CacheWorkerInitializer <TMap, TKey, TValue>(config, CacheQuery, expr.Compile(),
                                                                   () => AdditionalDataQuery, _name, _cancelToken));
        }
 public WaterQualityDistributionForm()
 {
     InitializeComponent();
     //初始化地图加载
     InitMapCtr();
     //初始化属性选择列表
     InitInput.InitQualityComboBox(this.cmb_FieldList);
     InitInput.InitWaterDataComboBox(this.cmb_dataList);
 }
 public void BeforeEach()
 {
     fs.DeleteDirectory(thePath);
     theInput = new InitInput
                {
                    Name = pakName,
                    Path = thePath
                };
 }
 public void BeforeEach()
 {
     fs.DeleteDirectory(thePath);
     theInput = new InitInput
     {
         Name = pakName,
         Path = thePath
     };
 }
Esempio n. 5
0
 public RegressionForm()
 {
     InitializeComponent();
     InitInput.InitWaterDataComboBox(this.cmb_QualityList);
     this._waterFieldsDictionary = new Dictionary <string, string>();
     _waterFieldsDictionary.Add("总磷", "TP");
     _waterFieldsDictionary.Add("总氮", "TN");
     _waterFieldsDictionary.Add("氨氮", "NH4_N");
     _waterFieldsDictionary.Add("化学需氧量", "CODmn");
 }
Esempio n. 6
0
        async Task IAsyncCache.InitAsync(InitInput input)
        {
            var entered = false;

            try
            {
                entered = _syncRoot.WaitOne(Timeout.Infinite);
                if (entered)
                {
                    input.Validate();
                    _logger      = input.Logger;
                    _combinedCts = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token, input.Token);
                    _cancelToken = _combinedCts.Token;

                    _gotoDbForMissingKey = input.CacheConfig.GoToDbForMissingKey;
                    ((IReloadable)this).ReloadOnceImmediate = input.CacheConfig.ReloadFromFileFirst;

                    _cacheData = CreateCacheDataInstance(input.CacheConfig,
                                                         CreateCacheSerializer(input.TopLevelLocalDirectory, false));
                    _additionalData = CreateAdditionalCacheDataInstance(input.CacheConfig,
                                                                        CreateCacheSerializer(input.TopLevelLocalDirectory.CreateSubdirectory(AdSubFolder), true));

                    var cacheWorkerInitializer = CacheWorkerInitializer(input);
                    var instances = await cacheWorkerInitializer.InitInstances().ConfigureAwait(false);

                    //item 1 is actual cache worker
                    _cacheWorker = instances.Item1;
                    //item 2 is additional data worker.
                    _additionalDataWorker = instances.Item2;

                    await InternalReload(_cancelToken).ConfigureAwait(false);

                    //Thread.MemoryBarrier();

                    //Post init actions.
                    instances = cacheWorkerInitializer.PostInitInstances();
                    //item 1 is actual cache worker
                    _cacheWorker = instances.Item1;
                    //item 2 is additional data worker.
                    _additionalDataWorker = instances.Item2;

                    //Thread.MemoryBarrier();

                    _cacheScheduler     = new CacheScheduler(this, input.ReloadConfig, _cancelToken, _logger, _name);
                    _runningInInitPhase = false;
                }
            }
            finally
            {
                if (entered)
                {
                    _syncRoot.Set();
                }
            }
        }
Esempio n. 7
0
        //保存图片
        private void btn_saveImg_Click(object sender, EventArgs e)
        {
            IMap pMap  = this.axPageLayoutControl1.ActiveView.FocusMap;
            int  count = pMap.LayerCount;

            if (count > 0)
            {
                string savePath = InitInput.InitSaveFile("bmp图像|*.bmp");
                DataShowControl.SaveCurrentToImage(this.axPageLayoutControl1, savePath);
                MessageBox.Show("图像保存成功!");
            }
        }
Esempio n. 8
0
        //保存输出信息窗口信息
        private void btn_saveInfo_Click(object sender, EventArgs e)
        {
            string saveFileName = InitInput.InitSaveFile("文本文件|*.txt");

            if (saveFileName != null)
            {
                string       info = this.richtxb_result.Text.Replace("\n", "\r\n");
                StreamWriter sw   = new StreamWriter(saveFileName);
                sw.Write(info);
                sw.Close();
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 取得全資料(已繳/未繳/逾期)
        /// </summary>
        /// <param name="model">取得會員資訊 Input</param>
        /// <returns>取得會員資訊 Output</returns>
        public async Task <InitOutput> INIT(string id)
        {
            // 透過 Api 把資料送出去
            string apiUrl = "APP_FORM_PAY/INIT";

            InitInput model = new InitInput
            {
                ID = id
            };

            BaseListResult <InitOutput> baseListResult = await ApiService.Instance.ApiINIT(model, apiUrl);

            InitOutput result = new InitOutput();

            if (baseListResult.Result.ReturnCode == 0 && baseListResult.Data != null)
            {
                result = baseListResult.Data.FirstOrDefault();
            }

            return(result);
        }
 //选择中红外影像
 private void btn_pickFile_Click(object sender, EventArgs e)
 {
     this.txb_input.Text = InitInput.IninSelectImg("landsat中红外波段|*.tif|所有文件|*.*");
 }
Esempio n. 11
0
        public ActionResult <InitOutput> Init([FromBody] InitInput input)
        {
            if (string.IsNullOrWhiteSpace(input.SqlType) ||
                string.IsNullOrWhiteSpace(input.ConnectString))
            {
                throw new UserFriendlyException("请选择数据库类型并填写数据库连接字符串");
            }

            // 检查配置文件
            var rootConfiguration = AppConfigurations.Get(_webHostEnvironment.ContentRootPath, _webHostEnvironment.EnvironmentName);

            if (!string.IsNullOrWhiteSpace(rootConfiguration["ConnectionStrings:Default"]))
            {
                throw new UserFriendlyException("站点已初始化,如需重新初始化,请设置 appsettings.json 的 ConnectionStrings:Default 为空");
            }

            // 测试数据库连接
            DbContextOptionsBuilder <IEManageSystemDbContext> dbOptionsBuilder = new DbContextOptionsBuilder <IEManageSystemDbContext>();

            try
            {
                DbContextOptionsConfigurer.Configure(dbOptionsBuilder, input.ConnectString, input.SqlType);
            }
            catch (Exception ex)
            {
                throw new UserFriendlyException(ex.Message);
            }

            var db = new IEManageSystemDbContext(dbOptionsBuilder.Options);

            if (!db.Database.CanConnect())
            {
                throw new UserFriendlyException("数据库连接失败,请检查连接字符串是否正确");
            }

            // 如果数据库有已有数据,则不能运行初始化
            bool isExistData = false;

            try
            {
                if (db.Users.Any())
                {
                    isExistData = true;
                }
            }
            catch (Exception)
            {
            }

            if (isExistData)
            {
                throw new UserFriendlyException("数据库已存在数据,无法初始化");
            }


            // 修改 json 配置
            string appsettingsFilePath = $"{_webHostEnvironment.ContentRootPath}\\appsettings.json";

            if (!System.IO.File.Exists(appsettingsFilePath))
            {
                appsettingsFilePath = $"{_webHostEnvironment.ContentRootPath}\\appsettings.{_webHostEnvironment.EnvironmentName}.json";

                if (!System.IO.File.Exists(appsettingsFilePath))
                {
                    throw new UserFriendlyException("配置文件丢失,无法添加配置");
                }
            }

            string oldJsonStr = System.IO.File.ReadAllText(appsettingsFilePath);

            dynamic oldJson = JsonConvert.DeserializeObject(oldJsonStr);

            oldJson.ConnectionStrings.Default = input.ConnectString;
            oldJson.ConnectionType            = input.SqlType;
            string jsonStr = JsonConvert.SerializeObject(oldJson);

            System.IO.File.WriteAllText(appsettingsFilePath, jsonStr);

            rootConfiguration.Reload();

            // 重新注入数据库选项
            IocManager.Instance.IocContainer.Register(
                Component.For(typeof(DbContextOptions <IEManageSystemDbContext>)).Instance(dbOptionsBuilder.Options).LifestyleSingleton()
                );

            IocManager.Instance.Resolve <IEManageSystemDbContext>().Database.EnsureCreated();

            // 动态添加Api域
            IocManager.Instance.Resolve <ApiScopeProvider>().Register();

            return(new InitOutput());
        }
 public QuickAtmoCorrectionForm(AxMapControl pMapControl)
 {
     InitializeComponent();
     this._axMapControl = pMapControl;
     InitInput.InitRsCombox(this._axMapControl, this.cmb_inputIMG);
 }
Esempio n. 13
0
 //选择影像
 private void btn_selectImg_Click(object sender, EventArgs e)
 {
     this.txb_inputImg.Text = InitInput.IninSelectImg("landsat影像|*.tif|所有文件|*.*");
 }
Esempio n. 14
0
 public CalculateRelativityForm()
 {
     InitializeComponent();
     //初始化水质数据列表
     InitInput.InitWaterDataComboBox(this.cmb_QualityList);
 }
        //初始化输入影像控件

        //选择需要校正的影像
        private void btn_pickFile_Click(object sender, EventArgs e)
        {
            this.cmb_inputIMG.SelectedItem = null;
            this.cmb_inputIMG.Text         = InitInput.IninSelectImg("影像文件|*.tif|所有文件|*.*");
        }
Esempio n. 16
0
 //保存插值结果影像
 private void btn_save_Click(object sender, EventArgs e)
 {
     this.txb_output.Text = InitInput.InitSaveFile("栅格数据集|*.tif");
 }
Esempio n. 17
0
 //选择影像
 private void btn_selectImg_Click(object sender, EventArgs e)
 {
     this.txb_inputImg.Text = InitInput.IninSelectImg("栅格数据集|*.tif");
 }
Esempio n. 18
0
 public void SetUp()
 {
     theInput = new InitInput();
 }