Пример #1
0
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Provides a subset of the full items collection to bind to from a GroupedItemsPage
            // for two reasons: GridView will not virtualize large items collections, and it
            // improves the user experience when browsing through groups with large numbers of
            // items.
            //
            // A maximum of 12 items are displayed because it results in filled grid columns
            // whether there are 1, 2, 3, 4, or 6 rows displayed

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    if (TopItems.Count > 12)
                    {
                        TopItems.RemoveAt(12);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Move:
                if (e.OldStartingIndex < 12 && e.NewStartingIndex < 12)
                {
                    TopItems.Move(e.OldStartingIndex, e.NewStartingIndex);
                }
                else if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    TopItems.Add(Items[11]);
                }
                else if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    TopItems.RemoveAt(12);
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    if (Items.Count >= 12)
                    {
                        TopItems.Add(Items[11]);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Replace:
                if (e.OldStartingIndex < 12)
                {
                    TopItems[e.OldStartingIndex] = Items[e.OldStartingIndex];
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                TopItems.Clear();
                while (TopItems.Count < Items.Count && TopItems.Count < 12)
                {
                    TopItems.Add(Items[TopItems.Count]);
                }
                break;
            }
        }
Пример #2
0
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Предоставляет подмножество полной коллекции элементов, привязываемой из объекта GroupedItemsPage
            // по двум причинам: GridView не виртуализирует большие коллекции элементов и оно
            // улучшает работу пользователей при просмотре групп с большим количеством
            // элементов.
            //
            // Отображается максимальное число столбцов (12), поскольку это приводит к заполнению столбцов сетки
            // сколько строк отображается: 1, 2, 3, 4 или 6

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    if (TopItems.Count > 12)
                    {
                        TopItems.RemoveAt(12);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Move:
                if (e.OldStartingIndex < 12 && e.NewStartingIndex < 12)
                {
                    TopItems.Move(e.OldStartingIndex, e.NewStartingIndex);
                }
                else if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    TopItems.Add(Items[11]);
                }
                else if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    TopItems.RemoveAt(12);
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    if (Items.Count >= 12)
                    {
                        TopItems.Add(Items[11]);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Replace:
                if (e.OldStartingIndex < 12)
                {
                    TopItems[e.OldStartingIndex] = Items[e.OldStartingIndex];
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                TopItems.Clear();
                while (TopItems.Count < Items.Count && TopItems.Count < 12)
                {
                    TopItems.Add(Items[TopItems.Count]);
                }
                break;
            }
        }
Пример #3
0
 protected internal override CriteriaItemViewModel FindItemVmOf(ICrit crit)
 {
     return TopItems.FindCritKeeperOf(crit);
 }
Пример #4
0
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // バインドする完全な項目コレクションのサブセットを GroupedItemsPage から指定します。
            // これには次の 2 つの理由があります。GridView はサイズの大きい項目コレクションを仮想化しません。また、
            // グループを通じてたくさんのアイテムを参照するときに、ユーザー エクスペリエンスを
            // 向上します。
            //
            // 1、2、3、4、または 6 個の列が表示される場合でも、入力済みのグリッド コラムが使用されることになるため、
            // 最大 12 個のアイテムが表示されます

            switch (e.Action)
            {
            case NotifyCollectionChangedAction.Add:
                if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    if (TopItems.Count > 12)
                    {
                        TopItems.RemoveAt(12);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Move:
                if (e.OldStartingIndex < 12 && e.NewStartingIndex < 12)
                {
                    TopItems.Move(e.OldStartingIndex, e.NewStartingIndex);
                }
                else if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    TopItems.Add(Items[11]);
                }
                else if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    TopItems.RemoveAt(12);
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                if (e.OldStartingIndex < 12)
                {
                    TopItems.RemoveAt(e.OldStartingIndex);
                    if (Items.Count >= 12)
                    {
                        TopItems.Add(Items[11]);
                    }
                }
                break;

            case NotifyCollectionChangedAction.Replace:
                if (e.OldStartingIndex < 12)
                {
                    TopItems[e.OldStartingIndex] = Items[e.OldStartingIndex];
                }
                break;

            case NotifyCollectionChangedAction.Reset:
                TopItems.Clear();
                while (TopItems.Count < Items.Count && TopItems.Count < 12)
                {
                    TopItems.Add(Items[TopItems.Count]);
                }
                break;
            }
        }
Пример #5
0
        protected void CreateMenuItems()
        {
            //TopItems.Add(new MasterMenuItem
            //{
            //    Title = App.GetLanguageValue("Home", "首页"),
            //    IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_home.png"),
            //    Page = PageItem.Home
            //});
            TopItems.Add(new MasterMenuItem
            {
                Title      = App.GetLanguageValue("Bible", "圣经"),
                IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_bible.png"),
                Page       = PageItem.Bible
            });
            TopItems.Add(new MasterMenuItem
            {
                Title      = App.GetLanguageValue("“Sing Out Joyfully”", "高声欢唱"),
                IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_songbook.png"),
                Page       = PageItem.SongBook
            });
            TopItems.Add(new MasterMenuItem
            {
                Title      = App.GetLanguageValue("Publications", "出版物"),
                IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_publications.png"),
                Page       = PageItem.Publications
            });
            TopItems.Add(new MasterMenuItem
            {
                Title      = App.GetLanguageValue("Dictionary", "字典"),
                IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_dictionary.png"),
                Page       = PageItem.Dictionary
            });
            //TopItems.Add(new MasterMenuItem
            //{
            //    Title = "Media",
            //    IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_media.png"),
            //});
            //TopItems.Add(new MasterMenuItem
            //{
            //    Title = "Meetings",
            //    IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_meetings.png"),
            //});

            var settings = new MasterMenuItem
            {
                Title      = App.GetLanguageValue("Settings", "设置"),
                IconSource = String.Format("{0}{1}", Device.OnPlatform("", "", "Assets/"), "nav_settings.png"),
                Page       = PageItem.Settings
            };

            if (Device.RuntimePlatform == Device.Windows)
            {
                BottomItems.Add(settings);
            }
            else
            {
                BottomItems.Add(settings);
            }

            MenuTop.ItemsSource    = TopItems;
            MenuBottom.ItemsSource = BottomItems;

            if (Device.RuntimePlatform == Device.Windows)
            {
                MenuTop.Header           = null;
                MenuTop.HeightRequest    = (TopItems.Count() * 48);
                MenuBottom.HeightRequest = (BottomItems.Count() * 48) + 1;
            }
            else
            {
                MenuTop.HeightRequest       = ((TopItems.Count() + 1) * 60) + 200;
                MenuTop.SeparatorVisibility = SeparatorVisibility.None;
                MenuBottom.HeightRequest    = (BottomItems.Count() * 60) + 1 + 1;
                //MenuBottom.HeightRequest = 1;
            }

            //if (Device.RuntimePlatform == Device.Android)
            //{
            //    var _menuPage = new ContentPage();
            //    _menuPage.Title = "FreshMvvmSampleApp";
            //    _menuPage.Content = SplitViewPane;

            //    Master = new NavigationPage(_menuPage) { Title = "FreshMvvmSampleApp" };
            //}
            //else
            //{

            //}

#if __ANDROID__
#endif

#if __ANDROID__
#endif
        }
Пример #6
0
 protected internal override CardItemViewModel FindItemVmOf(IHrsHolder node)
 {
     return(TopItems.FindHolderKeeperOf(node));
 }