public TeamInfo(int id, FacebookPost fb)
 {
     InitializeComponent();
     InitBinding(id);
     //przekazanie tresci postu z fb do grida
     FacebookPostGrid.DataContext = fb;
 }
Exemplo n.º 2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            string       token    = getToken();
            var          request  = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/v2.9/herthabsc/feed?access_token=" + token);
            var          response = (HttpWebResponse)request.GetResponse();
            FacebookPost fbPost   = getFacebookPost(response);

            TeamInfo ti = new TeamInfo(4, fbPost);

            ti.Show();
        }
Exemplo n.º 3
0
        private FacebookPost getFacebookPost(HttpWebResponse response)
        {
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();

            dynamic      x            = JsonConvert.DeserializeObject(responseString);
            var          data         = x.data;
            string       message      = data[0].message;
            string       created_time = data[0].created_time;
            string       id           = data[0].id;
            FacebookPost fbPost       = new FacebookPost(created_time, message, id);

            return(fbPost);
        }
Exemplo n.º 4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            DataRowView selectedUrl = UrlListBox.SelectedItem as DataRowView;
            string      title       = selectedUrl.Row["Tytul"] as string;

            string       token    = getToken();
            var          request  = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/v2.9/" + title + "/feed?access_token=" + token);
            var          response = (HttpWebResponse)request.GetResponse();
            FacebookPost fbPost   = getFacebookPost(response);

            // Create a new PDF document
            PdfDocument document = new PdfDocument();

            document.Info.Title = "Created with PDFsharp";

            // Create an empty page
            PdfPage page = document.AddPage();

            // Get an XGraphics object for drawing
            XGraphics gfx = XGraphics.FromPdfPage(page);

            // Create a font
            XFont font       = new XFont("Verdana", 14, XFontStyle.Regular);
            XFont headerFont = new XFont("Oblique", 25, XFontStyle.Italic);

            // Draw the text
            gfx.DrawString("Raport", headerFont, XBrushes.Black,
                           new XRect(0, 0, page.Width, 100),
                           XStringFormats.Center);

            gfx.DrawString(title, headerFont, XBrushes.Black,
                           new XRect(0, 0, page.Width, 200),
                           XStringFormats.Center);

            gfx.DrawString(fbPost.message, font, XBrushes.Black,
                           new XRect(0, 0, page.Width, 520),
                           XStringFormats.Center);

            // Left position in point



            // Save the document...
            const string filename = "Post.pdf";

            document.Save(filename);
            // ...and start a viewer.
            Process.Start(filename);
        }
Exemplo n.º 5
0
        //utworzenie okna z informacjami o druzynie
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //pobranie tokena
            string token = getToken();
            //wyslanie zapytanie do api fb o posty na danej stronie
            var request = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/v2.9/BVB/feed?access_token=" + token);
            //odebranie wyniku
            var response = (HttpWebResponse)request.GetResponse();
            //przetworzenie odpowiedzi serwera fb na obiekt klasy FacebookPost
            FacebookPost fbPost = getFacebookPost(response);

            TeamInfo ti = new TeamInfo(2, fbPost);

            ti.Show();
        }
Exemplo n.º 6
0
        //przetworzenie odpowiedzi serwera fb na obiekt FacebookPost
        private FacebookPost getFacebookPost(HttpWebResponse response)
        {
            //przetworzenie odpowiedzi na string
            var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
            //parsowanie jsona
            dynamic x    = JsonConvert.DeserializeObject(responseString);
            var     data = x.data;
            //przypisanie atrybutow najnowszego postu do poszczegolnych atrybutow
            string message      = data[0].message;
            string created_time = data[0].created_time;
            string id           = data[0].id;
            //utworzenie obiektu FacebookPost z pobranym postem
            FacebookPost fbPost = new FacebookPost(created_time, message, id);

            return(fbPost);
        }
Exemplo n.º 7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (UrlListBox.SelectedItem != null)
            {
                DataRowView selectedUrl = UrlListBox.SelectedItem as DataRowView;
                string      title       = selectedUrl.Row["Tytul"] as string;
                //string fanpageName = GetPageName(title);


                string       token    = getToken();
                var          request  = (HttpWebRequest)WebRequest.Create("https://graph.facebook.com/v2.9/" + title + "/feed?access_token=" + token);
                var          response = (HttpWebResponse)request.GetResponse();
                FacebookPost fbPost   = getFacebookPost(response);
                FacebookPostTextBlock.DataContext = fbPost;
            }
        }