示例#1
0
        public MainWindow()
        {
            InitializeComponent();
            const int port = 2560;

            try
            {
                ZooConnection = new ZooClient(port);
            }
            catch (Exception e)
            {
                Logger.LogError($"Cannot load ZooCom.dll: {e.ToString()}", GetType(), "MainWindow()");
                Application.Current.Shutdown(-1);
            }
            dataGridFoods.DataContext  = ZooConnection.GetModelType(ModelType.Food);
            dataGridPlaces.DataContext = ZooConnection.GetModelType(ModelType.Place);
            threadUpdate = new Thread(() =>
            {
                TimeSpan waitTime = new TimeSpan(0, 5, 0);
                while (update)
                {
                    UpdateAnimals();
                    UpdateAttractions();
                    UpdateCashBalances();
                    UpdateFoods();
                    UpdateOvertimes();
                    UpdatePlaces();
                    UpdateWorkers();
                    Thread.Sleep(waitTime);
                }
            });
            threadUpdate.Start();
        }