Esempio n. 1
0
 public void Activating(bool Menu, bool Gameplay)
 {
     if (!GM.IsPaused && !GM.isCapturing && !GM.isDeath)
     {
         Mainmenu.GetComponent <Canvas>().enabled = Menu;
         Gpui.GetComponent <Canvas>().enabled     = Gameplay;
     }
 }
Esempio n. 2
0
        public Mainmenu Mainmenu(string userid)
        {
            UserInfo user = GetUserInfoByID(userid);
            Mainmenu m    = new Mainmenu {
                LoginUser = user
            };

            return(m);
        }
Esempio n. 3
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            lbl_Status.Text = "";
            user.SetUsername(txtbx_Username.Text);
            user.SetPassword(txtbx_Password.Text);

            if (user.GetUsername() != "" && user.GetPassword() != null)
            {
                //Login mit AD wenn ausführender Rechner in Domäne

                string AnmeldeName = txtbx_Username.Text;
                string AnmeldePw   = txtbx_Password.Text;
                try
                {
                    using (PrincipalContext ctx = new PrincipalContext(ContextType.Domain))
                    {
                        // find a user
                        UserPrincipal nutzer = UserPrincipal.FindByIdentity(ctx, AnmeldeName);

                        if (nutzer != null)
                        {
                            // get the user's groups
                            var groups = nutzer.GetAuthorizationGroups();

                            foreach (GroupPrincipal group in groups)
                            {
                                if (group.Name == "WHM_DB_Lager")
                                {
                                    user.SetRolle("WHM_DB_Lager");
                                }
                                if (group.Name == "WHM_DB_Einkauf")
                                {
                                    user.SetRolle("WHM_DB_Einkauf");
                                }
                                if (group.Name == "WHM_DB_Admin")
                                {
                                    user.SetRolle("WHM_DB_Admin");
                                }
                            }
                        }
                    }
                }
                catch (Exception d)
                {
                    lbl_Status.Text = d.Message;
                }

                bool AnmeldungGültig = LDAPConnection(AnmeldeName, AnmeldePw);
                if (AnmeldungGültig == true)
                {
                    Mainmenu hmenu = new Mainmenu(user);
                    this.Hide();
                    hmenu.Show();
                }
            }
        }
        public void LoadContent(SpriteBatch _spritebatch, ContentManager _content, Camera _camera)
        {
            spritebatch = _spritebatch;
            content     = _content;
            camera      = _camera;

            menubackground = content.Load <Texture2D>("Menubackground.png");
            playbutton     = content.Load <Texture2D>("playbutton.png");
            mainmenu       = new Mainmenu(camera);
        }
        public void llenarlistas()
        {
            var jsonremoto = Mainmenu.gettearinstancia().jsonlistasremotas;

            if (jsonremoto.Trim().Length > 0)
            {
                listasremotas = JsonConvert.DeserializeObject <List <PlayList> >(jsonremoto);
            }



            if (System.IO.Directory.Exists(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/"))
            {
                string[] items = Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/");

                foreach (var elementos in items)
                {
                    var elementolista = new PlayList();
                    elementolista.Name = System.IO.Path.GetFileNameWithoutExtension(elementos);
                    var text = File.ReadAllText(elementos).Trim();
                    try
                    {
                        elementolista.Portrait = text.Split('$')[1].Split(';')[0];
                    }
                    catch (Exception)
                    {
                        elementolista.Portrait = "";
                    }
                    elementolista.MediaElements = new List <PlaylistElement>();
                    listaslocales.Add(elementolista);
                }
            }


            if (listaslocales.Count > 0)
            {
                var adap = new adapterlistaremoto(this, listaslocales.Select(asd => asd.Name).ToList(), listaslocales.Select(asd => asd.Portrait).ToList());
                RunOnUiThread(() => {
                    var parcelable = lista.OnSaveInstanceState();
                    lista.Adapter  = adap;
                    lista.OnRestoreInstanceState(parcelable);
                });
            }
            else
            {
                var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                    "No hay elementos para mostrar.."
                });
                RunOnUiThread(() => {
                    var parcelable = lista.OnSaveInstanceState();
                    lista.Adapter  = adaptadol;
                    lista.OnRestoreInstanceState(parcelable);
                });
            }
        }
        protected override void OnHandleIntent(Android.Content.Intent intent)
        {
            string ipadress = intent.GetStringExtra("ipadre");
            string cogida1  = intent.GetStringExtra("querry1");
            string cogida2  = intent.GetStringExtra("querry2");
            string cogida3  = intent.GetStringExtra("querry3");
            string cogida4  = intent.GetStringExtra("querry4");
            string cogida5  = intent.GetStringExtra("querry5");

            if (cogida1 == "si")
            {
                Mainmenu.gettearinstancia().RunOnUiThread(() =>
                {
                    Mainmenu.gettearinstancia().play.CallOnClick();
                });
            }
            else
            if (cogida2 == "si")
            {
                Mainmenu.gettearinstancia().RunOnUiThread(() =>
                {
                    Mainmenu.gettearinstancia().adelante.CallOnClick();
                });
            }
            else
            if (cogida3 == "si")
            {
                Mainmenu.gettearinstancia().RunOnUiThread(() =>
                {
                    Mainmenu.gettearinstancia().atras.CallOnClick();
                });
            }
            else
            if (cogida4 == "si")
            {
                Mainmenu.gettearinstancia().RunOnUiThread(() =>
                {
                    Mainmenu.gettearinstancia().adelantar.CallOnClick();
                });
            }
            else
            if (cogida5 == "si")
            {
                Mainmenu.gettearinstancia().RunOnUiThread(() =>
                {
                    Mainmenu.gettearinstancia().atrazar.CallOnClick();
                });
            }



            this.StopSelf();
        }
Esempio n. 7
0
 public void LoadUI(bool gpui, bool pause, bool sett, bool mainmenu, bool capture, bool exit, bool GOver, bool SnU, bool GV, bool PV)
 {
     Gpui.GetComponent <Canvas>().enabled      = gpui;
     Pause.GetComponent <Canvas>().enabled     = pause;
     Exit.GetComponent <Canvas>().enabled      = exit;
     Mainmenu.GetComponent <Canvas>().enabled  = mainmenu;
     Capture.GetComponent <Canvas>().enabled   = capture;
     GmOver.GetComponent <Canvas>().enabled    = GOver;
     SavenU.GetComponent <Canvas>().enabled    = SnU;
     Sett.GetComponent <Canvas>().enabled      = sett;
     GalView.GetComponent <Canvas>().enabled   = GV;
     PhotoView.GetComponent <Canvas>().enabled = PV;
 }
        void ok(object sender, EventArgs e)
        {
            if (query == "Fromremote")
            {
                if (listaslocales.Count > 0)
                {
                    var listilla  = new List <PlaylistElement>();
                    var texto     = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + listaslocales[playlistidx].Name);
                    var nombreses = texto.Split('$')[0].Split(';').ToList();
                    var links     = texto.Split('$')[1].Split(';').ToList();

                    var listaelementos = new List <PlaylistElement>();
                    for (int i = 0; i < nombreses.Count; i++)
                    {
                        if (nombreses[i].Trim() != "" || links[i].Trim() != "")
                        {
                            var elemento = new PlaylistElement()
                            {
                                Name = nombreses[i],
                                Link = links[i]
                            };
                            listaelementos.Add(elemento);
                        }
                    }
                    listaslocales[playlistidx].MediaElements = listaelementos;
                    Mainmenu.gettearinstancia()
                    .clientelalistas
                    .Client
                    .Send(Encoding.UTF8.GetBytes(query + "__==__==__" + JsonConvert.SerializeObject(listaslocales[playlistidx])));
                }
                else
                {
                    Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                }
            }
            else
            {
                if (listasremotas.Count > 0)
                {
                    Mainmenu.gettearinstancia()
                    .clientelalistas
                    .Client
                    .Send(Encoding.UTF8.GetBytes(query + "__==__==__" + JsonConvert.SerializeObject(listasremotas[playlistidx])));
                }
                else
                {
                    Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                }
            }
        }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        maincanvas = maincanvas.GetComponent <Canvas>();

        PlayAgain = PlayAgain.GetComponent <Button>();
        Mainmenu  = Mainmenu.GetComponent <Button>();


        scoreText1 = scoreText1.GetComponent <Text> () as Text;

        scoreText2 = scoreText2.GetComponent <Text> () as Text;

        scoretext3 = scoretext3.GetComponent <Text> () as Text;
    }
        public void seteartexto()
        {
            while (detenedor)
            {
                if (Mainmenu.gettearinstancia() != null || YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (isserver)
                    {
                        RunOnUiThread(() =>
                        {
                            textolista.Text  = YoutubePlayerServerActivity.gettearinstancia().lapara.Count + " Elementos en cola";
                            textoserver.Text = YoutubePlayerServerActivity.gettearinstancia().clienteses.Count + " Clientes conectados";
                            if (YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text.Trim() != "")
                            {
                                if (textonombreelemento.Text != YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text)
                                {
                                    textonombreelemento.Text = YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text;
                                }
                            }
                            else
                            {
                                textonombreelemento.Text = "Ningún elemento el reproducción";
                            }
                        });
                    }
                    else

                    {
                        RunOnUiThread(() =>
                        {
                            textolista.Text  = Mainmenu.gettearinstancia().lista.Count + " Elementos en cola";
                            textoserver.Text = "Conectado a " + Mainmenu.gettearinstancia().devicename;
                            if (Mainmenu.gettearinstancia().label.Text.Trim() != "")
                            {
                                if (textonombreelemento.Text != Mainmenu.gettearinstancia().label.Text)
                                {
                                    textonombreelemento.Text = Mainmenu.gettearinstancia().label.Text;
                                }
                            }
                            else
                            {
                                textonombreelemento.Text = "Ningún elemento el reproducción";
                            }
                        });
                    }
                }
                System.Threading.Thread.Sleep(3000);
            }
        }
