예제 #1
0
        public Form_Main(HDCDbContext _hDCDbContext
                         , Ticker _theTicker
                         , BackendLogic _dayCareBackEndAccess)
        {
            InitializeComponent();
            theArgs                       = new TickerArgs();
            hDCDbContext                  = _hDCDbContext;
            theTicker                     = _theTicker;
            dayCareBackEndAccess          = _dayCareBackEndAccess;
            this.label1.Text              = "";
            this.label2.Text              = "";
            this.SimulationFinishedEvent += button_Show_EndReport_VisibleChanged;

            this.mainReportTypes = $"INFO TYPE\n\n" +
                                   $"Simulation ID:\n\n" +
                                   $"Simulation started at:\n" +
                                   $"Simulation time now:\n" +
                                   $"Tick number now:\n\n" +
                                   $"Number of Hamdters in Cleintele this simulation:\n" +
                                   $"Capacity of daycare:\n" +
                                   $"The Hamster gender distribution is:\n\n" +
                                   $"AVG Wait for first Exersice:\n" +
                                   $"Number of Cages:\n" +
                                   $"Capacity of each Cage:\n\n" +
                                   $"Number of Exersice Areas:\n" +
                                   $"Capacity of each Exersice Area:\n";

            this.MainReport_Test_Types.Text = "Main Report Window";
        }
예제 #2
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);
        }