Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            System.Timers.Timer aTimer = new System.Timers.Timer(5000);
            aTimer.Elapsed  += OnTimedEvent;
            aTimer.AutoReset = true;
            aTimer.Enabled   = true;

            textBox1.KeyDown += new KeyEventHandler(textBox1_KeyDown);
            textBox2.KeyDown += new KeyEventHandler(textBox23_KeyDown);
            textBox3.KeyDown += new KeyEventHandler(textBox23_KeyDown);

            listboxContextMenu = new ContextMenuStrip();
            foreach (string item in Constants.Menu)
            {
                listboxContextMenu.Items.Add(item);
            }

            for (int i = 0; i < listboxContextMenu.Items.Count; i++)
            {
                listboxContextMenu.Items[i].Click += new EventHandler(OnClick);
            }

            listBox1.ContextMenuStrip = listboxContextMenu;

            foreach (string usluga in Constants.Usluge)
            {
                comboBox1.Items.Add(usluga);
            }

            loaded               = false;
            usluga               = false;
            produlji             = false;
            promijeni            = false;
            comboBox1.Enabled    = false;
            progressBar1.Visible = false;

            TryCatch(() =>
            {
                if (!File.Exists(Constants.DbLocation))
                {
                    SQLiteConnection.CreateFile(Constants.DbLocation);
                }

                FitnessDB.Load();

                string danas = DateTime.Now.Day + "." + DateTime.Now.Month + "." + DateTime.Now.Year;
                Dolasci d    = FitnessDB.Dolasci.SingleOrDefault(dol => dol.Datum == danas);
                if (d.Index < 1)
                {
                    Dolasci dol      = new Dolasci();
                    dol.Index        = FitnessDB.Dolasci.GenerateIndex();
                    dol.Datum        = danas;
                    dol.BrojDolazaka = 0;
                    FitnessDB.Dolasci.Add(dol);
                    Utilities.CreateBackup();
                }
            });
        }
Exemplo n.º 2
0
 private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
 {
     TryCatch(() =>
     {
         FitnessDB.Load();
     });
 }