コード例 #1
0
        public FootballPlayerListPage()
        {
            this.BindingContext = new FootballPlayerViewModel ();

            Title = "Football Legends";
            var create = new ToolbarItem ();
            create.Name = "create";

            this.ToolbarItems.Add (create);
            create.Clicked += Create_Clicked;
            //	create.SetBinding (ToolbarItem.CommandProperty, "CreatePlayer");
            MyFootballList = new ListView ();
            MyFootballList.IsPullToRefreshEnabled = true;
            MyFootballList.Refreshing += MyFootballList_Refreshing;
            MyFootballList.SetBinding (ListView.ItemsSourceProperty, "Footballplayercollection");
            var cell = new DataTemplate (typeof(FootballPlayerListCell));
            MyFootballList.ItemTemplate = cell;
            MyFootballList.RowHeight = 70;

            MessagingCenter.Subscribe<FootballPlayerListCell>(this,"delete",(sender) => {
                this.BindingContext = new FootballPlayerViewModel();
                FootballPlayer dat= new FootballPlayer ();
                MyFootballList.ItemsSource = dat.GetItems ();

            },null);

            MyFootballList.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
            {

                Navigation.PushAsync(new FootballPlayerDetailPage(e.SelectedItem));

            };

            this.Content = MyFootballList;
        }
コード例 #2
0
        protected override void OnAppearing()
        {
            base.OnAppearing();
            FootballPlayer dat = new FootballPlayer();

            MyFootballList.ItemsSource = dat.GetItems();
        }
コード例 #3
0
        void MyFootballList_Refreshing(object sender, EventArgs e)
        {
            FootballPlayer dat = new FootballPlayer();

            MyFootballList.ItemsSource = dat.GetItems();
            MyFootballList.EndRefresh();
        }
コード例 #4
0
//		public string _countryImage



        void OnSaveCommand()
        {
            string c;

            if (Country == 0)
            {
                c = "India";
            }
            else if (Country == 1)
            {
                c = "USA";
            }
            else if (Country == 2)
            {
                c = "Japan";
            }
            else if (Country == 3)
            {
                c = "UK";
            }
            else if (Country == 4)
            {
                c = "Australia";
            }
            else
            {
                c = "Unavailable";
            }

            player = new FootballPlayer(_FirstName, _LastName, _DOB, _DESC, c);

            player.saveFootBallPlayerData(player);
        }
コード例 #5
0
        void DeleteAction_Clicked(object sender, EventArgs e)
        {
            var            x1 = (MenuItem)sender;
            var            x2 = x1.BindingContext;
            FootballPlayer x3 = (FootballPlayer)x2;

            x3.deletePlayer(x3.ID);

            MessagingCenter.Send(this, "delete");
        }
コード例 #6
0
        public FootballPlayerViewModel()
        {
            SaveCommand = new Command (OnSaveCommand);
            //CreatePlayer = new Command (OnCreatePlayerCommand);
            DeleteData = new Command (OnDeletePlayerCommand);
            //PickImage = new Command (onPick);

            player = new FootballPlayer ();

            Footballplayercollection =new ObservableCollection<FootballPlayer>(player.GetItems());
        }
コード例 #7
0
        public FootballPlayerViewModel()
        {
            SaveCommand = new Command(OnSaveCommand);
            //CreatePlayer = new Command (OnCreatePlayerCommand);
            DeleteData = new Command(OnDeletePlayerCommand);
            //PickImage = new Command (onPick);

            player = new FootballPlayer();


            Footballplayercollection = new ObservableCollection <FootballPlayer>(player.GetItems());
        }
コード例 #8
0
        public FootballPlayerDetailPage(object obj)
        {
            InitializeComponent();

            //this.BindingContext = obj;
            FootballPlayer myObj = (FootballPlayer)obj;

            this.FirstNameDetail.Text   = myObj.PFName;
            this.LastNameDetail.Text    = myObj.PLName;
            this.DOBDetail.Text         = myObj.PDOB.ToString();
            this.DescriptionDetail.Text = myObj.PDesc;
            this.CountryDetail.Text     = myObj.Pcountry;
        }
