Beispiel #1
0
 private Task RemoveNotification(SfCardView notification)
 {
     notification.Dismissed -= Notification_Dismissed;
     OutAnimation(notification);
     Children.Remove(notification);
     GC.Collect();
     return(Task.CompletedTask);
 }
        private async void SfCardView_Dismissed(System.Object sender, Syncfusion.XForms.Cards.DismissedEventArgs e)
        {
            await Task.Delay(400);

            SfCardView view = sender as SfCardView;

            (view.Content as Label).Text = "CardView " + i.ToString();
            view.IsDismissed             = false;
            i++;
        }
Beispiel #3
0
        public NajavePopupPage(PogledajDogadjajViewModel model)
        {
            InitializeComponent();
            this.model = model;

            ScrollView  scrollView = new ScrollView();
            StackLayout glavni     = new StackLayout();

            glavni.Children.Add(new Label {
                Text = "Najave", FontSize = 20, Padding = new Thickness(10, 10)
            });
            foreach (var glas in model.model.Dogadjaj.IdProjektNavigation.IdVrstePodjeleNavigation.Glasovi())
            {
                SfCardView view = new SfCardView {
                    Padding = new Thickness(10, 10)
                };
                Label l = new Label {
                    Text = glas + ": " + model.model.Clanovi[glas].Count, FontSize = 17, FontAttributes = FontAttributes.Bold
                };
                StackLayout so = new StackLayout();
                so.Children.Add(l);
                foreach (var najava in model.model.Clanovi[glas])
                {
                    var lab = new Label {
                        Text = najava.IdKorisnikNavigation.ImeIPrezimeP
                    };
                    so.Children.Add(lab);
                }
                view.Content = so;
                glavni.Children.Add(view);
            }

            SfCardView view1 = new SfCardView {
                Padding = new Thickness(10, 10)
            };
            Label li = new Label {
                Text = "Nerazvrstani" + ": " + model.model.Nerazvrstani.Count, FontSize = 17, FontAttributes = FontAttributes.Bold
            };
            StackLayout so1 = new StackLayout();

            so1.Children.Add(li);
            foreach (var najava in model.model.Nerazvrstani)
            {
                var lab = new Label {
                    Text = najava.IdKorisnikNavigation.ImeIPrezimeP
                };
                so1.Children.Add(lab);
            }
            view1.Content = so1;
            glavni.Children.Add(view1);

            scrollView.Content = glavni;
            this.Content       = scrollView;
        }
Beispiel #4
0
        public async Task Push(SfCardView notification, int?millisecondsDuration = null)
        {
            notification.Dismissed += Notification_Dismissed;
            Children.Insert(0, notification);
            await InAnimation(notification);

            if (millisecondsDuration is null)
            {
                return;
            }
            await Task.Delay(millisecondsDuration.Value);

            await RemoveNotification(notification);
        }
        /// <summary>
        /// Handles the tapping of the card
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>Not fully implemented, need to figure out how to send the tapped recipe as a parameter</remarks>
        public async void OnCardTapped(object sender)
        {
            // If the sender is somehow null return instantly and do nothing
            if (sender == null)
            {
                return;
            }
            // I dob't like this but it's how they said to use the tapped event
            SfCardView cardView = (sender as TappedEventArgs).Parameter as SfCardView;
            var        recipe   = cardView.BindingContext as Recipe;

            if (!UtilFunction.IsObjRecipe(recipe))
            {
                return;
            }
            await Navigation.PushModalAsync(new ViewRecipe(recipe));
        }
        public EvidencijaPage(PogledajDogadjajViewModel model)
        {
            InitializeComponent();
            this.model = model;
            ScrollView  scrollView = new ScrollView();
            StackLayout glavni     = new StackLayout();

            glavni.Children.Add(new Label {
                Text = "Evidencija", FontSize = 20, Padding = new Thickness(10, 10)
            });
            foreach (var glas in model.model.Dogadjaj.IdProjektNavigation.IdVrstePodjeleNavigation.Glasovi())
            {
                SfCardView view = new SfCardView {
                    Padding = new Thickness(10, 10)
                };
                Label l = new Label {
                    Text = glas + ":", FontSize = 17, FontAttributes = FontAttributes.Bold
                };
                StackLayout so = new StackLayout();
                so.Children.Add(l);
                foreach (var clan in model.model.ClanoviProjekta[glas])
                {
                    Label ime = new Label {
                        Text = clan.IdKorisnikNavigation.ImeIPrezimeP
                    };
                    Switch cell = new Switch();
                    if (model.model.Evidencija.Contains(clan.IdKorisnik))
                    {
                        cell.IsToggled = true;
                        guids.Add(clan.IdKorisnik);
                    }
                    cell.BindingContext    = clan.IdKorisnik;
                    cell.HorizontalOptions = LayoutOptions.End;
                    cell.Toggled          += Cell_Toggled;
                    Grid grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition());


                    grid.Children.Add(ime, 0, 0);
                    grid.Children.Add(cell, 1, 0);
                    so.Children.Add(grid);
                }
                view.Content = so;
                glavni.Children.Add(view);
            }
            SfCardView view1 = new SfCardView {
                Padding = new Thickness(10, 10)
            };
            Label li = new Label {
                Text = "Nerazvrstani", FontSize = 17, FontAttributes = FontAttributes.Bold
            };
            StackLayout so1 = new StackLayout();

            so1.Children.Add(li);
            foreach (var clan in model.model.NerazvrstaniClanovi)
            {
                Label ime = new Label {
                    Text = clan.IdKorisnikNavigation.ImeIPrezimeP
                };
                Switch cell = new Switch();
                if (model.model.Evidencija.Contains(clan.IdKorisnik))
                {
                    cell.IsToggled = true;
                    guids.Add(clan.IdKorisnik);
                }
                cell.BindingContext    = clan.IdKorisnik;
                cell.HorizontalOptions = LayoutOptions.End;
                cell.Toggled          += Cell_Toggled;
                Grid grid = new Grid();

                grid.RowDefinitions.Add(new RowDefinition());
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                grid.ColumnDefinitions.Add(new ColumnDefinition());


                grid.Children.Add(ime, 0, 0);
                grid.Children.Add(cell, 1, 0);
                so1.Children.Add(grid);
            }
            view1.Content = so1;
            glavni.Children.Add(view1);

            scrollView.Content = glavni;
            layout.Children.Add(scrollView);
            var btn = new Button {
                Text = "Spremi", BackgroundColor = Color.FromHex("1C6EBC"), TextColor = Color.White
            };

            btn.Clicked += Spremi;
            layout.Children.Add(btn);
            this.Content = layout;
        }