Esempio n. 11
0
        public ActionResult MainView()
        {
            User_Ser userInfoSer = new User_Ser();

            object id = Session["U@id"];

            if (id == null)
            {
                //return View("Error");
                id = "1";
            }
            Mainmenu mainmenu = userInfoSer.Mainmenu(id.ToString());

            return(View(mainmenu));
        }
        public static void ShowAskIfMenuOrExit(Context ctx)
        {
            var context = (Activity)ctx;

            AlertDialog.Builder ad = new AlertDialog.Builder(ctx);
            ad.SetCancelable(false);
            ad.SetTitle("Advertencia");
            ad.SetIcon(Resource.Drawable.alert);
            ad.SetMessage("Que desea hacer");
            ad.SetNegativeButton("Ir a la pantalla de selección de modos", (obj, evt) =>
            {
                context.StartActivity(new Intent(context, typeof(actsplashscreen)));
                MultiHelper.ExecuteGarbageCollection();
                context.Finish();
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().Finish();
                }
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().Finish();
                }
                if (actividadinicio.gettearinstancia() != null)
                {
                    actividadinicio.gettearinstancia().Finish();
                }
            });
            ad.SetNeutralButton("Salir de la aplicacion", (obj, evt) =>
            {
                context.Finish();
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().Finish();
                }
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().Finish();
                }
                if (actividadinicio.gettearinstancia() != null)
                {
                    actividadinicio.gettearinstancia().Finish();
                }
            });
            ad.SetPositiveButton("Cancelar", (obj, evt) => { });
            ad.Create();
            ad.Show();
        }
        public void cojerstream()
        {
            while (!this.IsDestroyed)
            {
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (YoutubePlayerServerActivity.gettearinstancia().buscando != true)
                    {
                        if (YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text != tv4.Text &&
                            YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text.Trim() != "")
                        {
                            RunOnUiThread(() => tv4.Text = YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => tv4.Text = "Buscando...");
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().buscando == false)
                    {
                        if (Mainmenu.gettearinstancia().label.Text != tv4.Text &&
                            Mainmenu.gettearinstancia().label.Text.Trim() != ""
                            )
                        {
                            RunOnUiThread(() => tv4.Text = Mainmenu.gettearinstancia().label.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => tv4.Text = "Buscando...");
                    }
                }
                else
                {
                }

                if (tv4.Text.Trim() == "" && tv4.Text.Trim() != "No hay elementos en cola")
                {
                    RunOnUiThread(() => { tv4.Text = "No hay elementos en cola"; });
                }
                Thread.Sleep(1000);
            }
        }
Esempio n. 14
0
 private void Update()
 {
     if (Input.anyKeyDown)
     {
         vp.Pause();
     }
     if (vp.isPrepared)
     {
         if (vp.isPlaying)
         {
             Mainmenu.SetActive(false);
         }
         else if (vp.isPaused)
         {
             Mainmenu.SetActive(true);
         }
     }
 }
        public void cojerstream()
        {
            while (detenedor)
            {
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().buscando == false)
                    {
                        if (Mainmenu.gettearinstancia().label.Text != textbox.Text &&
                            Mainmenu.gettearinstancia().label.Text.Trim() != "")
                        {
                            RunOnUiThread(() => textbox.Text = Mainmenu.gettearinstancia().label.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => textbox.Text = "Buscando...");
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().buscando == false)
                    {
                        if (Mainmenu.gettearinstancia().label.Text.Trim() != "" &&
                            textbox.Text != Mainmenu.gettearinstancia().label.Text)
                        {
                            RunOnUiThread(() => textbox.Text = Mainmenu.gettearinstancia().label.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => textbox.Text = "Buscando...");
                    }
                }


                if (textbox.Text.Trim() == "" && textbox.Text.Trim() != "No hay elementos en cola")
                {
                    RunOnUiThread(() => { textbox.Text = "No hay elementos en cola"; });
                }
                Thread.Sleep(500);
            }
        }
Esempio n. 16
0
        public static void SetBackgroundAndRefresh(Activity context)
        {
            bool isOnline = false;

            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                isOnline = false;
            }
            else
            if (Mainmenu.gettearinstancia() != null)
            {
                isOnline = true;
            }
            var thread = new Thread(() =>
            {
                KeepRefreshingBackground(isOnline ? "online" : "", context);
            });

            thread.IsBackground = true;
            thread.Start();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.menuvolumen);
            bajo  = FindViewById <ImageView>(Resource.Id.imageView1);
            medio = FindViewById <ImageView>(Resource.Id.imageView2);
            alto  = FindViewById <ImageView>(Resource.Id.imageView3);
            fondo = FindViewById <LinearLayout>(Resource.Id.fondo1);
            fondo.SetBackgroundColor(Color.ParseColor("#2b2e30"));
            string ip = Intent.GetStringExtra("ipadre");

            this.SetFinishOnTouchOutside(true);

            ////////////////////////////////////////clicks//////////////
            bajo.Click += delegate
            {
                animar(bajo);

                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol0()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 0;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(0f, 0f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumelowrojo);
                }

                this.Finish();
                ;
            };
            medio.Click += delegate
            {
                animar(medio);
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol50()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 50;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(0.5f, 0.5f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumemediumrojo);
                }
                this.Finish();
            };
            alto.Click += delegate
            {
                animar(alto);
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.UTF8.GetBytes("vol100()"));
                }
                else
                if (Clouding_service.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().volumenactual = 100;
                    Clouding_service.gettearinstancia().musicaplayer.SetVolume(1f, 1f);
                    YoutubePlayerServerActivity.gettearinstancia().imgSlideDownAction.SetBackgroundResource(Resource.Drawable.volumehighrojo);
                }

                this.Finish();
            };
        }
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Customsearcher);
            ///////////////////////////////////////declaraciones/////////////////////////////////

            string ip = Intent.GetStringExtra("ipadre").Trim();

            listaimagen = new List <VideoImage>();
            viddeos     = new List <Video>();
            imagelist   = new List <Android.Graphics.Bitmap>();

            texto = FindViewById <EditText>(Resource.Id.editText1);
            //  ImageView botonbuscar = FindViewById<ImageView>(Resource.Id.imageView1);
            ImageView botonreconocer = FindViewById <ImageView>(Resource.Id.imageView2);
            ImageView playpause      = FindViewById <ImageView>(Resource.Id.imageView4);

            tv1    = FindViewById <TextView>(Resource.Id.textView1);
            lineaa = FindViewById <LinearLayout>(Resource.Id.linearlayout0);
            ImageView botonhome = FindViewById <ImageView>(Resource.Id.imageView3);

            lineall2 = FindViewById <LinearLayout>(Resource.Id.linearLayout4);
            listbox  = FindViewById <ListView>(Resource.Id.listView1);
            //  progresooo = FindViewById<ProgressBar>(Resource.Id.progresss);

            UiHelper.SetBackgroundAndRefresh(this);
            var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                "No hay elementos para mostrar.."
            });

            RunOnUiThread(() => {
                var parcelable  = listbox.OnSaveInstanceState();
                listbox.Adapter = adaptadol;
                listbox.OnRestoreInstanceState(parcelable);
            });
            ////////////////////////////////////////////////miselaneo///////////////////////////////////
            color      = Intent.GetStringExtra("color");
            nombreses  = new List <string>();
            linkeses   = new List <string>();
            autoreses  = new List <string>();
            duraciones = new List <string>();
            //   lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#4f5459"));
            //  animar2(lineall2);
            tv1.Selected = true;


            if (color.Trim() != "none")
            {
                //  lineaa.SetBackgroundColor(Android.Graphics.Color.ParseColor(color.Trim()));
            }

            if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache"))
            {
                Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache");
            }


            if (!Directory.Exists(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser"))
            {
                Directory.CreateDirectory(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser");
            }
            else
            {
            }

            /////////////////////////////////////////////////threads///////////////////////////////////////////////
            //  lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30"));
            procc = new Thread(new ThreadStart(cojerstream));
            procc.Start();

            var procc2 = new Thread(new ThreadStart(cargardesdecache));

            procc2.Start();
            ////////////////////////////////////////events//////////////////////////////////////////////////////
            texto.KeyPress += (aaxx, e) =>
            {
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    // Code executed when the enter key is pressed down

                    if (buscando == false)
                    {
                        termino = texto.Text;
                        //  Toast.MakeText(this, "Buscando.. por favor espere", ToastLength.Long);
                        foreach (string aa in Directory.GetFiles(Android.OS.Environment.ExternalStorageDirectory + "/.gr3cache/webbrowser"))
                        {
                            File.Delete(aa);
                        }
                        MultiHelper.ExecuteGarbageCollection();
                        Thread proc = new Thread(new ThreadStart(buscar));
                        proc.Start();
                    }
                }
                else
                {
                    e.Handled = false;
                }
            };

            botonhome.Click += delegate {
                animar(botonhome);

                procc.Abort();

                MultiHelper.ExecuteGarbageCollection();
                this.Finish();
            };

            playpause.Click += delegate
            {
                animar(playpause);
                if (Mainmenu.gettearinstancia() != null)
                {
                    Mainmenu.gettearinstancia().play.PerformClick();
                }
                else
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    YoutubePlayerServerActivity.gettearinstancia().imgPlay.PerformClick();
                }
            };

            botonreconocer.Click += delegate
            {
                animar(botonreconocer);
                try {
                    var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 10000);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                    StartActivityForResult(voiceIntent, voz);
                } catch (Exception)
                {
                }
            };

            listbox.ItemClick += (easter, sender) =>
            {
                if (nombreses.Count > 0)
                {
                    if (sender.Position >= 0)
                    {
                        Intent intentar = new Intent(this, typeof(customdialogact));
                        string ipadree  = Intent.GetStringExtra("ipadre");
                        intentar.PutExtra("ipadress", ipadree);
                        intentar.PutExtra("imagen", "http://i.ytimg.com/vi/" + linkeses[sender.Position].Split('=')[1] + "/mqdefault.jpg");
                        intentar.PutExtra("url", linkeses[sender.Position]);
                        intentar.PutExtra("titulo", nombreses[sender.Position]);
                        intentar.PutExtra("color", color);
                        StartActivity(intentar);
                    }
                }
            };



            // Create your application here
        }
