private bool ReloadAllUserConfigsAndCheck(bool onlyCheckConfig)
 {
     foreach (var runner in G.Module.Runners)
     {
         if (runner.BaseModule.BaseModuleStateConfig.BaseJson.IsPartOfPipeline)
         {
             //重新加载用户配置
             if (runner.BaseModule.ModuleName != G.Module.PlayerBuilderModule.ModuleName)//PlayerBuilder镶嵌在TotalControl中,可以实时获得最新参数,因此不需要重载用户配置
             {
                 if (!runner.BaseModule.LoadUserConfig())
                 {
                     return(false);
                 }
             }
             //重设CurrentTag
             ResetCurrentTag(runner.BaseModule);
             //检查配置
             try
             {
                 CommonModule.ClearLogFolderPath();
                 runner.Check(onlyCheckConfig);
             }
             catch (EBPCheckFailedException e)
             {
                 runner.BaseModule.DisplayDialog(e.Message);
                 return(false);
             }
         }
     }
     return(true);
 }
Example #2
0
 public void GetFormToRole()
 {
     m_Role.Name        = txtName.Text;
     m_Role.Description = txtMemo.Text;
     m_Role.Modules.Clear();
     m_Role.Modules.AddRange(CommonModule.GetModule(tvModule));
 }
Example #3
0
 public void SetRoleToForm()
 {
     txtID.Text   = m_Role.ID.ToString();
     txtName.Text = m_Role.Name;
     txtMemo.Text = m_Role.Description;
     CommonModule.SetModule(tvModule, m_Role.Modules);
 }
        private void CreateCommonModuleDialog(UiTreeNode node)
        {
            if (node == null || !(node.ContextObject is CommonModule))
            {
                MessageBox.Show("请选择结点");
                return;
            }

            WindowDlg dlg = new WindowDlg();

            dlg.Text = "添加窗口信息";
            foreach (TableInfo table in this.project.Database.Tables)
            {
                dlg.cmbEntity.Items.Add(table);
            }
            foreach (ViewInfo view in this.project.Database.Views)
            {
                dlg.cmbEntity.Items.Add(view);
            }

            dlg.cmbEntity.SelectedIndex = 0;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                CommonModule module = node.ContextObject as CommonModule;
                if (module == null)
                {
                    return;
                }

                GUIDialog window = new GUIDialog(module);
                window.Caption     = dlg.txtCaption.Text.Trim();
                window.Name        = dlg.txtName.Text.Trim();
                window.Description = dlg.txtDescription.Text.Trim();
                module.Dialogs.Add(window);

                EntityInfo entityInfo = null;
                TableInfo  tableInfo  = null;
                ViewInfo   viewInfo   = null;
                tableInfo  = this.project.Database.Tables.Find(e => e.Name == dlg.cmbEntity.SelectedItem.ToString());
                entityInfo = tableInfo;

                if (entityInfo != null)
                {
                    entityInfo = (EntityInfo)((TableInfo)entityInfo).Clone();
                }
                else
                {
                    viewInfo   = this.project.Database.Views.Find(e => e.Name == dlg.cmbEntity.SelectedItem.ToString());
                    entityInfo = viewInfo;
                    entityInfo = (EntityInfo)((ViewInfo)entityInfo).Clone();
                }

                window.Entities.Add(entityInfo);
                window.ResultTableName = entityInfo.Name;

                BuildEntities(entityInfo);
                UiTreeNode windowNode = new UiTreeNode(window);
                node.Nodes.Add(windowNode);
            }
        }