Beispiel #7
0
        public CustomPitanjeCell()
        {
            var pitanje = (Anketa)GetValue(PitanjeProperty);
            //instantiate each of our views
            var card = new SfCardView
            {
                CornerRadius      = 4,
                HasShadow         = true,
                WidthRequest      = 343,
                BackgroundColor   = Color.WhiteSmoke,
                HorizontalOptions = LayoutOptions.Center,
                Padding           = new Thickness(16, 16, 8, 16)
            };

            grid = new Grid
            {
                ColumnSpacing = 8,
                RowSpacing    = 8,
            };
            //4 reda
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(50)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            //3 stupca
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(40)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            //profilna slika
            profilna = new CircleImage
            {
                HeightRequest     = 40,
                WidthRequest      = 40,
                HorizontalOptions = LayoutOptions.Start,
                BorderColor       = Color.Black
                                    //Source = (ImageSource)converter.Convert(pitanje.IdKorisnikNavigation.IdSlika, null, null, null)
            };
            grid.Children.Add(profilna, 0, 0);
            //ime autora
            autor = new Label
            {
                FontSize          = 14,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                TextColor         = Color.Gray,
            };
            grid.Children.Add(autor, 1, 0);
            //gumb za brisanje
            Button btn = new Button
            {
                FontFamily        = "zboris.ttf#zboris",
                Text              = "\ue709",
                BackgroundColor   = Color.FromHex("1C6EBC"),
                TextColor         = Color.White,
                WidthRequest      = 40,
                HorizontalOptions = LayoutOptions.End
            };

            grid.Children.Add(btn, 2, 0);
            // pitanje
            labelPitanje.FontSize       = 20;
            labelPitanje.FontAttributes = FontAttributes.Bold;
            grid.Children.Add(labelPitanje, 0, 1);
            Grid.SetColumnSpan(labelPitanje, 3);
            //odgovori
            grid.Children.Add(picker, 0, 2);
            Grid.SetColumnSpan(picker, 3);
            grid.Children.Add(switchers, 0, 2);
            Grid.SetColumnSpan(switchers, 3);

            //Datum zatvaranja
            datum = new Label();
            datum.HorizontalOptions = LayoutOptions.Start;
            datum.VerticalOptions   = LayoutOptions.Center;
            grid.Children.Add(datum, 0, 3);
            Grid.SetColumnSpan(datum, 2);

            // rezultati
            RezultatiBtn.Text              = "Rezultati";
            RezultatiBtn.Clicked          += (sender, args) => this.RezultatiClick.Invoke(sender, args);
            RezultatiBtn.TextColor         = Color.White;
            RezultatiBtn.HeightRequest     = 40;
            RezultatiBtn.BackgroundColor   = Color.FromHex("1C6EBC");
            RezultatiBtn.HorizontalOptions = LayoutOptions.End;
            grid.Children.Add(RezultatiBtn, 2, 3);

            card.Content = grid;
            View         = card;
        }
        private void Napunjeno(object sender, EventArgs e)
        {
            int g = 0;

            if (model.Clanovi != null && model.Napunjeno == false)
            {
                var personDataTemplate = new DataTemplate(() =>
                {
                    Grid grid = new Grid();
                    grid.RowDefinitions.Add(new RowDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition());
                    grid.ColumnDefinitions.Add(new ColumnDefinition()); var lab = new Label();
                    var btn = new Button {
                        BackgroundColor = Color.FromHex("1C6EBC"), TextColor = Color.White
                    };
                    btn.Clicked          += Statistika;
                    btn.Text              = "Statistika";
                    btn.HorizontalOptions = LayoutOptions.End;
                    lab.SetBinding(Label.TextProperty, "IdKorisnikNavigation.ImeIPrezimeP");

                    grid.Children.Add(lab, 0, 0);
                    grid.Children.Add(btn, 1, 0);
                    return(new ViewCell {
                        View = grid
                    });
                });
                ScrollView  scrollView = new ScrollView();
                StackLayout glavni     = new StackLayout();
                foreach (var glas in model.Projekt.IdVrstePodjeleNavigation.Glasovi())
                {
                    SfCardView view = new SfCardView {
                        Padding = new Thickness(10, 10)
                    };
                    Label l = new Label {
                        Text = glas, FontSize = 17, FontAttributes = FontAttributes.Bold
                    };
                    StackLayout so = new StackLayout();
                    so.Children.Add(l);

                    /*foreach (var clan in model.Clanovi[glas])
                     * {
                     *  Label ime = new Label { Text = clan.IdKorisnikNavigation.ImeIPrezimeP };
                     *  var tapGestureRecognizer = new TapGestureRecognizer();
                     *  tapGestureRecognizer.Tapped += PokreniPopup;
                     *  ime.GestureRecognizers.Add(tapGestureRecognizer);
                     *  ime.BindingContext = clan;
                     *
                     *  Button btn = new Button {Text="Statistika", BackgroundColor = Color.FromHex("1C6EBC") , TextColor=Color.White};
                     *  btn.BindingContext = clan;
                     *  btn.HorizontalOptions = LayoutOptions.End;
                     *  btn.Clicked += Statistika;
                     *  Grid grid = new Grid();
                     *  grid.RowDefinitions.Add(new RowDefinition());
                     *  grid.ColumnDefinitions.Add(new ColumnDefinition());
                     *  grid.ColumnDefinitions.Add(new ColumnDefinition());
                     *
                     *
                     *  grid.Children.Add(ime, 0, 0);
                     *  grid.Children.Add(btn, 1, 0);
                     *  so.Children.Add(grid);
                     * }*/
                    ListView list = new ListView
                    {
                        ItemsSource   = model.Clanovi[glas],
                        ItemTemplate  = personDataTemplate,
                        HeightRequest = 200
                    };
                    list.ItemSelected += PokreniPopup;

                    so.Children.Add(list);
                    view.Content = so;
                    glavni.Children.Add(view);
                }

                SfCardView view1 = new SfCardView {
                    Padding = new Thickness(10, 10)
                };
                Label li = new Label {
                    Text = "Nerazvrstani", FontSize = 17, FontAttributes = FontAttributes.Bold
                };
                StackLayout so1 = new StackLayout();
                so1.Children.Add(li);

                /* foreach (var clan in model.Nerazvrstani)
                 * {
                 *   Label ime = new Label { Text = clan.IdKorisnikNavigation.ImeIPrezimeP };
                 *   var tapGestureRecognizer = new TapGestureRecognizer();
                 *  // tapGestureRecognizer.Tapped += PokreniPopup;
                 *   ime.GestureRecognizers.Add(tapGestureRecognizer);
                 *   ime.BindingContext = clan;
                 *
                 *   Button btn = new Button { Text = "Statistika", BackgroundColor = Color.FromHex("1C6EBC"), TextColor = Color.White };
                 *   btn.BindingContext = clan;
                 *   btn.HorizontalOptions = LayoutOptions.End;
                 *   btn.Clicked += Statistika;
                 *   Grid grid = new Grid();
                 *   grid.RowDefinitions.Add(new RowDefinition());
                 *   grid.ColumnDefinitions.Add(new ColumnDefinition());
                 *   grid.ColumnDefinitions.Add(new ColumnDefinition());
                 *
                 *
                 *   grid.Children.Add(ime, 0, 0);
                 *   grid.Children.Add(btn, 1, 0);
                 *   so1.Children.Add(grid);
                 * }*/
                ListView list1 = new ListView
                {
                    ItemsSource   = model.Nerazvrstani,
                    ItemTemplate  = personDataTemplate,
                    HeightRequest = 200
                };
                list1.ItemSelected += PokreniPopup;

                so1.Children.Add(list1);
                view1.Content = so1;
                glavni.Children.Add(view1);



                model.Napunjeno    = true;
                scrollView.Content = glavni;
                Clanovi.Content    = scrollView;
            }
        }