Esempio n. 19
0
        public void cojerstream()
        {
            while (!this.IsDestroyed)
            {
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (YoutubePlayerServerActivity.gettearinstancia().buscando != true)
                    {
                        if (YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text != textboxtitulo.Text &&
                            YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text.Trim() != "")
                        {
                            RunOnUiThread(() => textboxtitulo.Text = YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => textboxtitulo.Text = "Buscando...");
                    }

                    if (textboxtitulo.Text.Trim() == "" && textboxtitulo.Text.Trim() != "No hay elementos en cola")
                    {
                        RunOnUiThread(() => { textboxtitulo.Text = "No hay elementos en cola"; });
                    }



                    if (YoutubePlayerServerActivity.gettearinstancia().clienteses.Count > 0)
                    {
                        try
                        {
                            var dummynames = YoutubePlayerServerActivity.gettearinstancia()
                                             .clienteses.Select(ax => ((IPEndPoint)ax.Client.RemoteEndPoint).Address.ToString())
                                             .Where(aax => aax != YoutubePlayerServerActivity.gettearinstancia().ipAddress.Trim()).Distinct()
                                             .ToList();
                            var dummylinks = dummynames.Select(ax => ax + "=sdss").ToList();

                            RunOnUiThread(() =>
                            {
                                if (dummynames.Count != countold)
                                {
                                    countold = dummynames.Count;
                                    adapterlistaremoto ada = new adapterlistaremoto(this, dummynames, dummylinks, null, Resource.Drawable.remotecontrolbuttons);

                                    var parcelable = lista.OnSaveInstanceState();
                                    lista.Adapter  = ada;
                                    lista.OnRestoreInstanceState(parcelable);
                                }
                            });
                        }
                        catch (Exception) { }
                    }
                    else
                    {
                        RunOnUiThread(() => {
                            var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                                "No hay dispositivos conectados.."
                            });

                            var parcelable = lista.OnSaveInstanceState();
                            lista.Adapter  = adaptadol;
                            lista.OnRestoreInstanceState(parcelable);
                        });
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().label.Text != textboxtitulo.Text)
                    {
                        RunOnUiThread(() => textboxtitulo.Text = Mainmenu.gettearinstancia().label.Text);
                    }
                }
                else
                {
                }


                Thread.Sleep(1000);
            }
        }
