private void DeleteImage_Click(object sender, EventArgs e)
        {
            if (tillPopup != null)
            {
                return;
            }

            ImageViewWithPosition image = (ImageViewWithPosition)sender;

            layout.RemoveViewAt(image.Position);
            nameViews.RemoveAt(image.Position);
            priceViews.RemoveAt(image.Position);
            deleteButtons.RemoveAt(image.Position);
            editButtons.RemoveAt(image.Position);

            for (int i = image.Position; i < deleteButtons.Count; ++i)
            {
                ImageViewWithPosition deleteImage = deleteButtons[i];
                --deleteImage.Position;

                ImageViewWithId editImage = editButtons[i];
                --editImage.Position;
            }

            currentOrder.RemoveOrderItem(image.Position);

            SetTotalView(CurrentOrder);
        }
예제 #2
0
        public List <FavoriteElementId> SetTableData(List <FavoriteData> favorites,
                                                     Context context, Resources resources, TableLayout mTableLayout)
        {
            while (mTableLayout.ChildCount > 0)
            {
                mTableLayout.RemoveViewAt(0);
            }

            TableRow.LayoutParams tableRowLayoutparams = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent);

            List <FavoriteElementId> response = new List <FavoriteElementId>();

            Boolean colored = true;

            foreach (FavoriteData Row in favorites)
            {
                TableRow tr = new TableRow(context);
                if (colored)
                {
                    tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                }
                colored             = !colored;
                tr.LayoutParameters = tableRowLayoutparams;
                Boolean  WITH_DIRECTION = Row.direction != null;
                TextView tv1            = new TextView(context);
                tv1.Text          = Row.name + (WITH_DIRECTION ? " " + Row.direction : "");
                tv1.TextAlignment = TextAlignment.ViewEnd;

                tv1.SetPadding(0, 0, 13, 0);
                tv1.SetMinimumWidth(320);
                tv1.SetTextSize(Android.Util.ComplexUnitType.Dip, WITH_DIRECTION ? 14 : 22);
                tv1.SetMaxWidth(1000);
                ImageButton deleteBtn = new ImageButton(context);

                deleteBtn.SetImageResource(Android.Resource.Drawable.IcMenuDelete);
                deleteBtn.SetMaxWidth(30);
                deleteBtn.SetBackgroundColor(Android.Graphics.Color.Transparent);

                deleteBtn.TextAlignment = TextAlignment.ViewEnd;

                tr.AddView(tv1);
                tr.AddView(deleteBtn);
                mTableLayout.AddView(tr);
                if (Row.direction == null)
                {
                    response.Add(new FavoriteElementId(deleteBtn, tv1, Row.name, Row.searchType));
                }
                else
                {
                    response.Add(new FavoriteLineElementId(deleteBtn, tv1, Row.name, Row.searchType, Row.direction));
                }
            }
            return(response);
        }
예제 #3
0
        public override void OnShow(Bundle args, ShowFlags showFlags)
        {
            base.OnShow(args, showFlags);

            int playerLevel = GoOnTapApplication.Config.PlayerLevel;

            name.Text = "?";
            image.SetImageBitmap(null);

            levelValue.Text       = "?";
            cpValue.Text          = "?";
            hpValue.Text          = "?";
            averageValue.Text     = "?";
            playerLevelValue.Text = playerLevel.ToString();

            arcFeedback.Visibility = ViewStates.Gone;

            levelSeek.Enabled       = false;
            cpSeek.Enabled          = false;
            hpSeek.Enabled          = false;
            playerLevelSeek.Enabled = false;

            levelSeek.Progress       = 0;
            cpSeek.Progress          = 0;
            hpSeek.Progress          = 0;
            playerLevelSeek.Progress = playerLevel - 1;

            // Set checkboxes unckeck
            attack.Checked  = false;
            defense.Checked = false;
            stamina.Checked = false;

            while (ivTable.ChildCount > 1)
            {
                ivTable.RemoveViewAt(1);
            }
        }
