public UsersListViewModel(ListViewPage page)
        {
            ItemsPerPage   = 25;
            OnRefresh      = new Command(Refresh);
            OnSearch       = new Command(OnSeachTextChangedAsync);
            OnItemSelected = new Command(OnItemSelectedSync);
            OnItemAdded    = new Command(AddItemAsync);

            Page = page;
            Page.OnSeachTextChanged += OnSearchRequested;
            Page.OnItemSelected     += OnSelectionRequest;
            Page.OnItemDeleted      += OnItemDeletedAsync;
            Page.OnItemEdited       += OnItemEditedAsync;

            Page.ListView.ItemAppearing += async(sender, e) =>
            {
                if (e.Item == BaseItems[Items.Count - 1])
                {
                    if (BaseItems.Count < TotalItemsCount)
                    {
                        await LoadItems();
                    }
                }
            };
        }
Exemplo n.º 2
0
        public App()
        {
            InitializeComponent();

            // MainPage = new TabbedPageContainer();
            MainPage = new ListViewPage();
        }
        private void Nav()
        {
            ListViewPage listViewPage = new ListViewPage();

            listViewPage.BindingContext = new ListViewViewModel(breachedSites);
            Application.Current.MainPage.Navigation.PushAsync(listViewPage);
        }
Exemplo n.º 4
0
        //分页
        public void RefrshRobotPageInfo(List <RobotInfo> list, Int32 EveryPageCount)
        {
            PageRobotInfo  = new Tool.ListViewPage <RobotInfo>(list, EveryPageCount);
            PageRobotCount = EveryPageCount;
            //this.RobotList.ItemsSource = PageRobotInfo.GetPageData(JumpOperation.GoHome);
            this.RobotList.ItemsSource = list;
            RobotList.Items.Refresh();

            Sort(RobotList, "isSelected", ListSortDirection.Ascending);
        }
        public SalesmenListViewModel(ListViewPage page)
        {
            Page = page;

            OnRefresh      = new Command(Refresh);
            OnItemSelected = new Command(OnItemSelectedAsync);
            OnItemAdded    = new Command(AddItemAsync);
            OnSearch       = new Command(OnSeachTextChanged);

            Page.OnSeachTextChanged += OnSearchRequested;
            Page.OnItemSelected     += OnSelectionRequest;
            Page.OnItemDeleted      += OnItemDeletedAsync;
            Page.OnItemEdited       += OnItemEditedAsync;
        }
        public ModeratorsListViewModel(ListViewPage page, bool defaultSearch = true)
        {
            Page = page;

            OnRefresh      = new Command(Refresh);
            OnItemSelected = new Command(OnItemSelectedAsync);
            OnItemAdded    = new Command(AddItemAsync);
            OnSearch       = new Command(OnSeachTextChanged);

            Page.OnSeachTextChanged += OnSearchRequested;
            Page.OnItemSelected     += OnSelectionRequest;
            Page.OnItemDeleted      += OnItemDeletedAsync;
            Page.OnItemEdited       += OnItemEditedAsync;
        }
        protected async void OnItemSelectedAsync(object obj)
        {
            if (IsBusy)
            {
                return;
            }

            User user = obj as User;

            if (user != null)
            {
                IsBusy = true;
                var todayShopsPage = new ListViewPage(hideFooter: true)
                {
                    Title = user.Username
                };
                var todayShopsViewModel = new ShopsListViewModel(todayShopsPage, user, false, true);

                todayShopsViewModel.OnItemSelected = new Command(async(object shopObject) =>
                {
                    if (todayShopsViewModel.IsBusy)
                    {
                        return;
                    }

                    Shop shop = shopObject as Shop;
                    if (shop != null)
                    {
                        IsBusy = true;
                        await Page.Navigation.PushAsync(new ShopValidatorPage(shop, true));
                        IsBusy = false;
                        todayShopsPage.ListView.SelectedItem = null;
                    }
                });

                todayShopsPage.BindingContext = todayShopsViewModel;

                await Page.Navigation.PushAsync(todayShopsPage);

                todayShopsViewModel.OnRefresh.Execute(null);
                IsBusy = false;
                Page.ListView.SelectedItem = null;
            }
        }