Esempio n. 20
0
        public void cojerstreamlocal()
        {
            bool cojioto = false;

            string[] listica;
            var      strim = clientelocal.GetStream();

            byte[] elbuffer          = new byte[120000];
            int    o                 = 0;
            bool   enviomensaje      = false;
            string lalistacompletita = "";

            while (parador)
            {
                if (!enviomensaje)
                {
                    clientelocal.Client.Send(Encoding.UTF8.GetBytes("recall()"));
                    enviomensaje = true;
                }
                while (strim.DataAvailable)
                {
                    o = strim.Read(elbuffer, 0, elbuffer.Length);
                    lalistacompletita += Encoding.UTF8.GetString(elbuffer, 0, o);
                    cojioto            = true;
                }
                if (cojioto == true && lalistacompletita.Trim() != "")
                {
                    listica = lalistacompletita.Split(';');
                    if (listica[0] == "caratula()><")
                    {
                        lalistacompletita = "";
                    }
                    else
                    if (listica[0] == "links()><")
                    {
                        listalinks = listica.ToList();
                        listalinks.RemoveAt(0);
                        lalistacompletita = "";
                        Thread proc = new Thread(new ThreadStart(enviarlistitaaa));
                        proc.IsBackground = true;
                        proc.Start();
                    }
                    else
                    if (lalistacompletita.Length > 0)
                    {
                        listanombres      = listica.ToList();
                        lalistacompletita = "";
                    }

                    cojioto  = false;
                    elbuffer = new byte[120000];
                    o        = 0;
                }


                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (YoutubePlayerServerActivity.gettearinstancia().buscando == false)
                    {
                        if (YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text.Trim() != "" &&
                            tvnombrecancion.Text != YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text)
                        {
                            RunOnUiThread(() => tvnombrecancion.Text = YoutubePlayerServerActivity.gettearinstancia().tvTitle.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => tvnombrecancion.Text = "Buscando...");
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().buscando == false)
                    {
                        if (Mainmenu.gettearinstancia().label.Text.Trim() != "" &&
                            tvnombrecancion.Text != Mainmenu.gettearinstancia().label.Text)
                        {
                            RunOnUiThread(() => tvnombrecancion.Text = Mainmenu.gettearinstancia().label.Text);
                        }
                    }
                    else
                    {
                        RunOnUiThread(() => tvnombrecancion.Text = "Buscando...");
                    }
                }


                if (tvnombrecancion.Text.Trim() == "" && tvnombrecancion.Text.Trim() != "No hay elementos en cola")
                {
                    RunOnUiThread(() => { tvnombrecancion.Text = "No hay elementos en cola"; });
                }


                Thread.Sleep(200);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.dialogolistas);
            var          inst            = Reproducirlistaact.gettearinstancia();
            ImageView    fondo           = FindViewById <ImageView>(Resource.Id.fondo1);
            ImageView    imgaccion       = FindViewById <ImageView>(Resource.Id.imagenaccion);
            TextView     textoaccion     = FindViewById <TextView>(Resource.Id.textView3);
            TextView     textoheader     = FindViewById <TextView>(Resource.Id.textView1);
            LinearLayout botonreproducir = FindViewById <LinearLayout>(Resource.Id.imageView3);
            LinearLayout botonaccion     = FindViewById <LinearLayout>(Resource.Id.imageView2);
            LinearLayout botoninfo       = FindViewById <LinearLayout>(Resource.Id.imageView5);

            this.SetFinishOnTouchOutside(true);
            textoheader.Text = Intent.GetStringExtra("nombrelista");
            Glide.With(this)
            .Load("http://i.ytimg.com/vi/" + Intent.GetStringExtra("portada").Split('=')[1] + "/mqdefault.jpg")
            .Into(fondo);
            var query = Intent.GetStringExtra("querry");

            if (query == "Fromlocal")
            {
                imgaccion.SetBackgroundResource(Resource.Drawable.downloadbutton);
                textoaccion.Text = "Guardar lista";
            }
            else
            {
                imgaccion.SetBackgroundResource(Resource.Drawable.upload);
                textoaccion.Text = "Enviar lista";
            }
            var arch    = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + inst.listaslocales[inst.playlistidx].Name);
            var counter = arch.Split('$')[1].Split(';').ToList();

            if (counter.Count > 0)
            {
                if (counter[0].Trim() == "")
                {
                    this.Finish();
                    Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                }
            }
            else
            {
                this.Finish();
                Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
            }
            botonaccion.Click += delegate
            {
                new Thread(() =>
                {
                    if (query == "Fromlocal")
                    {
                        Mainmenu.gettearinstancia().playlistreceived = false;
                        RunOnUiThread(() =>
                        {
                            new Android.Support.V7.App.AlertDialog.Builder(this)
                            .SetTitle("Advertencia")
                            .SetMessage("Desea guardar la lista de reproduccion remota: " + Intent.GetStringExtra("nombrelista") + "??\n NOTA:\nSi hay una lista con este mismo nombre sera sustituida por esta")
                            .SetPositiveButton("Si", (aa, aaa) =>
                            {
                                new Thread(() =>
                                {
                                    var elementos = inst.listasremotas[inst.playlistidx];
                                    var nombreses = string.Join(";", elementos.MediaElements.Select(axx => axx.Name).ToArray()) + ";";
                                    var linkeses  = string.Join(";", elementos.MediaElements.Select(axx => axx.Link).ToArray()) + ";";
                                    var archi     = File.CreateText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + Intent.GetStringExtra("nombrelista"));
                                    archi.Write(nombreses + "$" + linkeses);
                                    archi.Close();
                                    RunOnUiThread(() => Toast.MakeText(this, "Lista guardada exitosamente", ToastLength.Long).Show());
                                }).Start();
                            })
                            .SetNegativeButton("No", (aa, ff) => { })
                            .Create()
                            .Show();
                        });
                    }
                    else
                    {
                        var listilla  = new List <PlaylistElement>();
                        var texto     = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + inst.listaslocales[inst.playlistidx].Name);
                        var nombreses = texto.Split('$')[0].Split(';').ToList();
                        var links     = texto.Split('$')[1].Split(';').ToList();

                        var listaelementos = new List <PlaylistElement>();
                        for (int i = 0; i < nombreses.Count; i++)
                        {
                            if (nombreses[i].Trim() != "" && links[i].Trim() != "")
                            {
                                var elemento = new PlaylistElement()
                                {
                                    Name = nombreses[i],
                                    Link = links[i]
                                };
                                listaelementos.Add(elemento);
                            }
                        }
                        inst.listaslocales[inst.playlistidx].MediaElements = listaelementos;
                        Mainmenu.gettearinstancia()
                        .clientelalistas
                        .Client
                        .Send(Encoding.UTF8.GetBytes("Receive__==__==__" + JsonConvert.SerializeObject(inst.listaslocales[inst.playlistidx])));
                        RunOnUiThread(() => Toast.MakeText(this, "Lista enviada exitosamente", ToastLength.Long).Show());



                        RunOnUiThread(() => this.Finish());
                    }
                }).Start();
            };

            botoninfo.Click += delegate
            {
                new Thread(() =>
                {
                    if (query == "Fromremote")
                    {
                        if (inst.listaslocales.Count > 0)
                        {
                            var listilla  = new List <PlaylistElement>();
                            var texto     = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + inst.listaslocales[inst.playlistidx].Name);
                            var nombreses = texto.Split('$')[0].Split(';').ToList();
                            var links     = texto.Split('$')[1].Split(';').ToList();

                            var listaelementos = new List <PlaylistElement>();
                            for (int i = 0; i < nombreses.Count; i++)
                            {
                                if (nombreses[i].Trim() != "" || links[i].Trim() != "")
                                {
                                    var elemento = new PlaylistElement()
                                    {
                                        Name = nombreses[i],
                                        Link = links[i]
                                    };
                                    listaelementos.Add(elemento);
                                }
                            }
                            RunOnUiThread(() =>
                            {
                                ListView lista           = new ListView(this);
                                adapterlistaremoto adapt = new adapterlistaremoto(this, listaelementos.Select(ax => ax.Name).ToList(), listaelementos.Select(ax => ax.Link).ToList());
                                lista.Adapter            = adapt;

                                new AlertDialog.Builder(this)
                                .SetTitle("Elementos de esta lista de reproducción")
                                .SetView(lista).SetPositiveButton("Entendido!", (dd, fgf) => { })
                                .Create()
                                .Show();
                            });
                        }
                    }
                    else
                    {
                        var elementos = inst.listasremotas[inst.playlistidx];
                        RunOnUiThread(() =>
                        {
                            ListView lista           = new ListView(this);
                            adapterlistaremoto adapt = new adapterlistaremoto(this, elementos.MediaElements.Select(ax => ax.Name).ToList(), elementos.MediaElements.Select(ax => ax.Link).ToList());
                            lista.Adapter            = adapt;
                            new AlertDialog.Builder(this)
                            .SetTitle("Elementos de esta lista de reproducción")
                            .SetView(lista).SetPositiveButton("Entendido!", (dd, fgf) => { })
                            .Create()
                            .Show();
                        });
                    }
                }).Start();
            };

            botonreproducir.Click += delegate {
                if (query == "Fromremote")
                {
                    if (inst.listaslocales.Count > 0)
                    {
                        var listilla  = new List <PlaylistElement>();
                        var texto     = File.ReadAllText(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath + "/gr3playerplaylist/" + inst.listaslocales[inst.playlistidx].Name);
                        var nombreses = texto.Split('$')[0].Split(';').ToList();
                        var links     = texto.Split('$')[1].Split(';').ToList();

                        var listaelementos = new List <PlaylistElement>();
                        for (int i = 0; i < nombreses.Count; i++)
                        {
                            if (nombreses[i].Trim() != "" && links[i].Trim() != "")
                            {
                                var elemento = new PlaylistElement()
                                {
                                    Name = nombreses[i],
                                    Link = links[i]
                                };
                                listaelementos.Add(elemento);
                            }
                        }
                        inst.listaslocales[inst.playlistidx].MediaElements = listaelementos;
                        Mainmenu.gettearinstancia()
                        .clientelalistas
                        .Client
                        .Send(Encoding.UTF8.GetBytes(query + "__==__==__" + JsonConvert.SerializeObject(inst.listaslocales[inst.playlistidx])));
                    }
                    else
                    {
                        Toast.MakeText(this, "No hay listas de reproduccion", ToastLength.Long).Show();
                    }
                }
                else
                {
                    if (inst.listasremotas.Count > 0)
                    {
                        Mainmenu.gettearinstancia()
                        .clientelalistas
                        .Client
                        .Send(Encoding.UTF8.GetBytes(query + "__==__==__" + JsonConvert.SerializeObject(inst.listasremotas[inst.playlistidx])));
                    }
                    else
                    {
                        Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                    }
                }



                this.Finish();
            };



            // Create your application here
        }
