Example #1
0
        public SakiyomiPage(Graph graph,string title)
            : base(graph, title)
        {
            var ar = new List<OneData>();

            // 「いいね」数の多さでソートする
            _graph.post.Sort((a, b) => b.Likes.Count - a.Likes.Count);
            foreach (var a in _graph.post) {
                if(a.Type == "photo") { // 画像投稿のページだけを対象にする
                    ar.Add(new OneData() { Message = a.Message, Picture = a.Picture, CreateTime = a.CreateTime, Likes = a.Likes.Count });
                }
            }

            var listView = new ListView() {
                BackgroundColor = Color.Transparent,
                ItemTemplate = new DataTemplate(typeof(MyCell)),//セルの指定
                ItemsSource = ar,
                //RowHeight = 100, // 行の高さ固定
                HasUnevenRows = true,//行の高さを可変とする
            };

            Content = new StackLayout {
                Padding = new Thickness(0, 0, 0, 0),
                Children = { listView }
            };
        }
Example #2
0
        public LikesPage(Graph graph, string title)
            : base(graph, title)
        {
            var ar = new List<OneData>();

            foreach (var a in _graph.post) {
                foreach (var s in a.Likes) {
                    var target = Search(ar, s);
                    if(target == null) {
                        var picture = string.Format("https://graph.facebook.com/{0}/picture?type=square",s);
                        ar.Add(new OneData() { Id = s ,Likes = 1 ,Picture = picture});
                    } else {
                        target.Likes++;
                    }
                }
            }
            ar.Sort((a, b) =>  b.Likes - a.Likes);

            var listView = new ListView() {
                BackgroundColor = Color.Transparent,
                ItemTemplate = new DataTemplate(typeof(MyCell)),//セルの指定
                ItemsSource = ar,
            };

            Content = new StackLayout {
                Padding = new Thickness(0, 0, 0, 0),
                Children = { listView }
            };
        }
Example #3
0
        public PostPage(Graph graph, string title)
            : base(graph, title)
        {
            var ar = new List<OneData>();

            // 「いいね」数の多さでソートする
            _graph.post.Sort((a, b) => b.Likes.Count - a.Likes.Count);
            foreach (var a in _graph.stream) {
                if (String.IsNullOrEmpty(a.Message)) {
                    continue;
                }

                var createdTime = Util.ToDateStr(a.Created_time);
                var type = a.Type.ToString();
                var isPhoto = false;
                var isLink = false;
                var isUpdate = false;

                switch (a.Type) {
                    case 80:
                        type = "リンクの投稿";
                        isLink = true;
                        break;
                    case 247:
                        type = "写真の投稿";
                        isPhoto = true;
                        break;
                    case 46:
                        type = "記事の投稿";
                        isUpdate = true;
                        break;

                }
                ar.Add(new OneData() { Message = a.Message, CreateTime = createdTime, Type = type ,IsLink = isLink,IsPhoto = isPhoto ,IsUpdate = isUpdate});
            }

            var listView = new ListView() {
                BackgroundColor = Color.Transparent,
                ItemTemplate = new DataTemplate(typeof(MyCell)),//セルの指定
                ItemsSource = ar,
                //RowHeight = 100, // 行の高さ固定
                HasUnevenRows = true,//行の高さを可変とする
            };

            Content = new StackLayout {
                Padding = new Thickness(0, 0, 0, 0),
                Children = { listView }
            };
        }
Example #4
0
        public NicePage(Graph graph, string title)
            : base(graph, title)
        {
            var ar = new List<OneData>();

            foreach (var a in _graph.like) {

                var createdTime = Util.ToDateStr(a.Created_time);

                ar.Add(new OneData() { Message = a.Title, CreateTime = createdTime, Url = a.Url, Picture = a.Picture });
            }

            var listView = new ListView() {
                BackgroundColor = Color.Transparent,
                ItemTemplate = new DataTemplate(typeof(MyCell)),//セルの指定
                RowHeight = 100, // 行の高さ固定
                ItemsSource = ar,
            };

            Content = new StackLayout {
                Padding = new Thickness(0, 0, 0, 0),
                Children = { listView }
            };
        }
Example #5
0
 public BasePage(Graph graph, string title)
 {
     _graph = graph;
     Title = title;
     BackgroundColor = ExColor.FacebookLightBlue;
 }
Example #6
0
 public void SetStatus(bool isLogin, string accessToken, string id)
 {
     _isLogin = isLogin;
     if (_isLogin) {
         _fb = new FacebookClient(accessToken);
         _img.Source = string.Format("https://graph.facebook.com/{0}/picture?width=100&height=100", id);
         _graph = new Graph(_fb);
     } else {
         _fb = null;
         Navigation.PushModalAsync(new LoginPage(this, "YOUR_FACEBOOK_APP_ID", ExtendedPermissions,deleteCookie));
         deleteCookie = false;
     }
 }
Example #7
0
        // isHour = true1:時間別  false;月別
        public DatePage(Graph graph, string title,bool isHour)
            : base(graph, title)
        {
            var max = isHour ? 24 : 12;

            // データのカウント
            var counter = Enumerable.Range(0, max).Select(n => 0.0).ToList();
            foreach (var a in _graph.stream) {
                var dt = Util.ToDateTime(a.Created_time);
                if (isHour) {
                    counter[dt.Hour]++;
                } else {
                    counter[dt.Month-1]++;
                }
            }
            // %に換算する
            var ar = new List<int>();
            foreach(var c in counter) {
                var n = c / (double)counter.Max() * 100;
                ar.Add((int)n);

            }

            var stackLayout = new StackLayout {
                Padding = new Thickness(0, 30, 0, 0),
                Spacing = 5,
            };
            for (var i=0;i<ar.Count;i++) {
                // 時間 棒グラフ %を横に並べる
                var layout = new StackLayout {
                    Padding = new Thickness(10, 0, 0, 0),
                    Spacing = 0,
                    Orientation = StackOrientation.Horizontal, //横に並べる
                };

                var createTime = new Label { Font = Font.SystemFontOfSize(10), TextColor = Color.Gray };

                var labelHour = new Label {
                    Font = Font.SystemFontOfSize(10),
                    TextColor = Color.Black ,
                    Text = string.Format("{0}{1}", isHour?i:i+1, isHour ? "時" : "月"),
                    WidthRequest = 25,
                    XAlign = TextAlignment.Start
                };
                layout.Children.Add(labelHour);

                var boxView = new BoxView {
                    Color = isHour?ExColor.FacebookMediumBlue:Color.Pink,
                    WidthRequest = ar[i]*3,
                    HeightRequest = 12,
                    HorizontalOptions = LayoutOptions.Start,
                    VerticalOptions = LayoutOptions.CenterAndExpand
                };
                layout.Children.Add(boxView);

                var labelParcent = new Label {
                    Font = Font.SystemFontOfSize(10),
                    TextColor = Color.Gray,
                    Text = string.Format("{0}件", counter[i]),
                    WidthRequest = 50,
                    HorizontalOptions = LayoutOptions.Center,
                };
                layout.Children.Add(labelParcent);

                //縦に並べる
                stackLayout.Children.Add(layout);
            }
            Content = stackLayout;
        }