コード例 #1
0
ファイル: Hamburger.cs プロジェクト: yannduran/MyToolkit
        private async void OnSelectedItemChanged(HamburgerItem selectedItem)
        {
            var item = selectedItem;

            if (item != null)
            {
                if (SelectedBottomItem == item)
                {
                    SelectedTopItem = null;
                }
                else
                {
                    SelectedBottomItem = null;
                }

                if (item != _previouslySelectedItem)
                {
                    if (!item.CanBeSelected)
                    {
                        await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            SelectedItem = _previouslySelectedItem;
                            item.RaiseClickEvent(this);
                        }); // TODO: Improve
                    }
                    else
                    {
                        var copy = ItemChanged;
                        if (copy != null)
                        {
                            copy(this, new HamburgerItemChangedEventArgs(item));
                        }

                        item.RaiseSelectedEvent(this);
                        item.RaiseClickEvent(this);

                        if (item.AutoClosePane)
                        {
                            IsPaneOpen = false;
                        }

                        _previouslySelectedItem = item;
                    }
                }
            }
            else
            {
                _previouslySelectedItem = item;
            }
        }
コード例 #2
0
ファイル: Hamburger.cs プロジェクト: RareNCool/MyToolkit
        private async void OnSelectedItemChanged(HamburgerItem selectedItem)
        {
            var item = selectedItem;
            if (item != null)
            {
                if (SelectedBottomItem == item)
                    SelectedTopItem = null;
                else
                    SelectedBottomItem = null;

                if (item != _previouslySelectedItem)
                {
                    if (!item.CanBeSelected)
                    {
                        await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                        {
                            SelectedItem = _previouslySelectedItem;
                            item.RaiseClickEvent(this);
                        }); // TODO: Improve
                    }
                    else
                    {
                        var copy = ItemChanged;
                        if (copy != null)
                            copy(this, new HamburgerItemChangedEventArgs(item));

                        item.RaiseSelectedEvent(this);
                        item.RaiseClickEvent(this);

                        if (item.AutoClosePane)
                            IsPaneOpen = false;

                        _previouslySelectedItem = item;
                    }
                }
            }
            else
                _previouslySelectedItem = item;
        }
コード例 #3
0
 /// <summary>Initializes a new instance of the <see cref="HamburgerItemChangedEventArgs"/> class.</summary>
 /// <param name="item">The item.</param>
 public HamburgerItemChangedEventArgs(HamburgerItem item)
 {
     Item = item;
 }
コード例 #4
0
 /// <summary>Initializes a new instance of the <see cref="HamburgerItemChangedEventArgs"/> class.</summary>
 /// <param name="item">The item.</param>
 public HamburgerItemChangedEventArgs(HamburgerItem item)
 {
     Item = item;
 }