示例#1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IWebHostEnvironment env,
                              RestoreService restore)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseSwagger();
                app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "LuceneServer.NET v1"));
            }

            restore.TryRestoreIndices();

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            switch (Configuration["Authorization:Type"]?.ToLower())
            {
            case "basic":
                app.UseMiddleware <BasicAuthenticationMiddleware>();
                break;
            }

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
示例#2
0
 protected override void SaveWorkerDoWork(object sender, DoWorkEventArgs e)
 {
     Utils.EnsureCulture();
     Dispatcher.Invoke(new Action(() => {
         if (string.IsNullOrWhiteSpace(_pathAndFileName))
         {
             return;
         }
         btnStart.IsEnabled  = btnClose.IsEnabled = false;
         aiLoader.Visibility = Visibility.Visible;
     }));
     Thread.Sleep(new Random().Next(2500, 7500));
     Dispatcher.Invoke(new Action(() => {
         aiLoader.Visibility = Visibility.Collapsed;
         btnStart.IsEnabled  = btnClose.IsEnabled = true;
         if (RestoreService.PerformRestore(_pathAndFileName))
         {
             MessageWindowHelpers.Show(this,
                                       string.Format(RestoreResources.RestorePerformingSuceeded, _pathAndFileName));
         }
         else
         {
             MessageWindowHelpers.Show(this, RestoreResources.RestorePerformingFailed, MessageBoxButton.OK,
                                       MessageBoxImage.Hand);
         }
     }));
 }