Exemple #1
0
 public Form()
 {
     InitializeComponent();
     OutputDisplay.ShowMethod         += this.OutputRichTextBox;
     ProgressBarShow.SetProgressValue += this.SetProgressValue;
     _ = GoogleAnalyticsTracker.Tracker("Form", "Initialize");
 }
Exemple #2
0
        private void startBtn_Click(object sender, EventArgs e)
        {
            _ = GoogleAnalyticsTracker.Tracker("Form", "Start");
            this._starTime = DateTime.Now;
            CommonHelper.KillExcelProcess();
            if (this.FileChecked(filePathTb.Text))
            {
                return;
            }

            this.backgroundWorker.RunWorkerAsync(filePathTb.Text);
            this.timer.Start();
        }
Exemple #3
0
 /// <summary>
 /// Excel转换为XML
 /// </summary>
 /// <param name="fileDir">文件路径</param>
 private void ExcelToXml(string fileDir)
 {
     _ = GoogleAnalyticsTracker.Tracker("Work", "ExcelToXml");
     try
     {
         ExcelAnalysisByEpplus excelAnalysis = new ExcelAnalysisByEpplus(fileDir);
         _tcDic = excelAnalysis.ReadExcel();
     }
     catch (Exception ex)
     {
         this._logger.Error(ex);
         OutputDisplay.ShowMessage(ex.ToString(), Color.Red);
         return;
     }
 }
Exemple #4
0
 private void XmlToExcel(string fileDir)
 {
     _ = GoogleAnalyticsTracker.Tracker("Work", "XmlToExcel");
     try
     {
         XmlAnalysis     xmlAnalysis = new XmlAnalysis(fileDir);
         XmlToModel      xtm         = new XmlToModel(xmlAnalysis.GetAllTestCaseNodes());
         List <TestCase> tcList      = xtm.OutputTestCases();
         this._tcDic = new Dictionary <string, List <TestCase> >();
         _tcDic.Add("TestCase", tcList);
     }
     catch (Exception ex)
     {
         this._logger.Error(ex);
         OutputDisplay.ShowMessage(ex.ToString(), Color.Red);
         return;
     }
 }
Exemple #5
0
        public RecTime()
        {
            InitializeComponent();
            this.StartPosition = FormStartPosition.CenterScreen;

            var materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme       = MaterialSkinManager.Themes.LIGHT;
            materialSkinManager.ColorScheme = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE);

            string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

            txtOutputLocation.Text = path;

            if (Properties.Settings.Default.UserId == Guid.Empty)
            {
                Properties.Settings.Default.UserId = Guid.NewGuid();
                Properties.Settings.Default.Save();
            }
            _tracker = new GoogleAnalyticsTracker(Application.ProductVersion,
                                                  Properties.Settings.Default.UserId.ToString());
        }
Exemple #6
0
 public GoogleAnalyticsReport(string trackingId)
 {
     this.tracker = new GoogleAnalyticsTracker(trackingId);
 }
        // ConfigureServices is where you register dependencies. This gets
        // called by the runtime before the ConfigureContainer method, below.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            // Add services to the collection. Don't build or return
            // any IServiceProvider or the ConfigureContainer method
            // won't get called.

            //Allow handler for caching of http responses
            services.AddResponseCaching();

            //Make sure the application uses the X-Forwarded-Proto header
            services.Configure <ForwardedHeadersOptions>(
                options =>
            {
                options.ForwardedHeaders = ForwardedHeaders.XForwardedProto;
            });

            //Add a dedicated httpclient for Google Analytics tracking with exponential retry policy
            services.AddHttpClient <IWebTracker, GoogleAnalyticsTracker>(nameof(IWebTracker), GoogleAnalyticsTracker.SetupHttpClient)
            .SetHandlerLifetime(TimeSpan.FromMinutes(10))
            .AddPolicyHandler(GoogleAnalyticsTracker.GetRetryPolicy());

            //Add a dedicated httpclient for Companies house API with exponential retry policy
            services.AddHttpClient <ICompaniesHouseAPI, CompaniesHouseAPI>(nameof(ICompaniesHouseAPI), CompaniesHouseAPI.SetupHttpClient)
            .SetHandlerLifetime(TimeSpan.FromMinutes(10))
            .AddPolicyHandler(CompaniesHouseAPI.GetRetryPolicy());

            //Allow creation of a static http context anywhere
            services.AddHttpContextAccessor();

            services.AddControllersWithViews(
                options =>
            {
                options.AddStringTrimmingProvider();                  //Add modelstate binder to trim input
                options.ModelMetadataDetailsProviders.Add(
                    new TrimModelBinder());                           //Set DisplayMetadata to input empty strings as null
                options.ModelMetadataDetailsProviders.Add(
                    new DefaultResourceValidationMetadataProvider()); // sets default resource type to use for display text and error messages
                options.Filters.Add <ErrorHandlingFilter>();
            })
            .AddControllersAsServices()     // Add controllers as services so attribute filters be resolved in contructors.
            .AddJsonOptions(options =>
            {
                // By default, ASP.Net's JSON serialiser converts property names to camelCase (because javascript typically uses camelCase)
                // But, some of our javascript code uses PascalCase (e.g. the homepage auto-complete)
                // These options tell ASP.Net to use the original C# property names, without changing the case
                options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
                options.JsonSerializerOptions.PropertyNamingPolicy        = null;
            })
            .AddDataAnnotationsLocalization(
                options => { options.DataAnnotationLocalizerProvider = DataAnnotationLocalizerProvider.DefaultResourceHandler; });

            IMvcBuilder mvcBuilder = services.AddRazorPages();

            if (Config.IsLocal())
            {
                mvcBuilder.AddRazorRuntimeCompilation();
            }

            //Add antiforgery token by default to forms making sure the Secure flag is always set
            services.AddAntiforgery(
                options =>
            {
                options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
            });

            //Add services needed for sessions
            services.AddSession(
                o =>
            {
                o.Cookie.IsEssential  = true;                      //This is required otherwise session will not load
                o.Cookie.SecurePolicy = CookieSecurePolicy.Always; //Equivalent to <httpCookies requireSSL="true" /> from Web.Config
                o.Cookie.HttpOnly     = true;                      //Session cookie should not be accessible by client-side scripts
                o.IdleTimeout         = TimeSpan.FromDays(30);     // This is how long the session DATA is kept, not how long the cookie lasts
            });

            //Add the distributed redis cache
            AddRedisCache(services);

            DataProtectionKeysHelper.AddDataProtectionKeyStorage(services);
            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(options =>
            {
                options.LoginPath        = new PathString("/login");
                options.LogoutPath       = new PathString("/logout");
                options.AccessDeniedPath = new PathString("/error/403");
                // ...
            });

            services.AddHostedService <SearchCacheUpdaterService>();

            HangfireConfigurationHelper.ConfigureServices(services);

            //Override any test services
            ConfigureTestServices?.Invoke(services);

            //Create Inversion of Control container
            Global.ContainerIoC = BuildContainerIoC(services);

            // Create the IServiceProvider based on the container.
            return(new AutofacServiceProvider(Global.ContainerIoC));
        }