Example #1
0
        void AddRecentSearches()
        {
            try
            {
                if (RecentSearchesAdded)
                {
                    return;
                }
                if (RecentSearches.Count == 0)
                {
                    return;
                }
                var recent = new InstaDynamicSearchSection
                {
                    Title = "Recent",
                    Type  = InstagramApiSharp.Enums.InstaDynamicSearchSectionType.Recent,
                };
                foreach (var item in RecentSearches)
                {
                    item.ShowClose = false;
                    recent.Items.Add(item);
                }
                //recent.Items.AddRange(RecentSearches);

                TopItems.Add(recent);
                RecentSearchesAdded = true;
            }
            catch { }
        }
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            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;
            }
        }
Example #3
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:
                foreach (var item in e.NewItems)
                {
                    (item as CommonDataItem).Group = this;
                }

                if (e.NewStartingIndex < 12)
                {
                    TopItems.Insert(e.NewStartingIndex, Items[e.NewStartingIndex]);
                    if (TopItems.Count > 12)
                    {
                        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;
            }
        }
Example #4
0
 public override void AddRootItemFor(ICrit crit)
 {
     var est = crit.GetEstimator();
     if (!roots.Contains(est))
     {
         // first create ItemVm
         var itemVm = new CriteriaItemViewModel(est, beforeInsert);
         roots.Add(est);
         TopItems.Add(itemVm);
     }
 }
Example #5
0
        public override void AddRootItemFor(IHrsHolder holder)
        {
            var p = holder.GetPatient();

            if (!roots.Contains(p))
            {
                // first create ItemVm
                var itemVm = new CardItemViewModel(p);
                roots.Add(p);
                TopItems.Add(itemVm);
            }
        }
Example #6
0
        protected override void InitializeTopItems()
        {
            Searchable = false;
            TopItems.Clear();

            ContainerItem item = new ContainerItem(true, true, true);

            item.Children.Add(new Button()
            {
                Content = "Test Button"
            });

            TopItems.Add(item);
        }
Example #7
0
        private void Initialize(ICollection <Dictionary.ListItem> items)
        {
            _itemsController.ResetTopItems();
            foreach (Dictionary.ListItem word in items)
            {
                DictionaryItem item        = new DictionaryItem(word);
                bool           hasSubtitle = !string.IsNullOrEmpty(item.Subtitle);

                Items.Add(item);

                if (_itemsController.CanAddTopItem(hasSubtitle))
                {
                    TopItems.Add(item);
                }
            }
        }
Example #8
0
        private void FillTopItems()
        {
            TopItems.Clear();
            _itemsController.ResetHistoryTopItems();

            foreach (DictionaryItem item in _items)
            {
                if (_itemsController.CanAddHistoryTopItem())
                {
                    TopItems.Add(item);
                }
                else
                {
                    break;
                }
            }
        }
Example #9
0
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Proporciona un subconjunto de la colección completa de elementos al que enlazar desde un elemento GroupedItemsPage
            // por dos motivos: GridView no virtualiza colecciones de elementos grandes y
            // mejora la experiencia del usuario cuando examina grupos con números grandes de
            // elementos.
            //
            // Se muestra un máximo de 12 elementos porque da lugar a columnas de cuadrícula rellenas
            // ya se muestren 1, 2, 3, 4 o 6 filas

            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;
            }
        }
Example #10
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;
            }
        }
Example #11
0
        /// <summary> DKU
        /// Cette méthode permet gestion des collections d'éléments et gère les notifications.
        /// Méthode déjà existante dans le modèle.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ItemsCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            // Fournit un sous-ensemble de la collection complète d'éléments avec laquelle effectuer une liaison à partir d'un GroupedItemsPage
            // pour deux raisons : GridView ne virtualise pas les collections d'éléments volumineuses, et
            // améliore l'expérience utilisateur lors de la navigation dans des groupes contenant un nombre important
            // d'éléments.
            //
            // 12 éléments maximum sont affichés, car cela se traduit par des colonnes de grille remplies,
            // qu'il y ait 1, 2, 3, 4 ou 6 lignes affichées

            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;
            }
        }
Example #12
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;
            }
        }
Example #13
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;
            }
        }
        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
        }