Esempio n. 1
0
        private void buttonadd_Clicked(object sender, EventArgs e)
        {
            List <ReworkLocation> x = new List <ReworkLocation>();

            sfListView.ItemsSource = x;


            ReworkLocation dataDEMO = new ReworkLocation();

            dataDEMO.BarcodeID = "BARCODE DUMMY" + i.ToString();
            dataDEMO.ItemID    = "ITEM ID DUMMY" + i.ToString();
            dataDEMO.ItemName  = "ITEM NAME DUMMY" + i.ToString();



            demo.Add(dataDEMO);
            demo.Add(dataDEMO);
            demo.Add(dataDEMO);
            demo.Add(dataDEMO);
            demo.Add(dataDEMO);
            GlobalVar._listReworkLocations = demo;
            sfListView.RefreshView();
            viewModel.listReworkLocation = GlobalVar._listReworkLocations;
            sfListView.ItemsSource       = viewModel.listReworkLocation;
        }
Esempio n. 2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();



            if (AppSettings.IsMqttConnected)
            {
                _application.mqttHelper.PublishMQTT(GlobalVar.PlantID, "GET_LOCATION_REWORK_" + GlobalVar.MacAddress);
                _application.mqttHelper.SubscribeMQTT("RESPON_LOCATION_REWORK_" + GlobalVar.MacAddress);
            }
            MessagingCenter.Subscribe <MqttHelper, string>(this, MessagingCenterKeys.RESPON_LOCATION_REWORK, (sender, args) =>
            {
                if (args != null)
                {
                    if (!First)
                    {
                        First = true;
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            _listLocationRework = new List <string>();

                            string[] strarray = { "@#$" };
                            string[] strsplit = args.Split(strarray, StringSplitOptions.None);
                            foreach (var item in strsplit)
                            {
                                _listLocationRework.Add(item);
                            }
                            Combobox_Location.DataSource = _listLocationRework;
                        });
                    }
                }
            });



            if (AppSettings.IsMqttConnected)
            {
                _application.mqttHelper.SubscribeMQTT("RESPON_BARCODE_LOCATION_REWORK_" + GlobalVar.MacAddress);
            }
            MessagingCenter.Subscribe <MqttHelper, string>(this, MessagingCenterKeys.RESPON_BARCODE_LOCATION_REWORK, (sender, args) =>
            {
                if (args != null)
                {
                    Device.BeginInvokeOnMainThread(() =>
                    {
                        if (args.Contains("SUCCESS,"))
                        {
                            args = args.Replace("SUCCESS,", "");
                            string[] strarray = { "@#$" };
                            string[] strsplit = args.Split(strarray, StringSplitOptions.None);

                            ReworkLocation rwkloc = new ReworkLocation();
                            rwkloc.BarcodeID      = strsplit[0];
                            rwkloc.ItemID         = strsplit[1];
                            rwkloc.ItemName       = strsplit[2];
                            rwkloc.Model          = strsplit[3];
                            rwkloc.Qty            = "Qty : " + strsplit[4];
                            rwkloc.Location       = "Loc : " + strsplit[5];



                            List <ReworkLocation> x = new List <ReworkLocation>();
                            sfListView.ItemsSource  = x;

                            GlobalVar._listReworkLocations.Add(rwkloc);
                            viewModel.listReworkLocation = GlobalVar._listReworkLocations;
                            sfListView.ItemsSource       = viewModel.listReworkLocation;
                            labeltotal.Text = string.Format("Total = {0}", Convert.ToString(viewModel.listReworkLocation.Count()));

                            //DisplayAlert("Information", "Data Rework Saved Successfully", "OK");
                        }
                        else
                        {
                            string errormessage = args.Replace("ERROR,", "");
                            DisplayAlert("Warning", errormessage, "OK");
                        }
                    });
                }
            });
        }