Esempio n. 1
0
        void QSS_Loaded(object sender, RoutedEventArgs e)
        {
            int i = 0;

            if (!vm.bLoggedIn)
            {
                Note.Visibility = Visibility.Hidden;
            }
            if (vm.GetShowPass() == 1)
            {
                ShowPass.Content = "Hide pass";
            }
            foreach (object but in buttonsContainer.Children)
            {
                Button button = but as Button;
                if (i < buttonLabels.Count)
                {
                    button.Visibility = Visibility.Visible;
                    button.Content    = buttonLabels[i];
                }
                i++;
            }
            if (vm.GetShowPass() == 1)
            {
                PassButton.Visibility = Visibility.Visible;
            }
            timer2          = new DispatcherTimer();
            timer2.Interval = TimeSpan.FromSeconds(1);
            timer2.Tick    += new EventHandler(timer2_Tick);
            EmployeeID.Focus();
            Barcode.TextChanged += new TextChangedEventHandler(Barcode_TextChanged);
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //make sure we can open database
            vm.OpenBCSandStoreDB();
            vm.GetOurEntities();
            vm.OpenAssemblyDB();
            this.Title = "On the Spot QCS";
            int i = 0;

            //Note.Visibility = Visibility.Visible;
            //Totals.Visibility = Visibility.Visible;
            if (vm.GetShowPass() == 1)
            {
                ShowPass.Content = "Hide pass";
            }
            foreach (object but in buttonsContainer.Children)
            {
                Button button = but as Button;
                if (i < buttonLabels.Count)
                {
                    button.Visibility = Visibility.Visible;
                    button.Content    = buttonLabels[i];
                }
                i++;
            }
            if (vm.GetShowPass() == 1)
            {
                PassButton.Visibility = Visibility.Visible;
            }
            timer2          = new DispatcherTimer();
            timer2.Interval = TimeSpan.FromSeconds(1);
            timer2.Tick    += new EventHandler(timer2_Tick);
            timer1          = new DispatcherTimer();
            timer1.Interval = TimeSpan.FromSeconds(30);
            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Start();
            EmployeeID.Focus();
            Barcode.TextChanged += new TextChangedEventHandler(Barcode_TextChanged);


            if (vm.DBerrormsg == string.Empty)
            {
                led1.ColorOn            = Colors.Green;
                led1.IsActive           = true;
                LoadedDone.Visibility   = Visibility.Visible;
                LoadingState.Visibility = Visibility.Collapsed;
            }
            else
            {
                DBErrorMsg.Text = vm.DBerrormsg;
                textBlock1.Text = "System Initialization Failed";
                led1.ColorOn    = Colors.Red;
                led1.IsActive   = true;
            }
        }