コード例 #1
0
ファイル: Program.cs プロジェクト: yj1118/CodeArt-Framework
        static void Main(string[] args)
        {
            AppInitializer.Initialize();


            Console.WriteLine("调用addPermission的服务");

            //以下是调用远程服务的代码
            var result = ServiceContext.Invoke("AddPermission", (arg) =>
            {
                //arg.Name = "测试权限的名称";
            });

            Console.WriteLine("调用deletePermission的服务");
            var permissionId = result.GetValue <Guid>("id");

            ServiceContext.Invoke("deletePermission", (arg) =>
            {
                //arg.Id = permissionId;
            });

            Console.WriteLine("执行完毕,按任意键退出");

            AppInitializer.Cleanup();

            Console.ReadLine();
        }
コード例 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            ApplicationDbContext context,
            RoleManager <IdentityRole> roleManager,
            UserManager <IdentityUser> userManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication(); //Authorization

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            AppInitializer.Initialize(context, roleManager, userManager);
        }
コード例 #3
0
        private static void Main(string[] args)
        {
            AppInitializer.Initialize();

            // if you want to use a different Application Delegate class from "AppDelegate"
            // you can specify it here.
            UIApplication.Main(args, null, "AppDelegate");
        }
コード例 #4
0
        static void Main(string[] args)
        {
            AppInitializer.Initialize();

            Console.WriteLine("按任意键结束");
            Console.ReadLine();


            AppInitializer.Cleanup();
        }
コード例 #5
0
        public Startup(IConfiguration configuration, IHostingEnvironment env, ILogger <Startup> logger)
        {
            AppEnvironment.SetName(env.EnvironmentName);

            AppInitializer.Initialize(configuration);

            Configuration      = configuration;
            HostingEnvironment = env;

            _logger = logger;

            _logger.LogInformation("app is booting");
        }
コード例 #6
0
        static void Main(string[] args)
        {
            AppInitializer.Initialize();

            var cmd = new StartEventTest(_simple);

            cmd.Execute();


            Console.WriteLine("按任意键结束");
            Console.ReadLine();

            AppInitializer.Cleanup();
        }
コード例 #7
0
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration      = configuration;
            HostingEnvironment = env;

            var logFactory = LogManager.LoadConfiguration("NLog.config");

            logger = logFactory.GetCurrentClassLogger();

            logger.Info("app is booting");

            AppEnvironment.SetName(env.EnvironmentName);

            AppInitializer.Initialize(configuration);
        }
コード例 #8
0
        static void Main(string[] args)
        {
            AppInitializer.Initialize();


            Console.WriteLine("调用addGenerator的服务");


            //XY20170807
            //创建规则对象
            var hardcode = DTObject.CreateReusable();

            hardcode["ruleType"] = "hardcode";
            hardcode["content"]  = "XY";

            var dateCode = DTObject.CreateReusable();

            dateCode["ruleType"] = "dateCode";

            var rules = new DTObject[] { hardcode, dateCode };


            //以下是调用远程服务的代码
            var result = ServiceContext.InvokeDynamic("addGenerator", (arg) =>
            {
                arg.Name       = "第一个测试用的";
                arg.MarkedCode = "first";
                arg.Rules      = rules;
            });

            //Console.WriteLine("调用deleteGenerator的服务");
            //var permissionId = result.GetValue<Guid>("id");

            //ServiceContext.Invoke("deletePermission", (arg) =>
            //{
            //    arg.Id = permissionId;
            //});

            //Console.WriteLine("执行完毕,按任意键退出");

            AppInitializer.Cleanup();

            Console.ReadLine();
        }
コード例 #9
0
        public static void Start(Action initialize = null)
        {
            RPCEvents.ServerOpened += OnServerOpened;
            RPCEvents.ServerError  += OnServerError;
            RPCEvents.ServerClosed += OnServerClosed;

            AppInitializer.Initialize();

            if (initialize != null)
            {
                initialize();
            }

            Console.WriteLine(MQ.Strings.CloseServiceHost);
            Console.ReadLine();


            AppInitializer.Cleanup();
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: dimonzav/SimpleRESTSQLite
        public static void Main(string[] args)
        {
            var host = CreateWebHostBuilder(args).Build();

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;

                try
                {
                    AppInitializer.Initialize();
                }

                catch
                {
                    throw;
                }
            }

            host.Run();
        }
コード例 #11
0
ファイル: MainWindow.xaml.cs プロジェクト: Ilmefy/MusicPlayer
        public MainWindow()
        {
            Stopwatch sw = new Stopwatch();

            InitializeComponent();
            EventManager.RegisterClassHandler(typeof(MainWindow), MainWindow.KeyDownEvent, new RoutedEventHandler(Window_KeyDown));
            Instance = this;

            AppInitializer.Initialize();
            UI.UiManager.SetTabControlWindow(Window.Home);
            CurrentWindow = Window.Home;
            Task.Factory.StartNew(() => MainWindow.Instance.Dispatcher.Invoke(() => Source.Radio.RadioInit.LoadData()));
            Task.Factory.StartNew(() => MainWindow.Instance.Dispatcher.Invoke(() => Source.Music.TrackInit.Init()));
            Task.Factory.StartNew(() => MainWindow.Instance.Dispatcher.Invoke(() => Source.Playlist.PlaylistInit.Init()));
            Music m = new Music();


            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);

            Source.Global.AppInitialized = true;
        }
コード例 #12
0
ファイル: Startup.cs プロジェクト: emo333/TCOMSapps
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, AppInitializer appinitializer)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                appinitializer.Initialize(app);
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvcWithDefaultRoute();

            RotativaConfiguration.Setup(env);
        }
コード例 #13
0
        static void Main(string[] args)
        {
            try
            {
                AppInitializer.Initialize();

                var fileName         = args[0];
                var folder           = args[1]; //转换的图片存放的目录
                var progressFileName = args[2]; //记录进度的文件

                DTObject gt = DTObject.Create();

                using (var doc = DocumentFactory.Create(fileName))
                {
                    if (doc != null)
                    {
                        var token = new CancelToken();
                        var range = GetRange(folder, doc);
                        doc.ExtractImages(range.Index, range.Count, (pageIndex, content, g) =>
                        {
                            SavePage(folder, pageIndex, content, token, g);
                            RaiseCallback(progressFileName, g, gt);  //更新进度
                        }, token);

                        RaiseCallback(progressFileName, new Progress(doc.PageCount, doc.PageCount), gt);
                    }
                }
            }
            catch (Exception ex)
            {
                var errorFileName = args[3];  //记录错误的文件
                WriteError(errorFileName, ex);
            }
            finally
            {
                AppInitializer.Cleanup();
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: yj1118/CodeArt-Framework
 static Program()
 {
     AppInitializer.Initialize();
 }
コード例 #15
0
 protected void Application_Start()
 {
     UnityConfig.RegisterComponents();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AppInitializer.Initialize();
 }
コード例 #16
0
 /// <summary>
 /// 静态构造函数作为测试环境下的入口
 /// 调用了AppInitializer.Initialize
 /// </summary>
 static UnitTest()
 {
     AppInitializer.Initialize();
 }
コード例 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            AppInitializer.Initialize();

            base.OnCreate(bundle);
        }
コード例 #18
0
 static WebServiceHost()
 {
     //当第一次使用ServiceHost时,初始化引用程序
     AppInitializer.Initialize();
 }
コード例 #19
0
 public static void Initialize(TestContext context)
 {
     AppInitializer.Initialize();
 }
コード例 #20
0
 public static void Initialize()
 {
     AppInitializer.Initialize();
     AppSession.Register(CombineAppSession.Instance);
 }