예제 #1
0
        public void AsyncCallFixedWeight(IAsyncResult res)
        {
            try
            {
                WebReference.WebSDataBrCode BrServer = res.AsyncState as WebReference.WebSDataBrCode;
                String result = BrServer.EndFixedWeight(res);
                if (result == "1")
                {
                    labelStatus.BeginInvoke(new Action(() =>
                    {
                        labelStatus.Text = "Фиксация веса произведена успешно";
                    }));
                    CLog.WriteInfo("DataScales.cs", "Fixed: " + result);
                    //GetDataEU(LabelEU);
                    //тут апдейтнем локальную БД
                    UpdateSqlLiteWeigth(LabelEU, this.UnitWeght);

                    //Делаем перезапрос
                    GetDataEUSqlLite(LabelEU);

                    //Вывести сообщение что вес успешно обновлен
                }
                else
                {
                    labelStatus.BeginInvoke(new Action(() =>
                    {
                        labelStatus.Text = "Ошибка фиксации: " + result;
                    }));
                    CLog.WriteInfo("DataScales.cs", "Fixed: " + result);
                }
            }

            catch (Exception ex)
            {
                CLog.WriteException("DataScales.cs", "AsyncCallFixedWeight", ex.Message);
            }
        }