Esempio n. 22
0
 void _start()
 {
     LobbyManager.SetActive(true);
     Mainmenu.SetActive(false);
 }
Esempio n. 23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.eliminardialog);

            TextView texto = FindViewById <TextView>(Resource.Id.textView1);

            imagenview = FindViewById <ImageView>(Resource.Id.imageView1);
            LinearLayout agregar = FindViewById <LinearLayout>(Resource.Id.imageView2);

            buscar = FindViewById <LinearLayout>(Resource.Id.imageView3);
            ImageView    volver    = FindViewById <ImageView>(Resource.Id.imageView4);
            LinearLayout lineall2  = FindViewById <LinearLayout>(Resource.Id.linearLayout4);
            LinearLayout lineaa    = FindViewById <LinearLayout>(Resource.Id.linearlayout0);
            LinearLayout descargar = FindViewById <LinearLayout>(Resource.Id.imageView5);
            LinearLayout addlista  = FindViewById <LinearLayout>(Resource.Id.imageView6);

            fondo = FindViewById <ImageView>(Resource.Id.fondo1);
            //   animar2(lineaa);
            texto.Selected = true;

            buscar.Visibility = ViewStates.Visible;
            string colol = Intent.GetStringExtra("color");

            url = Intent.GetStringExtra("url");
            string posicion = Intent.GetStringExtra("index");

            url = "https://www.youtube.com/watch?v=" + url.Split('=')[1];
            if (colol.Trim() != "none")
            {
                // lineaa.SetBackgroundColor(Color.ParseColor(colol));
                if (colol == "Black")
                {
                    //   lineall2.SetBackgroundColor(Android.Graphics.Color.DarkGray);
                }
                else
                {
                    //  lineall2.SetBackgroundColor(Android.Graphics.Color.Black);
                };
            }
            imagem = Intent.GetStringExtra("imagen");
            string titulo = Intent.GetStringExtra("titulo");

            texto.Text = titulo;


            this.SetFinishOnTouchOutside(true);

            animar2(lineall2);

            proc = new Thread(new ThreadStart(ponerimagen));
            proc.Start();
            volver.Click += delegate
            {
                animar(volver);


                this.Finish();
            };
            addlista.Click += delegate
            {
                animar(addlista);
                Intent intentar = new Intent(this, typeof(actividadagregarlistahecha));
                intentar.PutExtra("nombrevid", titulo);
                intentar.PutExtra("linkvid", url);
                StartActivity(intentar);
                this.Finish();
            };
            agregar.Click += delegate
            {
                animar(agregar);



                if (YoutubePlayerServerActivity.gettearinstancia() == null)
                {
                    if (Mainmenu.gettearinstancia().clientela.Connected == true)
                    {
                        Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes("eliminarelemento()"));
                        Thread.Sleep(250);
                        Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes(posicion));
                    }
                }
                else
                {
                    new Thread(() =>
                    {
                        YoutubePlayerServerActivity.gettearinstancia().eliminarelementodireckt(int.Parse(posicion));
                    }).Start();
                }



                this.Finish();
            };
            descargar.Click += delegate
            {
                animar(descargar);
                Intent intento = new Intent(this, typeof(actdownloadcenterofflinedialog));
                intento.PutExtra("ip", "localhost");
                intento.PutExtra("zelda", url);
                intento.PutExtra("color", colol);
                StartActivity(intento);
                this.Finish();
            };
            buscar.Click += delegate
            {
                animar(buscar);



                if (YoutubePlayerServerActivity.gettearinstancia() == null)
                {
                    if (Mainmenu.gettearinstancia().clientela.Connected == true)
                    {
                        Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes("pedirindice()"));
                        Thread.Sleep(250);
                        Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes(posicion));
                    }
                }
                else
                {
                    new Thread(() =>
                    {
                        YoutubePlayerServerActivity.gettearinstancia().reproddelistadireckt(int.Parse(posicion));
                    }).Start();
                }



                this.Finish();
            };

            // Create your application here
        }
        public void cargarresults()
        {
            try
            {
                RunOnUiThread(() =>
                {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    alerta = new ProgressDialog(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                    alerta.SetTitle("Buscando videos sugeridos");
                    alerta.SetMessage("Por favor espere...");
                    alerta.SetCancelable(false);
                    alerta.Create();
                    alerta.Show();
                });

                YoutubeSearch.VideoSearch             buscar  = new YoutubeSearch.VideoSearch();
                List <YoutubeSearch.VideoInformation> results = new List <YoutubeSearch.VideoInformation>();
                if (YoutubePlayerServerActivity.gettearinstancia() != null)
                {
                    if (YoutubePlayerServerActivity.gettearinstancia().sugerencias.Count > 0)
                    {
                        results = YoutubePlayerServerActivity.gettearinstancia().sugerencias;
                    }
                    else
                    {
                        results = buscar.SearchQuery("", 1);
                        YoutubePlayerServerActivity.gettearinstancia().sugerencias = results;
                    }
                }
                else
                if (Mainmenu.gettearinstancia() != null)
                {
                    if (Mainmenu.gettearinstancia().sugerencias.Count > 0)
                    {
                        results = Mainmenu.gettearinstancia().sugerencias;
                    }
                    else
                    {
                        results = buscar.SearchQuery("", 1);
                        Mainmenu.gettearinstancia().sugerencias = results;
                    }
                }



                List <PlaylistElement> listafake = new List <PlaylistElement>();
                foreach (var data in results)
                {
                    listafake.Add(new PlaylistElement
                    {
                        Name = WebUtility.HtmlDecode(data.Title),
                        Link = data.Url
                    });
                }
                RunOnUiThread(() =>
                {
                    adaptadorcartas adap = new adaptadorcartas(listafake, this);
                    adap.ItemClick      += (aa, aaa) =>
                    {
                        RunOnUiThread(() =>
                        {
                            var elemento   = listafake[aaa.Position];
                            Intent intento = new Intent(this, typeof(customdialogact));

                            intento.PutExtra("url", elemento.Link);
                            intento.PutExtra("titulo", elemento.Name);
                            intento.PutExtra("imagen", "http://i.ytimg.com/vi/" + elemento.Link.Split('=')[1] + "/mqdefault.jpg");
                            StartActivity(intento);
                        });
                    };
                    listasugerencias.SetAdapter(adap);
                    alerta.Dismiss();

                    if (listafake.Count > 0)
                    {
                        secciones[3].Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        secciones[3].Visibility = ViewStates.Gone;
                    }
                });
            }
            catch (Exception)
            {
                RunOnUiThread(() => alerta.Dismiss());
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                SetContentView(Resource.Layout.layoutinicio);
            }
            else
            {
                SetContentView(Resource.Layout.layoutinicioremote);
            }
            ins = this;
            ImageView botonreconocer = FindViewById <ImageView>(Resource.Id.imageView2);

            texto            = FindViewById <EditText>(Resource.Id.editText1);
            listamas         = FindViewById <RecyclerView>(Resource.Id.listamas);
            listaultimos     = FindViewById <RecyclerView>(Resource.Id.listaultimos);
            listafavoritos   = FindViewById <RecyclerView>(Resource.Id.listafavoritos);
            listasugerencias = FindViewById <RecyclerView>(Resource.Id.listasugerencias);
            List <PlaylistElement> listafake = new List <PlaylistElement>();
            var imagentipoconex = FindViewById <ImageView>(Resource.Id.tipoconexion);

            textoserver         = FindViewById <TextView>(Resource.Id.textoconexion);
            textonombreelemento = FindViewById <TextView>(Resource.Id.textoreprodactual);
            textolista          = FindViewById <TextView>(Resource.Id.textoencola);
            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar));
            secciones = new List <LinearLayout>()
            {
                FindViewById <LinearLayout>(Resource.Id.secion1),
                FindViewById <LinearLayout>(Resource.Id.secion2),
                FindViewById <LinearLayout>(Resource.Id.secion3),
                FindViewById <LinearLayout>(Resource.Id.secion4)
            };

            foreach (var ax in secciones)
            {
                ax.Visibility = ViewStates.Gone;
            }


            SupportActionBar.Title = "Inicio";
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            itemsm = FindViewById <NavigationView>(Resource.Id.content_frame);
            sidem  = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.hambur);
            textolista.Selected          = true;
            textoserver.Selected         = true;
            textonombreelemento.Selected = true;
            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                isserver      = true;
                Diccfavoritos = YoutubePlayerServerActivity.gettearinstancia().listafavoritos;
                favoritos     = Diccfavoritos.Values.ToList();

                objetohistorial = YoutubePlayerServerActivity.gettearinstancia().objetohistorial;
                imagentipoconex.SetBackgroundResource(Resource.Drawable.remotecontrolbuttons);
            }
            else
            {
                isserver      = false;
                Diccfavoritos = Mainmenu.gettearinstancia().listafavoritos;
                favoritos     = Diccfavoritos.Values.ToList();
                imagentipoconex.SetBackgroundResource(Resource.Drawable.antena);
                objetohistorial = Mainmenu.gettearinstancia().objetohistorial;
            }

            if (objetohistorial == null)
            {
                objetohistorial = new History()
                {
                    Videos = new List <PlaylistElement>(),
                    Links  = new Dictionary <string, int>()
                }
            }
            ;

            if (favoritos == null)
            {
                favoritos = new List <PlaylistElement>();
            }

            if (Diccfavoritos == null)
            {
                Diccfavoritos = new Dictionary <string, PlaylistElement>();
            }



            favoritos.Reverse();
            recargarhistorial();

            new System.Threading.Thread(() =>
            {
                seteartexto();
            }).Start();



            /*    for (int i = 0; i < 20; i++)
             *  {
             *
             *      listafake.Add(new playlistelements
             *      {
             *          nombre = "klk wawawa",
             *          link = "https://www.youtube.com/watch?v=4G40N0G6lzE"
             *      });
             *  }
             */



            LinearLayoutManager enlinea = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listamas.SetLayoutManager(enlinea);
            LinearLayoutManager enlinea2 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listaultimos.SetLayoutManager(enlinea2);
            LinearLayoutManager enlinea3 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listafavoritos.SetLayoutManager(enlinea3);
            LinearLayoutManager enlinea4 = new LinearLayoutManager(this, LinearLayoutManager.Horizontal, false);

            listasugerencias.SetLayoutManager(enlinea4);

            adaptadorcartas adap = new adaptadorcartas(listafake, this);

            //   listafavoritos.SetAdapter(adap);
            if (YoutubePlayerServerActivity.gettearinstancia() != null)
            {
                if (System.IO.File.Exists(Constants.CachePath + "/backupplaylist.json") && !YoutubePlayerServerActivity.gettearinstancia().backupprompted)
                {
                    var snack = Snackbar.Make(FindViewById <View>(Android.Resource.Id.Content), "Desea cargar los elementos que estaba reproduciendo la vez anterior?", Snackbar.LengthIndefinite);
                    snack.SetAction("Cargar", (o) =>
                    {
                        YoutubePlayerServerActivity.gettearinstancia().loadbackupplaylist();
                        YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                    });
                    snack.SetDuration(6000);
                    snack.Show();
                    Task.Delay(6000).ContinueWith(delegate
                    {
                        YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                    });


                    /* new Android.Support.V7.App.AlertDialog.Builder(this)
                     * .SetTitle("Advertencia")
                     * .SetMessage("Desea cargar los elementos que estaba reproduciendo la vez anterior?")
                     * .SetPositiveButton("Si", (aa, aaa) =>
                     * {
                     * mainmenu_Offline.gettearinstancia().loadbackupplaylist();
                     * mainmenu_Offline.gettearinstancia().backupprompted = true;
                     *
                     * })
                     * .SetNegativeButton("No", (afaa, aaffa) =>
                     * {
                     *
                     * mainmenu_Offline.gettearinstancia().backupprompted = true;
                     *
                     * })
                     * .SetCancelable(false)
                     * .Create()
                     * .Show();*/
                }
                else
                {
                    YoutubePlayerServerActivity.gettearinstancia().backupprompted = true;
                }
            }

            FindViewById <CardView>(Resource.Id.cartainicio).Click += delegate
            {
                this.Finish();
            };



            texto.KeyPress += (aaxx, e) =>
            {
                if (e.Event.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter)
                {
                    // Code executed when the enter key is pressed down

                    new System.Threading.Thread(() =>
                    {
                        buscaryabrir(texto.Text);
                    }).Start();
                }
                else
                {
                    e.Handled = false;
                }
            };



            botonreconocer.Click += delegate
            {
                animar(botonreconocer);
                try
                {
                    var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 500);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 10000);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);
                    voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                    StartActivityForResult(voiceIntent, 7);
                }
                catch (Exception)
                {
                }
            };
            itemsm.NavigationItemSelected += (sender, e) =>
            {
                switch (e.MenuItem.TitleFormatted.ToString())
                {
                case "Reproductor":
                    this.Finish();
                    break;

                case "Control remoto":
                    this.Finish();
                    break;

                case "Navegador personalizado":
                    Intent intento = new Intent(this, typeof(customsearcheract));
                    intento.PutExtra("ipadre", "localhost");
                    intento.PutExtra("color", "black");
                    StartActivity(intento);
                    break;

                case "Conectar clientes":


                    Intent intetno = new Intent(this, typeof(qrcodigoact));
                    intetno.PutExtra("ipadre", "localhost");
                    StartActivity(intetno);


                    break;

                case "Listas de reproduccion":

                    if (YoutubePlayerServerActivity.gettearinstancia() != null)
                    {
                        Intent elint = new Intent(this, typeof(menulistaoffline));
                        elint.PutExtra("ipadre", "localhost");
                        StartActivity(elint);
                    }
                    else
                    {
                        var con = Mainmenu.gettearinstancia();
                        if (con.compatible)
                        {
                            if (con.jsonlistasremotas.Trim() != "")
                            {
                                Intent intentoo = new Intent(this, typeof(Reproducirlistaact));
                                intentoo.PutExtra("ip", "localhost");
                                StartActivity(intentoo);
                            }
                            else
                            {
                                Toast.MakeText(this, "Aun no se han recibido las listas de el servidor...", ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, "Su servidor no es compatible con esta version", ToastLength.Long).Show();
                        }
                    }

                    break;
                }
                e.MenuItem.SetChecked(false);
                e.MenuItem.SetChecked(false);
                sidem.CloseDrawers();
            };
        }
        public void buscaryabrir(string termino)
        {
            RunOnUiThread(() =>
            {
#pragma warning disable CS0618 // El tipo o el miembro est�n obsoletos
                alerta = new ProgressDialog(this);
#pragma warning restore CS0618 // El tipo o el miembro est�n obsoletos
#pragma warning restore CS0618 // El tipo o el miembro est�n obsoletos
                alerta.SetCanceledOnTouchOutside(false);
                alerta.SetCancelable(false);
                alerta.SetTitle("Buscando resultados...");
                alerta.SetMessage("Por favor espere");
                alerta.Show();
            });
            try
            {
                //  RunOnUiThread(() => progreso.Progress = 50);
                VideoSearch src     = new VideoSearch();
                var         results = src.SearchQuery(termino, 1);
                if (results.Count > 0)
                {
                    var listatitulos = results.Select(ax => WebUtility.HtmlDecode(RemoveIllegalPathCharacters(ax.Title.Replace("&quot;", "").Replace("&amp;", "")))).ToList();
                    var listalinks   = results.Select(ax => ax.Url).ToList();
                    RunOnUiThread(() =>
                    {
                        ListView lista   = new ListView(this);
                        lista.ItemClick += (o, e) =>
                        {
                            var posicion    = 0;
                            posicion        = e.Position;
                            Intent intentoo = new Intent(this, typeof(customdialogact));

                            intentoo.PutExtra("index", posicion.ToString());
                            intentoo.PutExtra("color", "DarkGray");
                            intentoo.PutExtra("titulo", listatitulos[posicion]);
                            if (!isserver)
                            {
                                intentoo.PutExtra("ipadress", Mainmenu.gettearinstancia().ip);
                            }
                            else
                            {
                                intentoo.PutExtra("ipadress", "localhost");
                            }

                            intentoo.PutExtra("url", listalinks[posicion]);
                            intentoo.PutExtra("imagen", @"https://i.ytimg.com/vi/" + listalinks[posicion].Split('=')[1] + "/mqdefault.jpg");
                            StartActivity(intentoo);
                        };
                        adapterlistaremoto adapt = new adapterlistaremoto(this, listatitulos, listalinks);
                        lista.Adapter            = adapt;

                        new Android.App.AlertDialog.Builder(this)
                        .SetTitle("Resultados de la busqueda")
                        .SetView(lista).SetPositiveButton("Cerrar", (dd, fgf) => { })
                        .Create()
                        .Show();
                    });
                }
                RunOnUiThread(() =>
                {
                    alerta.Dismiss();
                });
            }
            catch (Exception)
            {
                RunOnUiThread(() => Toast.MakeText(this, "No se encotraron resultados", ToastLength.Long).Show());
                alerta.Dismiss();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.Downloadcenter);


            base.OnCreate(savedInstanceState);
            ISharedPreferences       prefs      = Application.Context.GetSharedPreferences("Settings", FileCreationMode.Private);
            ISharedPreferencesEditor prefEditor = prefs.Edit();

            //////////////////////////////////TCpclientconnect/////////////

            string ip = Intent.GetStringExtra("ip");

            linkvid = Intent.GetStringExtra("zelda");
            colores = Intent.GetStringExtra("color");

            Intent.Extras.Clear();
            //////////////////////////////////DEclaraciones////////////////
            RadioGroup radio1    = FindViewById <RadioGroup>(Resource.Id.radioGroup1);
            RadioGroup radio2    = FindViewById <RadioGroup>(Resource.Id.radioGroup2);
            ImageView  iv1       = FindViewById <ImageView>(Resource.Id.imageView1);
            ImageView  iv2       = FindViewById <ImageView>(Resource.Id.imageView2);
            ImageView  playpause = FindViewById <ImageView>(Resource.Id.imageView7);

            iv3 = FindViewById <ImageView>(Resource.Id.imageView4);
            ImageView iv4 = FindViewById <ImageView>(Resource.Id.imageView3);

            tv1 = FindViewById <TextView>(Resource.Id.textView1);


            tv3  = FindViewById <TextView>(Resource.Id.textView5);
            tv4  = FindViewById <TextView>(Resource.Id.textView6);
            seek = FindViewById <SeekBar>(Resource.Id.seekBar1);
            RadioButton rb1 = FindViewById <RadioButton>(Resource.Id.radioButton1);
            RadioButton rb2 = FindViewById <RadioButton>(Resource.Id.radioButton2);
            RadioButton rb3 = FindViewById <RadioButton>(Resource.Id.radioButton3);
            RadioButton rb4 = FindViewById <RadioButton>(Resource.Id.radioButton4);
            RadioButton rb5 = FindViewById <RadioButton>(Resource.Id.radioButton5);
            RadioButton rb6 = FindViewById <RadioButton>(Resource.Id.radioButton6);

            lineall2   = FindViewById <LinearLayout>(Resource.Id.linearLayout2);
            llayout    = FindViewById <LinearLayout>(Resource.Id.linearlayout0);
            retroceder = FindViewById <ImageView>(Resource.Id.imageView5);
            adelantar  = FindViewById <ImageView>(Resource.Id.imageView6);

            UiHelper.SetBackgroundAndRefresh(this);
            ///////////////////////////////////////mp3load+durationbarload//////////////////////
            Thread tree4 = new Thread(new ThreadStart(mp3play));

            tree4.Start();
            trer = new Thread(new ThreadStart(cojerstream));
            trer.Start();

            ///   lineall2.SetBackgroundColor(Android.Graphics.Color.Black);
            //     animar2(lineall2);
            tv4.Selected = true;
            /////////////////////////////miselaneo///////////////////////////////////////////////

            iv3.SetBackgroundResource(Resource.Drawable.playbutton2);
            if (colores != "none" && colores != "" && colores != " ")
            {
                /// llayout.SetBackgroundColor(Android.Graphics.Color.ParseColor(colores));
            }


            iv3.SetBackgroundResource(Resource.Drawable.playbutton2);

            //  lineall2.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30"));
            rutadedescarga = prefs.GetString("rutadescarga", null);
            ///////////////////////////////////events//////////////////////////////////////

            seek.ProgressChanged += (aaa, aaaa) =>
            {
                if (aaaa.FromUser)
                {
                    musicaplayer.SeekTo(seek.Progress);
                }
            };
            playpause.Click += delegate
            {
                animar(playpause);
                Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.ASCII.GetBytes("playpause()"));
            };
            iv1.Click += delegate
            {
                animar(iv1);
                if (rb1.Checked == true)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.ASCII.GetBytes("descvid360()"));
                }
                else
                if (rb2.Checked == true)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.ASCII.GetBytes("descvid720()"));
                }
                else
                if (rb3.Checked == true)
                {
                    Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.ASCII.GetBytes("descmp3()"));
                }
            };
            adelantar.Click += delegate
            {
                animar(adelantar);
                musicaplayer.Start();
                musicaplayer.SeekTo(Convert.ToInt32(musicaplayer.CurrentPosition + musicaplayer.Duration * 0.10));
            };
            retroceder.Click += delegate
            {
                animar(retroceder);
                musicaplayer.Start();
                musicaplayer.SeekTo(Convert.ToInt32(musicaplayer.CurrentPosition - musicaplayer.Duration * 0.10));
            };


            iv4.Click += delegate
            {
                animar(iv4);
                trer.Abort();

                musicaplayer.Reset();
                parador = false;
                this.Finish();
            };
            iv2.Click += delegate
            {
                animar(iv2);

                if (enporceso == false && rb4.Checked == true)
                {
                    quality = 360;
                    Thread tree = new Thread(new ThreadStart(descvids));
                    tree.Start();
                }
                else
                if (enporceso == false && rb5.Checked == true)
                {
                    quality = 720;
                    Thread tree2 = new Thread(new ThreadStart(descvids));
                    tree2.Start();
                }

                else
                if (enporceso == false && rb6.Checked == true)
                {
                    quality = -1;
                    Thread tree3 = new Thread(new ThreadStart(descmp3));
                    tree3.Start();
                }
            };
            musicaplayer.SeekComplete += delegate
            {
            };



            iv3.Click += delegate
            {
                animar(iv3);
                if (tv3.Text != "Cargando...")
                {
                    if (musicaplayer.IsPlaying == false)
                    {
                        iv3.SetBackgroundResource(Resource.Drawable.pausebutton2);
                        musicaplayer.Start();
                    }

                    else
                    {
                        iv3.SetBackgroundResource(Resource.Drawable.playbutton2);
                        musicaplayer.Pause();
                    }
                }
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Reproducirlista);
            inst = this;
            //////////////////////////////declaraciones//////////////////////////////////

            parador    = true;
            playpause  = FindViewById <ImageView>(Resource.Id.imageView2);
            lista      = FindViewById <ListView>(Resource.Id.listView1);
            volverhome = FindViewById <ImageView>(Resource.Id.imageView1);
            textbox    = FindViewById <TextView>(Resource.Id.textView1);
            background = FindViewById <LinearLayout>(Resource.Id.LinearLayout0);
            barra      = FindViewById <LinearLayout>(Resource.Id.linearLayout2);
            tl         = FindViewById <Android.Support.Design.Widget.TabLayout>(Resource.Id.tabs);

            tl.AddTab(tl.NewTab().SetText("Local"));
            tl.AddTab(tl.NewTab().SetText("Remoto"));
            //////////////////////////////////////////////////////////////////////////////
            /////////////////////////////miselaneo+conexion//////////////////////////////


            //  barra.SetBackgroundColor(Android.Graphics.Color.Black);


            new Thread(() => cojerstream()).Start();
            new Thread(() => llenarlistas()).Start();
            textbox.Selected = true;

            /*  var adaptadolo = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, new List<string> { "No hay elementos para mostrar.." });
             * RunOnUiThread(() => lista.Adapter = adaptadolo);*/
            //////////////////////////////////////////////////////////////////////////////
            ////////////////////////////Eventos//////////////////////////////////////////
            // barra.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30"));

            playpause.Click += delegate
            {
                Mainmenu.gettearinstancia().clientela.Client.Send(Encoding.Default.GetBytes("playpause()"));
            };
            volverhome.Click += delegate
            {
                Finish();
                MultiHelper.ExecuteGarbageCollection();
            };
            tl.TabSelected += (aa, sss) =>
            {
                new Thread(() =>
                {
                    if (sss.Tab.Text == "Local")
                    {
                        query = "Fromremote";



                        if (listaslocales.Count > 0)
                        {
                            var adap = new adapterlistaremoto(this, listaslocales.Select(asd => asd.Name).ToList(), listaslocales.Select(asd => asd.Portrait).ToList());
                            RunOnUiThread(() =>
                            {
                                var parcelable = lista.OnSaveInstanceState();
                                lista.Adapter  = adap;
                                lista.OnRestoreInstanceState(parcelable);
                            });
                        }
                        else
                        {
                            var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                                "No hay elementos para mostrar.."
                            });
                            RunOnUiThread(() =>
                            {
                                var parcelable = lista.OnSaveInstanceState();
                                lista.Adapter  = adaptadol;
                                lista.OnRestoreInstanceState(parcelable);
                            });
                        }
                    }
                    else
                    {
                        query = "Fromlocal";
                        if (listasremotas.Count > 0)
                        {
                            var adap = new adapterlistaremoto(this, listasremotas.Select(asd => asd.Name).ToList(), listasremotas.Select(asd => asd.Portrait).ToList());
                            RunOnUiThread(() =>
                            {
                                var parcelable = lista.OnSaveInstanceState();
                                lista.Adapter  = adap;
                                lista.OnRestoreInstanceState(parcelable);
                            });
                        }
                        else
                        {
                            var adaptadol = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, new List <string> {
                                "No hay elementos para mostrar.."
                            });
                            RunOnUiThread(() =>
                            {
                                var parcelable = lista.OnSaveInstanceState();
                                lista.Adapter  = adaptadol;
                                lista.OnRestoreInstanceState(parcelable);
                            });
                        }
                    }
                }).Start();
            };

            lista.ItemClick += (sender, args) =>
            {
                playlistidx = args.Position;

                Intent intento = new Intent(this, typeof(dialogolistasact));
                if (query == "Fromremote" && listaslocales.Count > 0)
                {
                    if (listaslocales[playlistidx].Portrait.Trim() != "")
                    {
                        intento.PutExtra("nombrelista", listaslocales[playlistidx].Name);
                        intento.PutExtra("portada", listaslocales[playlistidx].Portrait);
                        intento.PutExtra("querry", query);

                        StartActivity(intento);
                    }
                    else
                    {
                        Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                    }
                }
                else

                {
                    if (listasremotas.Count > 0)
                    {
                        if (listasremotas[playlistidx].MediaElements.Count > 0)
                        {
                            intento.PutExtra("nombrelista", listasremotas[playlistidx].Name);
                            intento.PutExtra("portada", listasremotas[playlistidx].Portrait);
                            intento.PutExtra("querry", query);
                            StartActivity(intento);
                        }
                        else
                        {
                            Toast.MakeText(this, "La lista esta vacia", ToastLength.Long).Show();
                        }
                    }

                    /*    mainmenu.gettearinstancia()
                     * .clientelalistas
                     * .Client
                     * .Send(Encoding
                     * .UTF8
                     * .GetBytes("Sendplaylist__==__==__" + JsonConvert.SerializeObject(listasremotas[playlistidx])));*/
                }


                /*   AlertDialog.Builder ad = new AlertDialog.Builder(this);
                 * ad.SetCancelable(false);
                 * ad.SetTitle("Advertencia");
                 * ad.SetMessage("Desea reproducir esta lista de reproduccio en el dispositivo servidor??");
                 *  ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground);
                 * posicion = args.Position;
                 * ad.SetPositiveButton("Si", ok);
                 * ad.SetNegativeButton("No", no);
                 * ad.Create();
                 * ad.Show();*/
            };



            // Create your application here
        }
