Example #1
0
        public DetailSaveItemPage(TwItem item)
        {
            TwitterDatabase database = new TwitterDatabase();


            var btnMenu = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    new Button {
                        Text    = "戻る",
                        Command = new Command(() =>{
                            Navigation.PopModalAsync();
                        })
                    },

                    new Button {
                        Text    = "削除する",
                        Command = new Command(() =>{
                            database.DeleteItem(item);
                            DisplayAlert("完了", "削除しました", "OK");
                            Application.Current.MainPage = new ShowData();
                        })
                    },
                }
            };



            Content = new StackLayout
            {
                Children =
                {
                    new Label {
                        Text = item.UserName
                    },
                    new Label {
                        Text = item.CreateDay
                    },
                    new Label {
                        Text = item.Text
                    },
                    btnMenu
                }
            };
        }
Example #2
0
        public ShowData()
        {
            var listview = new ListView
            {
                ItemsSource  = _db.GetItems(),
                ItemTemplate = new DataTemplate(typeof(TextCell))
            };


            listview.ItemTemplate.SetBinding(TextCell.TextProperty, "Text");
            listview.ItemTemplate.SetBinding(TextCell.DetailProperty, "UserName");


            listview.ItemTapped += (sender, e) =>
            {
                TwItem item = (TwItem)e.Item;
                Navigation.PushModalAsync(new DetailSaveItemPage(item));
            };



            Content = new StackLayout
            {
                Children =
                {
                    new Button {
                        Text    = "戻る",
                        Command = new Command(() =>{
                            Application.Current.MainPage = new TwetMemoPage();
                        })
                    },

                    listview
                }
            };
        }
Example #3
0
        //引数で受け取るのは実際にタップした詳細ツイートです
        public DetailTwtPage(CoreTweet.Status item)
        {
            TwitterDatabase database = new TwitterDatabase();

            var btnMenu = new StackLayout
            {
                VerticalOptions = LayoutOptions.EndAndExpand,
                Orientation     = StackOrientation.Horizontal,
                Children        =
                {
                    new Button {
                        Text    = "戻る",
                        Command = new Command(() =>{
                            // IsEnabled = false;
                            //System.Console.WriteLine("call");
                            // Navigation.PushModalAsync(new SerchResult(entry.Text));
                            Navigation.PopModalAsync();
                            // Navigation.PushAsync(new SerchResult(entry.Text));
                            //IsEnabled = true;
                            // Navigation.PushAsync(new SerchResult(entry.Text));
                            //.PushAsync(new SerchResult(entry.Text));
                        })
                    },

                    new Button {
                        Text    = "保存する",
                        Command = new Command(() =>{
                            var twitem = new TwItem{
                                UserName  = item.User.ScreenName,
                                CreateDay = item.User.CreatedAt.DateTime.ToString(),
                                Text      = item.Text,
                                saveTime  = DateTime.Now
                            };

                            database.SaveData(twitem);

                            DisplayAlert("完了", "保存しました", "OK");
                        })
                    },
                }
            };



            Content = new StackLayout
            {
                Children =
                {
                    new Label {
                        Text = item.User.ScreenName
                    },
                    new Label {
                        Text = item.User.CreatedAt.DateTime.ToString()
                    },
                    new Label {
                        Text = item.Text
                    },
                    btnMenu
                },
                Padding = new Thickness(0, Device.OnPlatform(20, 0, 20), 0, 0)
            };
        }
Example #4
0
 public void SaveData(TwItem item)
 {
     lock (Locker){
         _db.Insert(item);
     }
 }
Example #5
0
 public void DeleteItem(TwItem item)
 {
     lock (Locker){
         _db.Delete(item);
     }
 }