コード例 #9
0
        void Favourites_Clicked(object sender, EventArgs e)
        {
            MenuItem button = (MenuItem)sender;

            var            x1 = (MenuItem)sender;
            var            x2 = x1.BindingContext;
            FootballPlayer x3 = (FootballPlayer)x2;

            x3.fav = !x3.fav;
            if (x3.fav)
            {
                button.Text = "Un Favourite";
            }
            else
            {
                button.Text = "Mark Favourite";
            }
            x3.updateplayerFavourite(x3);
        }
コード例 #10
0
        public FootballPlayerListPage()
        {
            this.BindingContext = new FootballPlayerViewModel();


            Title = "Football Legends";
            var create = new ToolbarItem();

            create.Name = "create";

            this.ToolbarItems.Add(create);
            create.Clicked += Create_Clicked;
            //	create.SetBinding (ToolbarItem.CommandProperty, "CreatePlayer");
            MyFootballList = new ListView();
            MyFootballList.IsPullToRefreshEnabled = true;
            MyFootballList.Refreshing            += MyFootballList_Refreshing;
            MyFootballList.SetBinding(ListView.ItemsSourceProperty, "Footballplayercollection");
            var cell = new DataTemplate(typeof(FootballPlayerListCell));

            MyFootballList.ItemTemplate = cell;
            MyFootballList.RowHeight    = 70;

            MessagingCenter.Subscribe <FootballPlayerListCell>(this, "delete", (sender) => {
                this.BindingContext        = new FootballPlayerViewModel();
                FootballPlayer dat         = new FootballPlayer();
                MyFootballList.ItemsSource = dat.GetItems();
            }, null);



            MyFootballList.ItemSelected += (object sender, SelectedItemChangedEventArgs e) =>
            {
                Navigation.PushAsync(new FootballPlayerDetailPage(e.SelectedItem));
            };

            this.Content = MyFootballList;
        }
コード例 #11
0
        public FootballPlayerListCell()
        {
            FootballPlayer footballplayercollection = (FootballPlayer)this.BindingContext;
            var deleteAction = new MenuItem { Text = "", IsDestructive = true };
            deleteAction.Clicked += DeleteAction_Clicked;
            this.ContextActions.Add (deleteAction);
            deleteAction.Text = "Delete";
            var Favourites = new MenuItem { IsDestructive = false };
            Favourites.Clicked += Favourites_Clicked;
            FootballPlayer foot = new FootballPlayer ();
            if (foot.fav) {
                Favourites.Text = "UnFavourite";
            } else {
                Favourites.Text = "Mark Favourite";
            }
            this.ContextActions.Add (Favourites);

            nameLabel = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100

            };

            var DOB = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100
            };

            var ageLabel = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,
                Text = "age",
                WidthRequest = 100

            };

            var countryimg = new Image ();
            countryimg.SetBinding (Image.SourceProperty, "countryImage");
            countryimg.GetSizeRequest (15, 15);

            var Lname = new Label () {
                FontFamily = "HelveticaNeue-Medium",
                FontSize = 18,
                TextColor = Color.Black,

                WidthRequest = 100

            };

            nameLabel.SetBinding(Label.TextProperty,"PFName");
            DOB.SetBinding (Label.TextProperty, "PlayerAge");
            Lname.SetBinding (Label.TextProperty, "PLName");

            var cellLayout = new StackLayout {
                Spacing = 5,
                Padding = new Thickness (5, 5, 5, 5),

                Orientation = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children = { nameLabel, Lname ,

                new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    Spacing = 5,
                        Children = { ageLabel, DOB }
                },

                    countryimg
                }
            };

            this.View = cellLayout;
        }