Esempio n. 29
0
 private void Start()
 {
     Mainmenu.SetActive(false);
     vp.Play();
 }
        public void mostrarnotificacion()
        {
            var listapending = listapendingintents();


            RemoteViews contentView = new RemoteViews(PackageName, Resource.Layout.layoutminiplayeronline);

            if (linkactual.Trim().Length > 1)
            {
                try
                {
                    contentView.SetImageViewBitmap(Resource.Id.imageView1, ImageHelper.GetRoundedShape(GetImageBitmapFromUrl(linkactual)));
                    contentView.SetImageViewBitmap(Resource.Id.fondo1, ImageHelper.CreateBlurredImageFromUrl(this, 20, linkactual));
                }
                catch (Exception)
                {
                }
            }
            contentView.SetOnClickPendingIntent(Resource.Id.imageView1, listapending[5]);
            contentView.SetTextViewText(Resource.Id.textView1, tituloactual);
            contentView.SetOnClickPendingIntent(Resource.Id.imageView2, listapending[0]);
            contentView.SetOnClickPendingIntent(Resource.Id.imageView4, listapending[1]);
            contentView.SetOnClickPendingIntent(Resource.Id.imageView3, listapending[2]);
            contentView.SetOnClickPendingIntent(Resource.Id.imageView6, listapending[3]);
            contentView.SetOnClickPendingIntent(Resource.Id.imageView5, listapending[4]);


            /*
             *
             * 1-playpause
             * 2-siguiente
             * 3-anterior
             * 4-adelantar
             * 5-atrazar
             *
             */

            Notification.Action accion1 = new Notification.Action(Resource.Drawable.playpause, "Playpause", listapending[0]);
            Notification.Action accion2 = new Notification.Action(Resource.Drawable.skipnext, "Siguiente", listapending[1]);
            Notification.Action accion3 = new Notification.Action(Resource.Drawable.skipprevious, "Anterior", listapending[2]);
            Notification.Action accion4 = new Notification.Action(Resource.Drawable.skipforward, "adelantar", listapending[3]);
            Notification.Action accion5 = new Notification.Action(Resource.Drawable.skipbackward, "atrazar", listapending[4]);

#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            var nBuilder = new Notification.Builder(this);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            Notification.MediaStyle estilo = new Notification.MediaStyle();
            if (Mainmenu.gettearinstancia() != null)
            {
                //  estilo.SetMediaSession(mainmenu.gettearinstancia().mSession.SessionToken);

                estilo.SetShowActionsInCompactView(1, 2, 3);
            }
            if (Build.VERSION.SdkInt < BuildVersionCodes.Lollipop)
            {
#pragma warning disable 414
                try {
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
                    nBuilder.SetContent(contentView);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
                }
                catch (Exception) {
                }

#pragma warning restore 414
            }
            else
            {
                nBuilder.SetStyle(estilo);
                nBuilder.SetLargeIcon(ImageHelper.GetImageBitmapFromUrl(linkactual));
                nBuilder.SetContentTitle(tituloactual);
                nBuilder.SetContentText("Desde: " + Mainmenu.gettearinstancia().devicename);
                nBuilder.AddAction(accion5);
                nBuilder.AddAction(accion3);
                nBuilder.AddAction(accion1);
                nBuilder.AddAction(accion2);
                nBuilder.AddAction(accion4);
                nBuilder.SetContentIntent(listapending[5]);
                nBuilder.SetColor(Android.Graphics.Color.ParseColor("#ce2c2b"));
            }
            nBuilder.SetOngoing(true);

            nBuilder.SetSmallIcon(Resource.Drawable.play);

            Notification notification = nBuilder.Build();
            StartForeground(19248736, notification);
        }