Example #1
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            DeviceInfoComponent deviceInfoComp = new DeviceInfoComponent();

            _deviceInfo = deviceInfoComp.GetDeviceInfo();

            if (_deviceInfo != null)
            {
                PlantNameTextBox.Text   = _deviceInfo.PlantId;
                MachineNameTextBox.Text = _deviceInfo.MachineName;
            }

            ScaleSettingComponent scaleSettingComp = new ScaleSettingComponent();

            _scaleSetting = scaleSettingComp.GetScaleSettingDefault();

            if (_scaleSetting != null)
            {
                DisplayUnitsComboBox.SelectedIndex = GetUnitIndex(_scaleSetting.DisplayUnits);

                PrecisionTextBox.Text       = _scaleSetting.MinimumDivision.ToString();
                InflightTextBox.Text        = _scaleSetting.Inflight.ToString();
                InflightTimingTextBox.Text  = _scaleSetting.InflightTiming.ToString();
                MaximumCapacityTextBox.Text = _scaleSetting.MaximumCapacity.ToString();
            }
            else
            {
                _scaleSetting = new ScaleSetting();
            }
        }
Example #2
0
        private void btnSaveDeviceInfo_Click(object sender, RoutedEventArgs e)
        {
            if (ValidateDeviceInfoInput() == false)
            {
                return;
            }


            DeviceInfoComponent deviceInfoComp = new DeviceInfoComponent();

            var deviceInfo = deviceInfoComp.GetDeviceInfo();

            deviceInfo.PlantId     = PlantNameTextBox.Text;
            deviceInfo.MachineName = MachineNameTextBox.Text;

            deviceInfoComp.UpdateDeviceInfo(deviceInfo);

            string msg = "Device information saved";

            saveSuccessfullmessage(msg);
        }
Example #3
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            bool IsInitialised = GpioUtility.InitialiseGpio();

            DeviceInfoComponent deviceInfoComp = new DeviceInfoComponent();

            //deviceInfoComp.DeleteDeviceInfo();
            _deviceInfo = deviceInfoComp.GetDeviceInfo();
            if (_deviceInfo == null)
            {
                //string key = CreateDeviceFunc(DeviceInfoHelper.Instance.SerialNumber).Result;
                _deviceInfo = new DeviceInfo
                {
                    Model           = DeviceInfoHelper.Instance.Model,
                    Manufacturer    = DeviceInfoHelper.Instance.Manufacturer,
                    Name            = DeviceInfoHelper.Instance.Id,
                    OSName          = DeviceInfoHelper.OSName,
                    SerialNumber    = DeviceInfoHelper.Instance.SerialNumber,
                    iotHubDeviceKey = DeviceInfoHelper.Instance.iotHubDeviceKey,
                    ClientId        = DeviceInfoHelper.Instance.ClientId,
                    pushToCloud     = DeviceInfoHelper.Instance.pushToCloud,
                    iotHubUri       = DeviceInfoHelper.Instance.iotHubUri,
                    pushToWebApi    = DeviceInfoHelper.Instance.pushToWebApi,
                    ServerUrl       = DeviceInfoHelper.Instance.ServerUrl,
                    PlantId         = DeviceInfoHelper.Instance.PlantId,
                    MachineName     = DeviceInfoHelper.Instance.MachineName
                };

                deviceInfoComp.AddDeviceInfo(_deviceInfo);
            }

            BatchComponent batchComp = new BatchComponent();

            _batch = batchComp.GetCurrentBatch();
            //DBHelper dbhelper = new DBHelper();
            //dbhelper.InitialiseTables();
        }
Example #4
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            DeviceInfoComponent deviceInfoComp = new DeviceInfoComponent();

            _deviceInfo = deviceInfoComp.GetDeviceInfo();

            if (GetScaleSettings() == false)
            {
                NoSettingsMessage(); return;
            }
            if (GetScaleCalibration() == false)
            {
                NoCalibrationMessage(); return;
            }

            ProductComponent productComp = new ProductComponent();

            _ProductsList = productComp.GetProducts();
            ProductsComboBox.ItemsSource = _ProductsList;

            _currentProduct = productComp.GetCurrentProduct();

            //txtFlyoutMessage.Text = "Confirm. The currently selected product is " + _currentProduct.Name;
            if (_currentProduct != null)
            {
                ProductsComboBox.SelectedValue = _currentProduct.ProductCode;
                //_normal_cutoff_weight = (_currentProduct.TargetWeight) * Convert.ToDecimal(0.8);
                _normal_cutoff_weight = _currentProduct.DribblePoint;
                if (MainPage._inflight_setpoint == 0)
                {
                    _final_setpoint_weight = _currentProduct.TargetWeight - _scaleSetting.Inflight;
                }
                else
                {
                    _final_setpoint_weight = _currentProduct.TargetWeight - MainPage._inflight_setpoint;
                }



                tblWeigherStatus.Text = "Ready To Fill";
                AcknowledgeProductSelection(_currentProduct);

                ProductNameTextBox.Text = _currentProduct.Name + " : " + _currentProduct.TargetWeight + " Kgs";
                BatchNumberTextBox.Text = "Batch No:" + _currentBatch.BatchCode;

                timer          = new DispatcherTimer();
                timer.Interval = new TimeSpan(0, 0, 0, 0, 1); // Interval of the timer
                timer.Tick    += timer_Tick;
                timer.Start();
            }
            else
            {
                //Please configure product
                NoProductMessage();
            }

            BatchComponent batchComp = new BatchComponent();

            _currentBatch = batchComp.GetCurrentBatch();
            if (_currentBatch != null)
            {
                BatchNumberTextBox.Text = _currentBatch.BatchCode;
            }
        }