Exemplo n.º 8
0
        public App()
        {
            InitializeComponent();

            if (UseMockDataStore)
            {
                DependencyService.Register <MockDataStore>();
            }
            else
            {
                DependencyService.Register <CloudDataStore>();
            }

            if (Device.RuntimePlatform == Device.iOS)
            {
                MainPage = new ListViewPage();
            }
            else
            {
                MainPage = new NavigationPage(new ListViewPage());
            }
        }
Exemplo n.º 9
0
        public ShopsListViewModel(ListViewPage page, User user, bool isArchiveData, bool defaultItemTemplate)
        {
            User          = user;
            Page          = page;
            IsArchiveData = isArchiveData;

            if (defaultItemTemplate)
            {
                Page.ListView.ItemTemplate = new ShopDataTemplateSelector(Page.Edit_Clicked, Page.Delete_Clicked);
            }

            OnSearch       = new Command(OnSeachTextChanged);
            OnRefresh      = new Command(Refresh);
            OnItemSelected = new Command(OnItemSelectedAsync);
            OnItemAdded    = new Command(AddItemAsync);

            Page.OnSeachTextChanged += OnSearchRequested;
            Page.OnItemSelected     += OnSelectionRequest;
            Page.OnItemDeleted      += OnItemDeletedAsync;
            Page.OnItemEdited       += OnItemEditedAsync;

            if (IsArchiveData)
            {
                Page.ListView.ItemAppearing += async(sender, e) =>
                {
                    if (e.Item == BaseItems[Items.Count - 1])
                    {
                        if (BaseItems.Count < TotalItemsCount)
                        {
                            await LoadArchiveItems();
                        }
                    }
                }
            }
            ;
        }
