Пример #1
0
        static void Main()
        {
            Application.SetHighDpiMode(HighDpiMode.SystemAware);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // creates a new custom EF dbConteqt
            hDCDbContext = new HDCDbContext();
            // if there are no db in system one will be created in SQLEXPERSS
            hDCDbContext.Database.EnsureCreated();

            // theArgs are the info engine in the backend, it is an info carrier
            // supplies info to various parts ot thr program and is ofthen updated
            theArgs = new TickerArgs();

            // Is the same idea as theArgs but in the UI part of the program
            // carries info to different parts of UI, used to construct info Raports
            ReportArgs = new ReportArgs();

            // is the more literal engine, drives the program ittration and drives the simulation
            theTicker = new Ticker();
            // Ticker has tick event wich starts each iterration of the simulatin
            theTicker.tick += StartSimulation;

            // BackendLogic id the go between UI and backend, here are pretty much
            // all the methodes used to gather data from backend
            dayCareBackEndAccessAccess = new BackendLogic(hDCDbContext, theArgs, ReportArgs);

            // sets theArgs form last saves settings
            SetArgsFromSettingsFile();

            // if Hamsters are empty
            if (hDCDbContext.Hamsters.Count() == 0)
            {
                dayCareBackEndAccessAccess.SeedDB(theArgs);
            }

            // creates Main window form
            Main_Form = new Form_Main(hDCDbContext, theTicker, dayCareBackEndAccessAccess);

            // Creates separate UIthred to handle all of the forms logic
            Thread UIThread = new Thread(StartForm);

            UIThread.Start();

            // creates a loop to keep alive main thread untill simulation strts
            SimulationAwaiter(theTicker);
        }
Пример #2
0
 public BackendLogic(HDCDbContext _hDCDbContext, TickerArgs _theArgs, ReportArgs _ReportArgs)
 {
     hDCDbContext = _hDCDbContext;
     //theArgs = _theArgs;
     ReportArgs = _ReportArgs;
 }