Ejemplo n.º 1
0
        public Perfil(bool miPerfil, string name, string cuenta)
        {
            perfil = name;

            string url = Directory.GetCurrentDirectory();

            newURL = "";
            for (int i = 0; i < url.Length - 9; i++)
            {
                newURL += url[i];
            }

            SPanel.SetBounds(292, 150, 420, 300);
            SPanel.Visible     = false;
            SPanel.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(SPanel);
            SPanelHeader.SetBounds(292, 162, 420, 34);
            SPanelHeader.Visible     = false;
            SPanelHeader.BackColor   = Color.AliceBlue;
            SPanelHeader.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(SPanelHeader);
            SPanelHeader.Controls.Add(SPanelText);
            SPanelText.Location = new Point(10, 10);

            res   = proxy.GetUser(name);
            _name = cuenta;

            var   urlimage = newURL + res.foto;
            Image image    = Image.FromFile(urlimage);

            ImagenPerfil.Image = image;
            ImagenPerfil.SetBounds(224, 72, 140, 130);
            ImagenPerfil.SizeMode = PictureBoxSizeMode.StretchImage;
            this.Controls.Add(ImagenPerfil);

            InitializeComponent();
            TopPanel.SendToBack();
            button1.FlatAppearance.BorderSize = 0;
            button2.FlatAppearance.BorderSize = 0;
            button3.FlatAppearance.BorderSize = 0;
            button4.FlatAppearance.BorderSize = 0;
            ConfigPanel.Visible    = false;
            ImagesPanel.AutoScroll = true;

            ConfigPanel.BorderStyle = BorderStyle.FixedSingle;

            BPanel.AutoScroll  = true;
            BPanel.Visible     = false;
            BPanel.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(BPanel);

            if (!miPerfil)
            {
                BGuardado.Visible   = false;
                GuardadoPic.Visible = false;
            }
            else
            {
                SeguirB.Visible = false;
            }

            // Resuperar estado boton Seguir
            InfoPerfil();
            NombreCompleto.Text = res.nombre;
            SeguirB.Location    = new Point(NombreUsuario.Location.X + NombreUsuario.Text.Length * 12 + 20 - NombreUsuario.Text.Length, SeguirB.Location.Y);

            //Publicaciones DEFAULT
            publicaciones     = true;
            PostsPic.Image    = Image.FromFile(newURL + "Imagenes/Posts.png");
            GuardadoPic.Image = Image.FromFile(newURL + "Imagenes/GuardadoUnactive.png");

            CargarPublicaciones();
        }
Ejemplo n.º 2
0
        public Inicio(string data)
        {
            string url = Directory.GetCurrentDirectory();

            for (int i = 0; i < url.Length - 9; i++)
            {
                newURL += url[i];
            }
            proxy = new ProxyInstagram();
            var res = proxy.GetUser(data);

            name = res.user; // DB User

            InitializeComponent();
            TopPanel.SendToBack();
            button2.FlatAppearance.BorderSize = 0;
            button3.FlatAppearance.BorderSize = 0;
            button4.FlatAppearance.BorderSize = 0;
            ConfigPanel.Visible   = false;
            PostsPanel.AutoScroll = true;
            StoryPanel.AutoScroll = true;
            this.ActiveControl    = PostsPanel;

            BPanel.BringToFront();
            BPanel.AutoScroll  = true;
            BPanel.Visible     = false;
            BPanel.BorderStyle = BorderStyle.FixedSingle;
            this.Controls.Add(BPanel);

            ConfigPanel.BorderStyle = BorderStyle.FixedSingle;

            NombreUsuario.Text  = res.user;
            NombreCompleto.Text = res.nombre;

            var   urlimage = newURL + res.foto;
            Image image    = Image.FromFile(urlimage);

            ImagenPerfil.Image  = image;
            ImagenPerfil.Width  = 44;
            ImagenPerfil.Height = 44;

            //Cargar Feed DB
            var insta = proxy.GetFeed(res.user);

            foreach (Post item in insta.publico)
            {
                var post = new ConstructorPosts(PostsPanel, 0, y, PerfilUsuario, item, name, UpdatePosts, this).CrearObjeto();
                post.crearPanel();
                PostsPanel.Controls.Add(post.obtenerPanel());
                y += post.obtenerPanel().Height + 20;
            }

            // My Stories
            if (insta.stories.stories.Count > 0)
            {
                var Mystory = new ConstructorStories(StoryPanel, 0, y2, StorieUsuario, insta.stories, res.user, UpdateStories).CrearObjeto();
                Mystory.crearPanel();
                StoryPanel.Controls.Add(Mystory.obtenerPanel());
                y2 += StoryPanel.Height / 6 + 10;
            }
            //

            foreach (Stories item in insta.publicStories)
            {
                var story = new ConstructorStories(StoryPanel, 0, y2, StorieUsuario, item, res.user, UpdateStories).CrearObjeto();
                story.crearPanel();
                StoryPanel.Controls.Add(story.obtenerPanel());
                y2 += StoryPanel.Height / 6 + 10;
            }
        }