Exemplo n.º 10
0
        void Construct(ContentPage page, ICommand restore, Command <Page> setRoot)
        {
            safeLimits = new Label {
                Text = "nothing"
            };
            var grid = new Grid
            {
                VerticalOptions   = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
            };

            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Star
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            var safeLimitsTop = new Label
            {
                Text              = "top",
                BackgroundColor   = Color.Pink,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Start,
                InputTransparent  = true
            };

            grid.Children.Add(safeLimitsTop);
            Grid.SetRow(safeLimitsTop, 0);
            var safeLimitsBottom = new Label
            {
                Text              = "bottom",
                BackgroundColor   = Color.Pink,
                HorizontalOptions = LayoutOptions.End,
                VerticalOptions   = LayoutOptions.End,
                InputTransparent  = true
            };

            grid.Children.Add(safeLimitsBottom);
            Grid.SetRow(safeLimitsBottom, 2);

            var content = new ScrollView
            {
                Content = new StackLayout
                {
                    VerticalOptions   = LayoutOptions.Fill,
                    HorizontalOptions = LayoutOptions.Fill,
                    Children          =
                    {
                        safeLimits,
                        new Button
                        {
                            Text    = "Set Content as root",
                            Command = new Command(() =>
                            {
                                var pageSafe = new SafeAreaPageiOS(restore,setRoot);
                                setRoot.Execute(pageSafe);
                            })
                        },
                        new Button
                        {
                            Text    = "Set NavigationPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe = new SafeAreaPageiOS(restore,setRoot);
                                setRoot.Execute(new NavigationPage(pageSafe));
                            })
                        },
                        new Button
                        {
                            Text    = "Set TabbedPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var tabbedPage    = new TabbedPage();
                                tabbedPage.Children.Add(pageSafe);
                                tabbedPage.Children.Add(pageNotSafe);
                                setRoot.Execute(tabbedPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Set TabbedPage and NavigationPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var tabbedPage    = new TabbedPage();
                                tabbedPage.Children.Add(new NavigationPage(pageSafe)
                                {
                                    Title = pageSafe.Title
                                });
                                tabbedPage.Children.Add(new NavigationPage(pageNotSafe)
                                {
                                    Title = pageNotSafe.Title
                                });
                                setRoot.Execute(tabbedPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Set CarouselPage as root",
                            Command = new Command(() =>
                            {
                                var pageSafe    = new SafeAreaPageiOS(restore, setRoot);
                                var pageNotSafe = new SafeAreaPageiOS(restore,setRoot);
                                pageNotSafe.On <iOS>().SetUseSafeArea(false);
                                pageNotSafe.Title = "Not Using Safe Area";
                                var carouselPage  = new CarouselPage();
                                carouselPage.Children.Add(pageSafe);
                                carouselPage.Children.Add(pageNotSafe);
                                setRoot.Execute(carouselPage);
                            })
                        },
                        new Button
                        {
                            Text    = "Toggle use safe area",
                            Command = new Command(() => On <iOS>().SetUseSafeArea(!On <iOS>().UsingSafeArea()))
                        },
                        new Button
                        {
                            Text    = "ListViewPage with safe area",
                            Command = new Command(() => {
                                var pageLIST = new ListViewPage("1",restore);
                                pageLIST.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageLIST);
                            })
                        },         new Button
                        {
                            Text    = "ListViewPage with no safe area",
                            Command = new Command(() => {
                                var pageLIST = new ListViewPage("1",restore);
                                setRoot.Execute(pageLIST);
                            }),
                        },         new Button
                        {
                            Text    = "ListViewPageGrouping with no safe area",
                            Command = new Command(() => {
                                var pageLIST = GetGroupedListView(restore);
                                (pageLIST.Content as ListView).Header = new Button {
                                    Text = "Go back To gallery",Command                               = restore
                                };
                                setRoot.Execute(pageLIST);
                            })
                        },         new Button
                        {
                            Text    = "ListViewPageGrouping using SafeAreaInsets",
                            Command = new Command(() => {
                                var pageLIST              = GetGroupedListView(restore);
                                pageLIST.PropertyChanged += (sender,e) => {
                                    if (e.PropertyName == "SafeAreaInsets")
                                    {
                                        var safeAreaInsets = pageLIST.On <iOS>().SafeAreaInsets();
                                        //we always want to pad the top when using grouping
                                        pageLIST.Padding = new Thickness(0,safeAreaInsets.Top, 0, 0);
                                    }
                                };
                                setRoot.Execute(pageLIST);
                            })
                        },
                        new Button
                        {
                            Text    = "ListViewPageGrouping with safe area",
                            Command = new Command(() => {
                                var pageLIST = GetGroupedListView(restore);
                                pageLIST.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageLIST);
                            })
                        },
                        new Button
                        {
                            Text    = "TableView+TextCell with safe area",
                            Command = new Command(() => {
                                var pageTable = new TableViewPage(restore);
                                pageTable.On <iOS>().SetUseSafeArea(true);
                                setRoot.Execute(pageTable);
                            })
                        },
                        new Button
                        {
                            Text    = "TableView+TextCell with no safe area",
                            Command = new Command(() => {
                                var pageTable = new TableViewPage(restore);
                                setRoot.Execute(pageTable);
                            })
                        },
                        new Button
                        {
                            Text    = "Back To Gallery",
                            Command = restore
                        },
                    }
                }
            };

            grid.Children.Add(content);
            Grid.SetRow(content, 1);

            page.Content = grid;
        }
Exemplo n.º 11
0
        public App()
        {
            InitializeComponent();

            MainPage = new ListViewPage();
        }
