Exemplo n.º 1
0
        private DataProxy()
        {
            using (ISQLConnection dataSource = DataSource)
            {
                customersVersion = dataSource.GetCustomersVersion();
                toolsVersion     = dataSource.GetToolsVersion();
                rentalVersion    = dataSource.GetRentalVersion();
            }

            dbChangeCheckTimer          = new Timer(10000);
            dbChangeCheckTimer.Elapsed += (s, a) =>
            {
                dbChangeCheckTimer.Stop();
                using (ISQLConnection dataSource = DataSource)
                {
                    var actVersion = dataSource.GetCustomersVersion();
                    if (customersVersion != actVersion)
                    {
                        customersVersion = actVersion;
                        OnCustomersChanged(EventArgs.Empty);
                    }

                    actVersion = dataSource.GetToolsVersion();
                    if (toolsVersion != actVersion)
                    {
                        toolsVersion = actVersion;
                        OnToolsChanged(EventArgs.Empty);
                    }

                    actVersion = dataSource.GetRentalVersion();
                    if (rentalVersion != actVersion)
                    {
                        rentalVersion = actVersion;
                        OnRentalChanged(EventArgs.Empty);
                    }
                }
                dbChangeCheckTimer.Start();
            };
            dbChangeCheckTimer.Start();
        }