public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder    = null;
            TextView   lblTop    = null;
            TextView   lblBottom = null;
            TextView   lblTime   = null;

            ViewGroup rowView = (ViewGroup)convertView;

            if (rowView == null)
            {
                rowView = (ViewGroup)vi.Inflate(Resource.Layout.row, null);

                lblTop    = (TextView)rowView.FindViewById(Resource.Id.toptext);
                lblBottom = (TextView)rowView.FindViewById(Resource.Id.bottomtext);
                lblTime   = (TextView)rowView.FindViewById(Resource.Id.text_date_time);

                holder           = new ViewHolder();
                holder.lblTop    = lblTop;
                holder.lblBottom = lblBottom;
                holder.lblTime   = lblTime;
                rowView.Tag      = holder;
            }
            else
            {
                holder    = rowView.Tag as ViewHolder;
                lblTop    = holder.lblTop;
                lblBottom = holder.lblBottom;
                lblTime   = holder.lblTime;

                lblBottom.Visibility = ViewStates.Visible;
                lblBottom.Text       = "";
                lblTop.SetTextColor(rowView.Context.Resources.GetColor(
                                        Resource.Color.log_regular_text_color));
                lblTop.Text = "";
            }

            LogMessage rpcObj = items[position];

            if (rpcObj != null)
            {
                lblBottom.Visibility = ViewStates.Gone;
                if (rpcObj is StringLogMessage)
                {
                    StringLogMessage myStringLog = (StringLogMessage)rpcObj;

                    lblTop.Text  = myStringLog.getMessage();
                    lblTime.Text = rpcObj.getDate();
                    lblTop.SetTextColor(Color.Black);
                }
                else if (rpcObj is RpcLogMessage)
                {
                    RpcMessage func = ((RpcLogMessage)rpcObj).getMessage();

                    if (func.getRpcMessageType() == RpcMessageType.REQUEST)
                    {
                        lblTop.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_request_text_color));
                        lblTop.Text = rpcObj.getPrependComment() + ((RpcRequest)func).method + " (" + func.getRpcMessageFlow().ToString().ToLower() + " " + func.getRpcMessageType().ToString().ToLower() + ")";
                    }
                    else if (func.getRpcMessageType() == RpcMessageType.RESPONSE)
                    {
                        lblBottom.Visibility = ViewStates.Visible;
                        HmiApiLib.Common.Enums.Result resultCode = (HmiApiLib.Common.Enums.Result)((HmiApiLib.Base.Result)((RpcResponse)func).result).code;

                        lblTop.Text = rpcObj.getPrependComment() + ((HmiApiLib.Base.Result)((RpcResponse)func).result).method + " (" + func.getRpcMessageFlow().ToString().ToLower() + " " + func.getRpcMessageType().ToString().ToLower() + ")";

                        if ((resultCode == HmiApiLib.Common.Enums.Result.SUCCESS) ||
                            (resultCode == HmiApiLib.Common.Enums.Result.WARNINGS))
                        {
                            lblTop.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_response_success_text_color));
                            lblBottom.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_response_success_text_color));
                        }
                        else
                        {
                            lblTop.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_response_failure_text_color));
                            lblBottom.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_response_failure_text_color));
                        }

                        lblBottom.Text = (resultCode).ToString();
                    }
                    else if ((func.getRpcMessageType() == RpcMessageType.NOTIFICATION) || (func.getRpcMessageType() == RpcMessageType.REQUEST_NOTIFY))
                    {
                        if (func.getRpcMessageType() == RpcMessageType.NOTIFICATION)
                        {
                            lblTop.Text = rpcObj.getPrependComment() + ((RpcNotification)func).method + " (" + func.getRpcMessageFlow().ToString().ToLower() + " " + func.getRpcMessageType().ToString().ToLower() + ")";
                        }
                        else
                        {
                            lblTop.Text = rpcObj.getPrependComment() + ((RequestNotifyMessage)func).method + " (" + func.getRpcMessageFlow().ToString().ToLower() + " " + func.getRpcMessageType().ToString().ToLower() + ")";
                        }
                        lblTop.SetTextColor(ContextCompat.GetColorStateList(rowView.Context, Resource.Color.log_notification_text_color));
                    }

                    lblTime.Text = rpcObj.getDate();
                }
            }
            return(rowView);
        }
        void listView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            Object listObj = _msgAdapter[e.Position];

            if (listObj is RpcLogMessage)
            {
                LayoutInflater requestJSON = (LayoutInflater)this.Activity.GetSystemService(Context.LayoutInflaterService);
                View           jsonLayout  = requestJSON.Inflate(Resource.Layout.consolelogpreview, null);
                EditText       jsonText    = (EditText)jsonLayout.FindViewById(Resource.Id.consoleLogPreview_jsonContent);

                RpcMessage          message = ((RpcLogMessage)listObj).getMessage();
                AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity);

                string rawJSON    = "";
                int    corrId     = -1;
                string methodName = "";

                jsonText.Focusable = false;

                if (message is RpcRequest)
                {
                    corrId     = ((RpcRequest)message).getId();
                    methodName = ((RpcRequest)message).method;
                }
                else if (message is RpcResponse)
                {
                    corrId     = ((RpcResponse)message).getId();
                    methodName = ((HmiApiLib.Base.Result)((RpcResponse)message).result).method;
                }
                else if (message is RpcNotification)
                {
                    methodName = ((RpcNotification)message).method;
                }
                else if (message is RequestNotifyMessage)
                {
                    methodName = ((RequestNotifyMessage)message).method;
                }

                try
                {
                    rawJSON = JsonConvert.SerializeObject(message, Formatting.Indented);
                    builder.SetTitle("Raw JSON" + (corrId != -1 ? " (Corr ID " + corrId + ")" : ""));
                }
                catch (Exception ex)
                {
                    try
                    {
                        rawJSON = methodName +
                                  " (" + message.getRpcMessageFlow().ToString().ToLower() + " " + message.getRpcMessageType().ToString().ToLower() + ")";
                    }
                    catch (Exception e1)
                    {
                        rawJSON = "Undefined";
                    }
                }

                string finalJSON = rawJSON;

                jsonText.Text = finalJSON;

                builder.SetView(jsonLayout);

                builder.SetPositiveButton("Getters", (senderAlert, args) =>
                {
                    string sInfo = RpcMessageGetterInfo.viewDetails(message, false, 0);
                    Boolean isRpcResendAllowed = false;

                    if (message.rpcMessageFlow == HmiApiLib.Common.Enums.RpcMessageFlow.OUTGOING)
                    {
                        isRpcResendAllowed = true;
                    }

                    showDialogWithBack("GetterInfo", sInfo, isRpcResendAllowed, builder, jsonLayout);
                });

                builder.SetNeutralButton("Resend", (senderAlert, args) =>
                {
                    AppInstanceManager.Instance.sendRpc(message);
                });

                builder.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    builder.Dispose();
                });

                AlertDialog ad = builder.Create();
                ad.Show();

                Button resendRpc = ad.GetButton((int)DialogButtonType.Neutral);
                if (message.rpcMessageFlow == HmiApiLib.Common.Enums.RpcMessageFlow.OUTGOING)
                {
                    resendRpc.Enabled = true;
                }
                else
                {
                    resendRpc.Enabled = false;
                }
            }
            else if (listObj is StringLogMessage)
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this.Activity);
                string sMessageText         = ((StringLogMessage)listObj).getData();
                if (sMessageText == "")
                {
                    sMessageText = ((StringLogMessage)listObj).getMessage();
                }
                builder.SetMessage(sMessageText);
                builder.SetPositiveButton("OK", (senderAlert, args) =>
                {
                    builder.Dispose();
                });
                AlertDialog ad = builder.Create();
                ad.Show();
            }
        }