예제 #4
0
        public void SetTableData(List <MonitoredStopVisit> data, TableLayout mTableLayout, Context context, Resources resources
                                 , string searchType)
        {
            while (mTableLayout.ChildCount > 2)
            {
                mTableLayout.RemoveViewAt(2);
            }
            TableRow.LayoutParams tableRowLayoutparams = new TableRow.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent);

            Boolean colored = false;


            if (searchType == "line")
            {
                List <string> idLoop = new List <string>();

                foreach (MonitoredStopVisit Row in data.OrderBy(s => s.MonitoredVehicleJourney.FramedVehicleJourneyRef.DatedVehicleJourneyRef))
                {
                    string crntIdLoop = Row.MonitoredVehicleJourney.FramedVehicleJourneyRef.DatedVehicleJourneyRef;
                    if (crntIdLoop == "0" || idLoop.FindIndex(x => x == crntIdLoop) >= 0)
                    {
                        // go to next row
                        // in search by line we display only one time per bus route
                    }
                    else
                    {
                        idLoop.Add(crntIdLoop);
                        if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                        {
                            if (idLoop.Count > 0) // after complete bus round adding space
                            {
                                Space space = new Space(context);
                                space.SetMinimumHeight(40);
                                mTableLayout.AddView(space);
                            }
                            foreach (OnwardCall call in Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall)
                            {
                                TableRow tr = new TableRow(context);
                                if (colored)
                                {
                                    tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                                }
                                colored             = !colored;
                                tr.LayoutParameters = tableRowLayoutparams;

                                TextView tv1 = new TextView(context);
                                string   firstStationName = dbHelper.ReadStationName(call.StopPointRef);
                                firstStationName = GetShortDest(firstStationName); // design the destination

                                tv1.Text          = firstStationName;
                                tv1.TextAlignment = TextAlignment.ViewEnd;
                                tv1.SetMaxWidth(400);
                                tv1.SetPadding(0, 0, 13, 0);
                                TextView tv2 = new TextView(context);
                                tv2.Text          = DateTime.Parse(call.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                                tv2.TextAlignment = TextAlignment.Center;

                                TextView tv3 = new TextView(context);
                                tv3.SetMaxWidth(400);
                                string stationName = dbHelper.ReadStationName(Row.MonitoredVehicleJourney.DestinationRef);
                                stationName = GetShortDest(stationName);

                                tv3.Text          = stationName;
                                tv3.TextAlignment = TextAlignment.Center;

                                TextView tv4 = new TextView(context);
                                if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                                {
                                    OnwardCall endStationCall = Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Where(a => a.StopPointRef == Row.MonitoredVehicleJourney.DestinationRef).FirstOrDefault();
                                    tv4.Text = endStationCall is null ? "לא ידוע" : DateTime.Parse(endStationCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                                }
                                else
                                {
                                    tv4.Text = tv2.Text;
                                }

                                tv4.TextAlignment = TextAlignment.Center;

                                tr.AddView(tv4);
                                tr.AddView(tv3);
                                tr.AddView(tv2);
                                tr.AddView(tv1);
                                mTableLayout.AddView(tr);
                            }
                        }
                    }
                }
            }
            else // by station and train
            {
                foreach (MonitoredStopVisit Row in data)
                {
                    TableRow tr = new TableRow(context);
                    if (colored)
                    {
                        tr.SetBackgroundColor(resources.GetColor(Resource.Color.eventRowResult));
                    }
                    colored             = !colored;
                    tr.LayoutParameters = tableRowLayoutparams;
                    TextView tv1 = new TextView(context);
                    tv1.SetPadding(0, 0, 13, 0);
                    switch (searchType)
                    {
                    case "station":
                        tv1.Text          = Row.MonitoredVehicleJourney.PublishedLineName;
                        tv1.TextAlignment = TextAlignment.Center;
                        break;

                    default:
                        break;
                    }

                    TextView tv2 = new TextView(context);
                    tv2.Text          = DateTime.Parse(Row.MonitoredVehicleJourney.MonitoredCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                    tv2.TextAlignment = TextAlignment.Center;

                    TextView tv3         = new TextView(context);
                    string   stationName = dbHelper.ReadStationName(Row.MonitoredVehicleJourney.DestinationRef);

                    tv3.Text          = stationName;
                    tv3.TextAlignment = TextAlignment.Center;

                    TextView tv4 = new TextView(context);
                    if (Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Count > 0)
                    {
                        OnwardCall endStationCall = Row.MonitoredVehicleJourney.OnwardCalls.OnwardCall.Where(a => a.StopPointRef == Row.MonitoredVehicleJourney.DestinationRef).FirstOrDefault();
                        tv4.Text = endStationCall is null ? "לא ידוע" : DateTime.Parse(endStationCall.ExpectedArrivalTime.ToShortTimeString()).ToString("HH:mm", CultureInfo.CurrentCulture);
                    }
                    else
                    {
                        tv4.Text = tv2.Text;
                    }

                    tv4.TextAlignment = TextAlignment.Center;

                    tr.AddView(tv4);
                    tr.AddView(tv3);
                    tr.AddView(tv2);
                    tr.AddView(tv1);
                    mTableLayout.AddView(tr);
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Se cargan la lista de notificadores
        /// </summary>
        public void cargarNotificadores()
        {
            try
            {
                ManejoBaseDatos.Abrir();
                //Se consulta en la base de datos la lista de los usuarios notificadores
                ICursor cursor = ManejoBaseDatos.Seleccionar("SELECT NombreCompleto, CodigoNotificador, RolNocturno FROM OficialesNotificadores");
                //Instancia de la tabla de notificadores
                TableLayout tablaNotificadores = Activity.FindViewById <TableLayout>(Resource.Id.tbNotificadores);
                //Se crea el objeto para las fila que se van a ingresar en la tabla
                TableRow nuevaFila;
                TableLayout.LayoutParams layoutParams = new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.MatchParent);

                List <int> listaIndices = new List <int>();
                //Se guardan los indices que se van a eliminar de la tabla de notificadores
                for (int i = 1; i < tablaNotificadores.ChildCount; tablaNotificadores.RemoveViewAt(1))
                {
                    ;
                }

                if (cursor.MoveToFirst())//Se posiciona el cursor en la primera posición
                {
                    do
                    {
                        nuevaFila = new TableRow(Activity);                                    //Se instancia la nueva fila
                        nuevaFila.LayoutParameters = layoutParams;                             //Se agregan los tamaños del layout
                        nuevaFila.SetPadding(5, 5, 5, 5);                                      //Se agregan los margenes de cada fila
                        nuevaFila.SetBackgroundColor(Android.Graphics.Color.Argb(2, 1, 0, 5)); //Se cambia el color del fondo
                        nuevaFila.Clickable = true;
                        nuevaFila.Click    += (s, args) => { };

                        //Se agrega el nombre del notificador
                        TextView nombreNotificador = new TextView(Activity);
                        nombreNotificador.Text = cursor.GetString(0);
                        //Se agrega el rol
                        CheckBox rolNocturno = new CheckBox(Activity);
                        rolNocturno.Gravity = GravityFlags.CenterHorizontal;
                        rolNocturno.Text    = "";
                        //Se obtiene el valor del rol nocturno
                        string check = cursor.GetString(2);
                        //Si es verdadero el check se marca y si no, se deja sin marcar
                        rolNocturno.Checked = check == "True" || check == "true" ? true : false;
                        //Se guarda el codigo del notificador
                        string codigoNotificador = cursor.GetString(1);

                        rolNocturno.CheckedChange += (s, args) =>
                        {
                            ManejoBaseDatos.Abrir();
                            //Se actualiza el rol nocturno
                            string msj = ManejoBaseDatos.Actualizar("OficialesNotificadores", "RolNocturno", "'" + args.IsChecked + "'", "CodigoNotificador='" + codigoNotificador + "'");
                            ManejoBaseDatos.Cerrar();

                            try
                            {
                                if (args.IsChecked)
                                {
                                    string         consulta = @"https://pjgestionnotificacionmovilservicios.azurewebsites.net/api/OficialNotificador/AsignarRolNocturno?PCodNotificador=" + codigoNotificador + "";
                                    HttpWebRequest request  = (HttpWebRequest)WebRequest.Create(consulta);
                                    request.Method      = "GET";
                                    request.ContentType = "application/json";
                                    HttpWebResponse myResp = (HttpWebResponse)request.GetResponse();
                                    string          responseText;

                                    using (var response = request.GetResponse())
                                    {
                                        using (var reader = new StreamReader(response.GetResponseStream()))
                                        {
                                            responseText = reader.ReadToEnd();
                                            Console.WriteLine("Respuesta de web service: " + responseText);
                                            if (responseText.Equals("true") || responseText.Equals("True"))
                                            {
                                                Toast.MakeText(this.Activity, "Cambio a Rol Nocturno Exitoso", ToastLength.Short).Show();
                                            }
                                        }
                                    }
                                }
                            }
                            catch (WebException webEx)
                            {
                                Toast.MakeText(this.Activity, "Error al actualizar datos", ToastLength.Short).Show();
                                Console.WriteLine("Error al asignar rol nocturno: " + webEx.ToString());
                            }

                            Toast.MakeText(Activity, msj, ToastLength.Short).Show();
                        };
                        //Se agregan las dos columnas a la fila
                        nuevaFila.AddView(nombreNotificador);
                        nuevaFila.AddView(rolNocturno);
                        //Se agrega la nueva fila a la tabla
                        tablaNotificadores.AddView(nuevaFila);
                    } while (cursor.MoveToNext());
                }
                cursor.Close();

                ManejoBaseDatos.Cerrar();
            }catch (Exception ex)
            {
                //Se guarda el detalle del error
                Logs.saveLogError("RolNocturno.cargarNotificadores " + ex.Message + " " + ex.StackTrace);
            }
        }