public void LoadORPfromModels() { try { if (Util.curModelDir == null) { return; } string dirPath = Util.pathSource["models"] + Util.curModelDir; List <string> dirs = new List <string>(Directory.EnumerateDirectories(dirPath)); foreach (var dir in dirs) { string model = dir.Substring(dir.LastIndexOf("\\") + 1); string orpMask = Util.pathSource["masks"] + model + ".bmp"; Util.ShowLoading("Načítání a ukládání ORP masek do databáze..."); if (File.Exists(orpMask)) { Util.l("Load mask: " + orpMask); //LoadORP((Bitmap)Image.FromFile(orpMask), model); Thread t = new Thread(() => LoadORP((Bitmap)Image.FromFile(orpMask), model)); t.Start(); } List <string> subdirs = new List <string>(Directory.EnumerateDirectories(dirPath + "\\" + model)); Model.Cloud.MODELSInsertOrUpdate(new CloudModels(model)); foreach (var subdir in subdirs) { string submodel = subdir.Substring(subdir.LastIndexOf("\\") + 1); string options = Model.Cloud.MODELSGetModelOptions(model, submodel); JObject jo = JObject.Parse(options); var p = jo.Property("countMethod"); if (p == null) { FormSetOptions f = new FormSetOptions(model, submodel, options); f.ShowDialog(View.FormMain); options = f.options; Util.l(model + " " + options); } Model.Cloud.MODELSInsertOrUpdate(new CloudModels(submodel, model, options)); } } //View.FormMain.Close(); } catch (Exception e) { Util.l(e); } }
private void labelCountMethod_DoubleClick(object sender, EventArgs e) { string options = Model.Cloud.MODELSGetModelOptions(Util.curModelName, Util.curSubmodelName); if (options == string.Empty) { Util.l($"Neexistující model {Util.curModelName}:{Util.curSubmodelName}|Chyba modelu"); return; } FormSetOptions f = new FormSetOptions(Util.curModelName, Util.curSubmodelName, options); f.ShowDialog(View.FormMain); options = f.options; Model.Cloud.MODELSInsertOrUpdate(new CloudModels(Util.curSubmodelName, Util.curModelName, options)); Thread t = new Thread(() => LoadMap(curImage)); t.Start(); }