Exemplo n.º 12
0
        private void AssinarMensagens()
        {
            MessagingCenter.Subscribe <ActivityIndicatorPage>(this, "GoActivity", (msg) =>
            {
                //App.Current.MainPage = new Navigation.Pagina1();
                Detail = new ActivityIndicatorPage();

                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ProgressBarPage>(this, "GoProgressBar", (msg) =>
            {
                Detail = new ProgressBarPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <BoxViewPage>(this, "GoBoxView", (msg) =>
            {
                Detail = new BoxViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <LabelPage>(this, "GoLabel", (msg) =>
            {
                Detail = new LabelPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ButtonPage>(this, "GoButton", (msg) =>
            {
                Detail = new ButtonPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <EntryEditorPage>(this, "GoEntryEditor", (msg) =>
            {
                Detail = new EntryEditorPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <DatePickerPage>(this, "GoDatePicker", (msg) =>
            {
                Detail = new DatePickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <TimePickerPage>(this, "GoTimePicker", (msg) =>
            {
                Detail = new TimePickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <PickerPage>(this, "GoPickerPage", (msg) =>
            {
                Detail = new PickerPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SearchBarPage>(this, "GoSearchPage", (msg) =>
            {
                Detail = new SearchBarPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SliderStepperPage>(this, "GoSliderStepper", (msg) =>
            {
                Detail = new SliderStepperPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <SwitchPage>(this, "GoSwitch", (msg) =>
            {
                Detail = new SwitchPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ImagePage>(this, "GoImagePage", (msg) =>
            {
                Detail = new ImagePage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <ListViewPage>(this, "GoListView", (msg) =>
            {
                Detail = new ListViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <TableViewPage>(this, "GoTableViewPage", (msg) =>
            {
                Detail = new TableViewPage();
                //Esconder a master
                IsPresented = false;
            });

            MessagingCenter.Subscribe <WebViewPage>(this, "GoWebView", (msg) =>
            {
                Detail = new WebViewPage();
                //Esconder a master
                IsPresented = false;
            });
        }
Exemplo n.º 13
0
        private void TrocaTelaCommand()
        {
            var pageActivity = new ActivityIndicatorPage();

            GoActivityIndicator = new Command(() =>
            {
                MessagingCenter.Send <ActivityIndicatorPage>(pageActivity, "GoActivity");
            });

            var pageProgressBar = new ProgressBarPage();

            GoProgressBar = new Command(() =>
            {
                MessagingCenter.Send <ProgressBarPage>(pageProgressBar, "GoProgressBar");
            });

            var pageBoxView = new BoxViewPage();

            GoBoxView = new Command(() =>
            {
                MessagingCenter.Send <BoxViewPage>(pageBoxView, "GoBoxView");
            });

            var pageLabel = new LabelPage();

            GoLabel = new Command(() =>
            {
                MessagingCenter.Send <LabelPage>(pageLabel, "GoLabel");
            });

            var pageButton = new ButtonPage();

            GoButton = new Command(() =>
            {
                MessagingCenter.Send <ButtonPage>(pageButton, "GoButton");
            });

            var pageEntryEditor = new EntryEditorPage();

            GoEntryEditor = new Command(() =>
            {
                MessagingCenter.Send <EntryEditorPage>(pageEntryEditor, "GoEntryEditor");
            });

            var pageDatePicker = new DatePickerPage();

            GoDatePicker = new Command(() =>
            {
                MessagingCenter.Send <DatePickerPage>(pageDatePicker, "GoDatePicker");
            });

            var pageTimePicker = new TimePickerPage();

            GoTimePicker = new Command(() =>
            {
                MessagingCenter.Send <TimePickerPage>(pageTimePicker, "GoTimePicker");
            });

            var pagePickerPage = new PickerPage();

            GoPickerPage = new Command(() =>
            {
                MessagingCenter.Send <PickerPage>(pagePickerPage, "GoPickerPage");
            });

            var pageSearchBar = new SearchBarPage();

            GoSearchPage = new Command(() =>
            {
                MessagingCenter.Send <SearchBarPage>(pageSearchBar, "GoSearchPage");
            });

            var pageSliderStepper = new SliderStepperPage();

            GoSliderStepper = new Command(() =>
            {
                MessagingCenter.Send <SliderStepperPage>(pageSliderStepper, "GoSliderStepper");
            });

            var pageSwitch = new SwitchPage();

            GoSwitch = new Command(() =>
            {
                MessagingCenter.Send <SwitchPage>(pageSwitch, "GoSwitch");
            });

            var imagePage = new ImagePage();

            GoImagePage = new Command(() =>
            {
                MessagingCenter.Send <ImagePage>(imagePage, "GoImagePage");
            });

            var listView = new ListViewPage();

            GoListView = new Command(() =>
            {
                MessagingCenter.Send <ListViewPage>(listView, "GoListView");
            });

            var tablePage = new TableViewPage();

            GoTableViewPage = new Command(() =>
            {
                MessagingCenter.Send <TableViewPage>(tablePage, "GoTableViewPage");
            });

            var webView = new WebViewPage();

            GoWebView = new Command(() =>
            {
                MessagingCenter.Send <WebViewPage>(webView, "GoWebView");
            });
        }
Exemplo n.º 14
0
            void Button_Clicked(object sender, System.EventArgs e)
            {
                var listPage = new ListViewPage();

                Navigation.PushAsync(listPage);
            }