Example #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            ModelProvider      modelProvider      = new ModelProvider();
            ControllerProvider controllerProvider = new ControllerProvider(modelProvider);

            Application.Run(new Form1(modelProvider, controllerProvider));
        }
Example #2
0
        public Form1(ModelProvider modelProvider, ControllerProvider controllerProvider)
        {
            InitializeComponent();

            _progressBars = new Dictionary <ParameterType, ProgressBar>()
            {
                [ParameterType.Energy] = Energy,
                [ParameterType.Hunger] = Hunger,
                [ParameterType.Mood]   = Mood,
                [ParameterType.Walk]   = Walk
            };

            _labels = new Dictionary <ParameterType, Label>()
            {
                [ParameterType.Energy] = labelEnergyStatus,
                [ParameterType.Hunger] = labelHungerStatus,
                [ParameterType.Mood]   = labelMoodStatus,
                [ParameterType.Walk]   = labelWalkStatus
            };

            tamagochiController = controllerProvider.TamagochiController;
            pet = modelProvider.Model.Pet;
            SubscribeParameters();
            pet.Init();

            aTimer          = new System.Windows.Forms.Timer();
            aTimer.Tick    += new EventHandler(OnChangeParameters);
            aTimer.Interval = 1000;
            aTimer.Start();

            bTimer          = new System.Windows.Forms.Timer();
            aTimer.Tick    += new EventHandler(TimerChanger);
            bTimer.Interval = 1000;
            bTimer.Start();

            CheckData();
        }