Example #5
0
        private void btnFindItemCode_Click(object sender, EventArgs e)
        {
            try
            {
                string Qry      = "select i.Id, i.Description, i.Type, i.UnitOfMeasuement, i.HSN_SACcode, i.ItemCode, i.TaxRate, i.CessAmount,  i.ItemNotes from Item i";
                string Colwidth = "";
                string test     = "";
                string tblName  = "Item";
                CommonModule.ShowSearchengine(txtCode, Qry, 0, "DisplayName", tblName, Colwidth, test, 0);

                if (CommonModule.mId > 0)
                {
                    itemService = new ItemService();
                    if (CommonModule.mId > 0)
                    {
                        var itemData = itemService.GetItemById(CommonModule.mId);

                        itemId = itemData.Id;
                        txtDescription.Text         = itemData.Description;
                        comboItemType.Text          = itemData.Type;
                        comboUnitOfMeasurement.Text = itemData.UnitOfMeasuement;
                        txtHSNSACcode.Text          = itemData.HSN_SACcode;
                        txtCode.Text   = itemData.ItemCode;
                        ntxtRate.Text  = itemData.TaxRate.ToString();
                        txtAmount.Text = itemData.CessAmount.ToString();
                        txtNotes.Text  = itemData.ItemNotes;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Comman.Product_Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(options =>
            {
                options.AddPolicy("AllowAll",
                                  builder =>
                {
                    builder
                    .AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .AllowCredentials();
                });
            });

            services.AddMvc()
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
            .AddJsonOptions(
                options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore
                );

            services.AddHttpContextAccessor();
            services.AddScoped <ICurrentUserProvider, CurrentUser>();
            services.AddScoped <IChessGame, ChessGame>();
            services.AddFirebaseAuthentication(Configuration.GetValue <string>("Firebase:ProjectId"));
            BuisinessLogicModule.ConfigureServices(services, Configuration);
            DataAccessModule.ConfigureServices(services, Configuration);
            CommonModule.ConfigureServices(services, Configuration);
        }
Example #7
0
            public static ItemModule AddModule(ItemTemplate template, Type type, KeyedByTypeCollection <ItemModule> keyedModules = null)
            {
                if (template == null || type == null)
                {
                    return(null);
                }
                if (keyedModules == null)
                {
                    keyedModules = new KeyedByTypeCollection <ItemModule>(template.modules.Where(x => x is not CommonModule));
                }
                if (!CommonModule.IsCommon(type) && keyedModules.Contains(type))
                {
                    return(null);
                }
                var attr = type.GetCustomAttribute <ItemModule.RequireAttribute>();

                if (attr != null)
                {
                    foreach (var m in attr.modules)
                    {
                        if (m != type)
                        {
                            AddModule(template, m, keyedModules);
                        }
                    }
                }
                ItemModule module = Activator.CreateInstance(type) as ItemModule;

                template.modules.Add(module);
                if (!CommonModule.IsCommon(type))
                {
                    keyedModules.Add(module);
                }
                return(module);
            }
Example #8
0
        public void PluginRun()
        {
            try
            {
                mainForm       = new Main();
                commonModule   = new CommonModule();
                movementModule = new MovementModule();
                questModule    = new QuestModule();
                farmModule     = new FarmModule();
                ClearLogs();
                ResumeMoveTo();
                RegisterModule(commonModule);
                RegisterModule(farmModule);
                RegisterModule(movementModule);
                RegisterModule(questModule);

                formThread = new Thread(RunForm);
                formThread.SetApartmentState(ApartmentState.STA);
                formThread.Start();
                while (true)
                {
                    Thread.Sleep(100);
                }
            }
            catch (Exception error) {
                Log(error.ToString());
            }
        }
Example #9
0
 public void SetEditionToForm()
 {
     txtID.Text   = m_Edition.ID.ToString();
     txtName.Text = m_Edition.Name;
     txtMemo.Text = m_Edition.Description;
     CommonModule.SetModule(tvModule, m_Edition.Modules);
 }
Example #10
0
 public static void LoadModules(IServiceCollection services, IConfiguration configuration)
 {
     ApplicationInsightsModule.Load(services, configuration);
     FactoriesModule.Load(services);
     ServicesModule.Load(services);
     RepositoriesModule.Load(services, configuration);
     CommonModule.Load(services);
 }
 private void LoadAllConfigs()
 {
     CommonModule.LoadCommonConfig();
     G.Module.LoadAllModules();
     InitSelectedIndex();
     LoadAllModulesUserConfigList();
     ConfigToIndex();
 }
Example #12
0
        public void TestForPrivate()
        {
            var param = 1.08;
            // PrivateInvoke
            var actPrice = CommonModule.PrivateMethodInvoke(_product, "GetTaxIncluded", new object[] { param });

            Assert.Equal(108000, actPrice);
        }
 private void ChangeRootPath(string path)
 {
     CommonModule.ChangeRootPath(path);
     G.Module.LoadAllConfigs();
     G.g.OnChangeCurrentUserConfig();
     selectedUserConfigIndex = userConfigNames.IndexOf(Path.GetFileNameWithoutExtension(G.Module.ModuleStateConfig.Json.CurrentUserConfigName));
     //G.Module.DisplayRunError();
 }
        public static void BeforeAllTests()
        {
            var commonModule = new CommonModule();
            var builder      = new ContainerBuilder();

            builder.RegisterModule(commonModule);
            container = builder.Build();
        }
Example #15
0
 private void ChangeRootPath(string path)
 {
     CommonModule.ChangeRootPath(path);
     G.Module.LoadAllConfigs();
     InitSelectedIndex();
     ConfigToIndex();
     //G.Module.DisplayRunError();
 }
Example #16
0
 private void LoadAllConfigs()
 {
     CommonModule.LoadCommonConfig();
     G.Module.LoadAllConfigs();
     InitSelectedIndex();
     ConfigToIndex();
     //G.Module.DisplayRunError();
 }
Example #17
0
        public static void Load(IServiceCollection services)
        {
            services.AddTransient <IAzureCloudStorageService, AzureCloudStorageService>();
            services.AddTransient <ICsvParser, CsvParser>();
            services.AddTransient <IServiceBusService, ServiceBusService>();

            CommonModule.Load(services);
        }
 private void ChangeRootPath(string path)
 {
     CommonModule.ChangeRootPath(path);
     G.Module.LoadAllModules();
     InitSelectedIndex();
     LoadAllModulesUserConfigList();
     ConfigToIndex();
     OnChangeRootPath();
 }
        private void ClickedApply()
        {
            try
            {
                CommonModule.ClearLogFolderPath();
                G.Runner.Check();
            }
            catch (EBPCheckFailedException e)
            {
                G.Module.DisplayDialog(e.Message);
                return;
            }
            bool ensure = G.Module.DisplayDialog("确定应用当前配置?应用过程不可中断。", "确定", "取消");

            if (ensure)
            {
                try
                {
                    CommonModule.GenerateLogFolderPath();
                    G.Runner.Run();
                }
                catch
                {
                    G.Module.DisplayRunError();
                    return;
                }

                string s = "转换完成!\n";
                if (G.Runner.process.ExitCode != 0)
                {
                    s = string.Format("操作中断!执行第{0}步时出错:{1}\n", G.Runner.currentShellIndex + 1, G.Runner.errorMessage);
                }
                s += string.Format("\n第一步(拷贝文件):\nPreStoredAssets中符合标签的文件共有{0}个,跳过{1}个,成功拷贝{2}个。\n",
                                   G.Runner.totalCountList[0], G.Runner.skipCountList[0], G.Runner.successCountList[0]);
                if (G.Runner.currentShellIndex >= 1)
                {
                    s += string.Format("\n第二步(修改meta):\n共有{0}个meta文件,跳过{1}个,成功修改{2}个。\n",
                                       G.Runner.totalCountList[1], G.Runner.skipCountList[1], G.Runner.successCountList[1]);
                }
                else
                {
                    s += "\n第二步未执行";
                }

                if (G.Module.DisplayDialog(s, "查看日志文件", "关闭"))
                {
                    foreach (string logFilePath in G.Runner.LogFilePathList)
                    {
                        if (!string.IsNullOrEmpty(logFilePath))
                        {
                            EditorUtility.OpenWithDefaultApp(logFilePath);
                        }
                    }
                }
            }
        }
        public void Init()
        {
            container = new UnityContainer();
            var common = new CommonModule(container);

            common.Initialize();

            module = new MachineLearningModule.MachineLearningModule(container);
            module.Initialize();
        }
Example #21
0
        private bool Duplicate()
        {
            if (userData is ItemModule)
            {
                return(item && item.Modules.Any(check) || template && template.Modules.Any(check));
            }
            return(false);

            bool check(ItemModule other) => CommonModule.Duplicate(userData as CommonModule, other as CommonModule);
        }
Example #22
0
        public static void Load(IServiceCollection services, IConfiguration configuration)
        {
            services.AddAutoMapper(typeof(ProductProfile));

            var connectionString = configuration["SqlConnectionString"];

            services.AddDbContext <ProductsDbContext>(options => options.UseSqlServer(connectionString));
            services.AddScoped <IProductRepository, ProductsRepository>();
            CommonModule.Load(services);
        }
Example #23
0
        public void TwoTimeStringExceptionTest([Values("", " ", "0.00004", null)] string prm1)
        {
            ForPrivate forPrivate = new ForPrivate();

            Assert.That(() =>
            {
                CommonModule.PrivateMethodInvoke(forPrivate, "TwoTimeString", new object[] { prm1 });
            },
                        Throws.TypeOf <InvalidCastException>());
        }
Example #24
0
        public void TwoTimeStringTest([Values("1", "4", "88", "-4", "0")] string prm1,
                                      [Values(2, 8, 176, -8, 0)] int Exp1)
        {
            ForPrivate forPrivate = new ForPrivate();

            Assert.That(forPrivate, Is.Not.Null);

            int act = (int)CommonModule.PrivateMethodInvoke(forPrivate, "TwoTimeString", new object[] { prm1 });

            Assert.That(act, Is.EqualTo(Exp1));
        }
Example #25
0
        public void TestPrivateMethod_GetTaxIncluded()
        {
            // テスト対象のインスタンス
            Product product = new Product(1, "Laptop", 100000);

            var param = 1.08;
            // PrivateInvoke
            var actPrice = CommonModule.PrivateMethodInvoke(product, "GetTaxIncluded", new Object[] { param });

            Assert.AreEqual(108000, actPrice);
        }
        private void Awake()
        {
            G.Init();

            CommonModule.LoadCommonConfig();
            G.Module.LoadAllConfigs();

            settingPanel.Awake();
            tagsPanel.Awake();
            importerSettingPanel.Awake();
        }
Example #27
0
 void SetIcons()
 {
     try
     {
         compressionIcon = CommonModule.GetIcon("PackageIcon.png");
     }
     catch (Exception e)
     {
         G.Module.DisplayDialog("加载Icon时发生错误:" + e.Message);
     }
 }
Example #28
0
        static void Main(string[] args)
        {
            globalSettings = GlobalSettingsIO.Load();
            location       = new Location(globalSettings.SettingsURI, globalSettings.SettingsPath);
            commonModule   = new CommonModule(location.GetLocation(CommonModule.Filename));

            TestDaily();
            TestReply();

            Console.WriteLine("Tests Finisched, press a key");
            Console.ReadKey();
        }
Example #29
0
 private static void InitCommon()
 {
     try
     {
         commonModule = new CommonModule(location.GetLocation(CommonModule.Filename));
         Log.Info(commonModule.ToString());
     }
     catch (Exception ex)
     {
         Log.Error(ex.ToString());
     }
 }
 private void ClickedCheck()
 {
     try
     {
         CommonModule.ClearLogFolderPath();
         G.Runner.Check(true);
         G.Module.DisplayDialog("检查正常!");
     }
     catch (EBPCheckFailedException e)
     {
         G.Module.DisplayDialog(e.Message);
     }
 }