Example #1
0
        private void DoWork()
        {
            if (state == Scan)
            {
                selectedDrug = null;

                var drug = drugInfo.FirstOrDefault(d => d.DrugID == drugId);

                if (drug != null)
                {
                    try
                    {
                        selectedDrug = (DrugInfo)drug;

                        textBlock1.Text      = selectedDrug.DrugProperties.DrugUnwell;
                        textBlock1_Copy.Text = "";

                        textBlock7.Text = selectedDrug.DrugProperties.DrugUseWay;

                        textBlock5.Text       = selectedDrug.DrugProperties.DrugNotice;
                        textBlock1_Copy2.Text = "";

                        textBlock4.Text = selectedDrug.DrugProperties.DrugStoreAdv;

                        String uriString;

                        uriString  = "pack://application:,,,/Images/ScanDrug/";
                        uriString += selectedDrug.DrugID;
                        uriString += ".png";

                        if (selectedDrug.DrugID.Length <= 0)
                        {
                            uriString = "pack://application:,,,/Images/ScanDrug/default_med.png";
                        }

                        BitmapImage bitmap = new BitmapImage();

                        bitmap.BeginInit();

                        bitmap.UriSource = new Uri(uriString, UriKind.Absolute);
                        bitmap.EndInit();

                        yao.Source = bitmap;

                        scan2.Stop();
                        scan3.Begin();
                        state++;
                    }
                    catch (Exception e)
                    {
                        //MessageBox.Show("ScanDrug.xaml DoWork Error "+ e);
                    }
                }
            }
            drugId = string.Empty;
        }
Example #2
0
        private void DoWork()
        {
            if (state == Scan)
            {
                var drug = drugInfo.FirstOrDefault(d => d.DrugID == drugId);
                selectedDrug = (DrugInfo)drug;
                if (drug != null)
                {
                    try
                    {
                        BitmapImage bitmap = new BitmapImage();

                        bitmap.BeginInit();

                        String uriString;

                        uriString  = "pack://application:,,,/Images/ScanDrug/";
                        uriString += drug.DrugImageSource;

                        //readingImageString = "pack://application:,,,/Images/ScanDrug/r";
                        //readingImageString += drug.DrugImageSource;


                        bitmap.UriSource = new Uri(uriString, UriKind.Absolute);
                        bitmap.EndInit();
                        // small icon
                        yao.Source = bitmap;

                        textBlock1.Text      = drug.DrugProperties.DrugUnwell;
                        textBlock1_Copy.Text = "";


                        textBlock7.Text = drug.DrugProperties.DrugUseWay;

                        textBlock5.Text       = drug.DrugProperties.DrugNotice;
                        textBlock1_Copy2.Text = "";

                        textBlock4.Text = drug.DrugProperties.DrugStoreAdv;

                        scan2.Stop();
                        scan3.Begin();
                        state++;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            drugId = string.Empty;
        }