private void DrawPrintView(string[] inwardValues) { var index = 0; foreach (var item in printDetails.GetType().GetProperties()) { try { if (item.GetValue(printDetails) != null) { var layoutInf = (LayoutInflater)GetSystemService(LayoutInflaterService); View view = layoutInf.Inflate(Resource.Layout.PrintView, null); view.FindViewById <TextView>(Resource.Id.txtName).Text = inwardValues[index]; view.FindViewById <TextView>(Resource.Id.txtValue).Text = item.GetValue(printDetails, null).ToString(); layoutMain.AddView(view, index); index++; } } catch (Exception ex) { ExceptionLog.LogDetails(this, "Error in retriving print details " + ex.Message); Console.WriteLine(ex.Message); } finally { btnPrint.Visibility = ViewStates.Visible; } } }
private void DrawPrintView(string[] inwardValues) { var index = 0; //foreach (var item in enterdvalues.GetType().GetProperties()) //{ // //Console.WriteLine(item.Name+" : "+item.GetValue(enterdvalues,null).ToString()); // if (!item.GetValue(enterdvalues, null).ToString().Equals("0") // && !item.GetValue(enterdvalues, null).ToString().Equals(string.Empty) && // !item.Name.Equals("VID") && !item.Name.Equals("DriverID_PK")) // { // var layoutInf = (LayoutInflater)GetSystemService(LayoutInflaterService); // View view = layoutInf.Inflate(Resource.Layout.PrintView, null); // view.FindViewById<TextView>(Resource.Id.txtName).Text = inwardValues[index]; // view.FindViewById<TextView>(Resource.Id.txtValue).Text = item.GetValue(enterdvalues, null).ToString(); // layoutMain.AddView(view, index); // index++; // } //} foreach (var item in user.GetType().GetProperties()) { try { if (item.GetValue(user) != null) { var layoutInf = (LayoutInflater)GetSystemService(LayoutInflaterService); View view = layoutInf.Inflate(Resource.Layout.PrintView, null); view.FindViewById <TextView>(Resource.Id.txtName).Text = inwardValues[index]; view.FindViewById <TextView>(Resource.Id.txtValue).Text = item.GetValue(user, null).ToString(); layoutMain.AddView(view, index); index++; } } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { btnPrint.Visibility = ViewStates.Visible; } } }