コード例 #12
0
 public void saveFootBallPlayerData(FootballPlayer obj)
 {
     database.Insert(obj);
 }
コード例 #13
0
 public void updateplayerFavourite(FootballPlayer obj)
 {
     database.Update(obj);
 }
コード例 #14
0
 void MyFootballList_Refreshing(object sender, EventArgs e)
 {
     FootballPlayer dat= new FootballPlayer ();
     MyFootballList.ItemsSource =  dat.GetItems ();
     MyFootballList.EndRefresh();
 }
コード例 #15
0
 protected override void OnAppearing()
 {
     base.OnAppearing ();
     FootballPlayer dat= new FootballPlayer ();
     MyFootballList.ItemsSource = dat.GetItems ();
 }
コード例 #16
0
ファイル: FootballPlayer.cs プロジェクト: CTS458641/cts458701
 public void saveFootBallPlayerData(FootballPlayer obj)
 {
     database.Insert (obj);
 }
コード例 #17
0
ファイル: FootballPlayer.cs プロジェクト: CTS458641/cts458701
 public void updateplayerFavourite(FootballPlayer obj)
 {
     database.Update (obj);
 }
コード例 #18
0
        public FootballPlayerListCell()
        {
            FootballPlayer footballplayercollection = (FootballPlayer)this.BindingContext;
            var            deleteAction             = new MenuItem {
                Text = "", IsDestructive = true
            };

            deleteAction.Clicked += DeleteAction_Clicked;
            this.ContextActions.Add(deleteAction);
            deleteAction.Text = "Delete";
            var Favourites = new MenuItem {
                IsDestructive = false
            };

            Favourites.Clicked += Favourites_Clicked;
            FootballPlayer foot = new FootballPlayer();

            if (foot.fav)
            {
                Favourites.Text = "UnFavourite";
            }
            else
            {
                Favourites.Text = "Mark Favourite";
            }
            this.ContextActions.Add(Favourites);



            nameLabel = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = 18,
                TextColor  = Color.Black,

                WidthRequest = 100
            };

            var DOB = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = 18,
                TextColor  = Color.Black,

                WidthRequest = 100
            };


            var ageLabel = new Label()
            {
                FontFamily   = "HelveticaNeue-Medium",
                FontSize     = 18,
                TextColor    = Color.Black,
                Text         = "age",
                WidthRequest = 100
            };


            var countryimg = new Image();

            countryimg.SetBinding(Image.SourceProperty, "countryImage");
            countryimg.GetSizeRequest(15, 15);

            var Lname = new Label()
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = 18,
                TextColor  = Color.Black,

                WidthRequest = 100
            };

            nameLabel.SetBinding(Label.TextProperty, "PFName");
            DOB.SetBinding(Label.TextProperty, "PlayerAge");
            Lname.SetBinding(Label.TextProperty, "PLName");


            var cellLayout = new StackLayout {
                Spacing = 5,
                Padding = new Thickness(5, 5, 5, 5),

                Orientation       = StackOrientation.Horizontal,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          = { nameLabel, Lname,



                                      new StackLayout {
                                          Orientation = StackOrientation.Vertical,
                                          Spacing     = 5,
                                          Children    = { ageLabel, DOB }
                                      },

                                      countryimg }
            };



            this.View = cellLayout;
        }
コード例 #19
0
        //        public string _countryImage
        void OnSaveCommand()
        {
            string c;

            if (Country == 0) {

                c	= "India";
            } else if (Country == 1) {

                c = "USA";
            }
            else if (Country == 2) {
                c = "Japan";

            }
            else if (Country == 3) {
                c = "UK";

            }
            else if (Country == 4) {

                c = "Australia";
            }
            else {

                c = "Unavailable";
            }

            player= new FootballPlayer (_FirstName,_LastName,_DOB,_DESC,c);

            player.saveFootBallPlayerData (player);
        }