Exemplo n.º 1
0
        /// <summary>
        /// Close detail pane message recieved
        /// </summary>
        /// <param name="obj">Message</param>
        protected void CloseDetailPane(ItemDetailCloseMsg obj)
        {
            if (obj.ItemType != ItemType)
            {
                return;
            }

            PivotPanes.Remove(PivotPanes.Where(x => x.Name == detailPivotItemName)?.FirstOrDefault());

            ClosePane();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Close add pane message recieved
        /// </summary>
        /// <param name="obj">Message</param>
        protected void CloseAddPane(ItemAddCloseMsg obj)
        {
            if (obj != null)
            {
                if (obj.ItemType != ItemType)
                {
                    return;
                }
            }

            PivotPanes.Remove(PivotPanes.Where(x => x.Name == addPivotItemName)?.FirstOrDefault());

            ClosePane();
        }
        /// <summary>
        /// Set ShowAddActPage to custom settings ShowPanelAfterLeavePage
        /// </summary>
        /// <param name="pageState"></param>
        /// <param name="suspending"></param>
        /// <returns></returns>
        public override async Task OnNavigatedFromAsync(IDictionary <string, object> pageState, bool suspending)
        {
            //foreach (var Item in ShowSlaveActPage.ToList())
            //{
            //    ShowSlaveActPage[Item.Key] = Services.SettingsServices.SettingsService.Instance.ShowPanelAfterLeavePage && Item.Value;
            //}

            if (!Services.SettingsServices.SettingsService.Instance.ShowPanelAfterLeavePage)
            {
                PivotPanes.Clear();
            }

            await Task.CompletedTask;
        }
Exemplo n.º 4
0
        protected override void AddPane <TMessage>(string paneName, TMessage msg)
        {
            string header = "";
            object content;

            switch (paneName)
            {
            case addPivotItemName:

                content = new AddItem(uiModule, typeof(ParkingAddViewModel), Messenger, modulePage);

                if (msg.GetType() == typeof(ItemAddNewMsg))
                {
                    header = "Add";
                }
                else
                {
                    header = "Edit";
                }

                break;

            case detailPivotItemName:

                content = new DetailItem(uiModule, typeof(ParkingDetailViewModel), Messenger, modulePage);

                header = "Detail";
                break;

            default:
                throw new NotImplementedException();
            }

            try
            {
                if (PivotPanes.FirstOrDefault(x => x.Name == paneName) == null)
                {
                    PivotPanes.Insert(0, new PivotItem()
                    {
                        Name    = paneName,
                        Header  = header,
                        Margin  = new Thickness(0),
                        Content = content
                    });
                }
                else
                {
                    PivotPanes.FirstOrDefault(x => x.Name == paneName).Header  = header;
                    PivotPanes.FirstOrDefault(x => x.Name == paneName).Content = content;
                }
            }
            catch (Exception e)
            {
                PivotPanes.Clear();
                PivotPanes.Insert(0, new PivotItem()
                {
                    Name    = paneName,
                    Header  = header,
                    Content = content
                });
            }
            finally
            {
                if (PivotPanes.FirstOrDefault(x => x.Name == paneName) != null)
                {
                    //pivotPanes = PivotPanes;
                    RaisePropertyChanged(nameof(PivotPanes));

                    PaneVisibility = true;

                    double MinNormalWidth = (double)Application.Current.Resources["NormalMinWidth"];
                    if (MinNormalWidth > ApplicationView.GetForCurrentView().VisibleBounds.Width)
                    {
                        MasterFrame = new GridLength(0);
                    }

                    Messenger.Send(msg);
                }
            }
        }