예제 #1
0
        protected virtual void UpdateFlyoutHeader()
        {
            if (_headerView != null)
            {
                var oldHeaderView = _headerView;
                _headerView = null;
                _appBar.RemoveView(oldHeaderView);
                oldHeaderView.Dispose();
            }

            if (_flyoutHeader != null)
            {
                _flyoutHeader.MeasureInvalidated -= OnFlyoutHeaderMeasureInvalidated;
            }

            _flyoutHeader = ((IShellController)_shellContext.Shell).FlyoutHeader;
            if (_flyoutHeader != null)
            {
                _flyoutHeader.MeasureInvalidated += OnFlyoutHeaderMeasureInvalidated;
            }

            _headerView = new HeaderContainer(_shellContext.AndroidContext, _flyoutHeader)
            {
                MatchWidth = true
            };
            _headerView.SetMinimumHeight(_actionBarHeight);
            _headerView.LayoutParameters = new AppBarLayout.LayoutParams(LP.MatchParent, LP.WrapContent)
            {
                ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll
            };
            _appBar.AddView(_headerView);
            UpdateFlyoutHeaderBehavior();

            UpdateContentLayout();
        }
예제 #2
0
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _shellContext.Shell.PropertyChanged -= OnShellPropertyChanged;

                    if (_flyoutHeader != null)
                    {
                        _flyoutHeader.MeasureInvalidated += OnFlyoutHeaderMeasureInvalidated;
                    }

                    _headerView.Dispose();
                    _rootView.Dispose();
                    _defaultBackgroundColor?.Dispose();
                    _bgImage?.Dispose();
                }

                _flyoutHeader           = null;
                _defaultBackgroundColor = null;
                _bgImage      = null;
                _rootView     = null;
                _headerView   = null;
                _shellContext = null;
                _disposed     = true;
            }
            base.Dispose(disposing);
        }
        protected virtual void LoadView(IShellContext shellContext)
        {
            var context = shellContext.AndroidContext;

            // Android designer can't load fragments or resources from layouts
            if (context.IsDesignerContext())
            {
                _rootView = new FrameLayout(context);
                return;
            }

            var coordinator = LayoutInflater.FromContext(context).Inflate(Resource.Layout.FlyoutContent, null);
            var recycler    = coordinator.FindViewById <RecyclerView>(Resource.Id.flyoutcontent_recycler);
            var appBar      = coordinator.FindViewById <AppBarLayout>(Resource.Id.flyoutcontent_appbar);

            _rootView = coordinator;

            appBar.AddOnOffsetChangedListener(this);

            int actionBarHeight = (int)context.ToPixels(56);

            _headerView = new HeaderContainer(context, ((IShellController)shellContext.Shell).FlyoutHeader)
            {
                MatchWidth = true
            };
            _headerView.SetMinimumHeight(actionBarHeight);
            _headerView.LayoutParameters = new AppBarLayout.LayoutParams(LP.MatchParent, LP.WrapContent)
            {
                ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll
            };
            appBar.AddView(_headerView);

            var adapter = new ShellFlyoutRecyclerAdapter(shellContext, OnElementSelected);

            recycler.SetPadding(0, (int)context.ToPixels(20), 0, 0);
            recycler.SetClipToPadding(false);
            recycler.SetLayoutManager(new LinearLayoutManager(context, (int)Orientation.Vertical, false));
            recycler.SetAdapter(adapter);

            var metrics = context.Resources.DisplayMetrics;
            var width   = Math.Min(metrics.WidthPixels, metrics.HeightPixels);

            using (TypedValue tv = new TypedValue())
            {
                if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ActionBarSize, tv, true))
                {
                    actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, metrics);
                }
            }

            width -= actionBarHeight;

            coordinator.LayoutParameters = new LP(width, LP.MatchParent);

            UpdateFlyoutHeaderBehavior();
            _shellContext.Shell.PropertyChanged += OnShellPropertyChanged;

            UpdateFlyoutBackgroundColor();
        }
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                _shellContext.Shell.PropertyChanged -= OnShellPropertyChanged;

                if (_flyoutHeader != null)
                {
                    _flyoutHeader.MeasureInvalidated -= OnFlyoutHeaderMeasureInvalidated;
                }

                if (_appBar != null)
                {
                    _appBar.RemoveOnOffsetChangedListener(this);
                    _appBar.RemoveView(_headerView);
                }

                if (_rootView != null && _footerView?.NativeView != null)
                {
                    _rootView.RemoveView(_footerView.NativeView);
                }

                if (_recycler != null)
                {
                    _recycler.SetLayoutManager(null);
                    _recycler.SetAdapter(null);
                    _recycler.Dispose();
                }

                _adapter?.Dispose();
                _headerView.Dispose();
                _footerView?.TearDown();
                _rootView.Dispose();
                _layoutManager?.Dispose();
                _defaultBackgroundColor?.Dispose();
                _bgImage?.Dispose();

                _flyoutHeader           = null;
                _rootView               = null;
                _headerView             = null;
                _shellContext           = null;
                _appBar                 = null;
                _recycler               = null;
                _adapter                = null;
                _defaultBackgroundColor = null;
                _layoutManager          = null;
                _bgImage                = null;
                _footerView             = null;
            }

            base.Dispose(disposing);
        }
예제 #5
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     BodyContainer.Navigate(new AuthorizationPage());
     header = new Header();
     HeaderContainer.Navigate(header);
     footer = new Footer();
     FooterContainer.Navigate(footer);
 }
예제 #6
0
 public static HeaderContainer <DateTime, IIndependenceTerm, int> Initial(this HeaderContainer <DateTime, IIndependenceTerm, int> obj,
                                                                          DateTime date, bool autoAddnewEmptyAssignment)
 {
     obj.Items = autoAddnewEmptyAssignment ? new List <IIndependenceTerm> {
         new UnknowAssignment(date, TimeSpan.FromDays(1))
     } : new List <IIndependenceTerm>();
     return(obj);
 }
예제 #7
0
            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
            {
                var header    = (IHeader)value;
                var container = new HeaderContainer {
                    Key = header.Key, Value = header.GetValueBytes()
                };

                serializer.Serialize(writer, container);
            }
예제 #8
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                _shellContext.Shell.PropertyChanged -= OnShellPropertyChanged;

                if (_flyoutHeader != null)
                {
                    _flyoutHeader.MeasureInvalidated -= OnFlyoutHeaderMeasureInvalidated;
                }

                if (_appBar != null)
                {
                    _appBar.RemoveOnOffsetChangedListener(this);
                    _appBar.RemoveView(_headerView);
                }

                if (_rootView != null && _footerView?.PlatformView != null)
                {
                    _rootView.RemoveView(_footerView.PlatformView);
                }

                if (View != null && View is ShellFlyoutLayout sfl)
                {
                    sfl.LayoutChanging -= OnFlyoutViewLayoutChanged;
                }

                _contentView?.TearDown();
                _flyoutContentView?.Dispose();
                _headerView.Dispose();
                _footerView?.TearDown();
                _rootView.Dispose();
                _defaultBackgroundColor?.Dispose();
                _bgImage?.Dispose();

                _contentView            = null;
                _flyoutHeader           = null;
                _rootView               = null;
                _headerView             = null;
                _shellContext           = null;
                _appBar                 = null;
                _flyoutContentView      = null;
                _defaultBackgroundColor = null;
                _bgImage                = null;
                _footerView             = null;
            }

            base.Dispose(disposing);
        }
예제 #9
0
        public PackageGroup(string groupName, bool hidden = false)
        {
            name = groupName;
            root = Resources.GetTemplate("PackageGroup.uxml");
            Add(root);

            HeaderTitle.text = groupName;
            HeaderTitle.ShowTextTooltipOnSizeChange();

            if (hidden)
            {
                HeaderContainer.AddToClassList(k_HiddenHeaderClass);
            }
            HeaderContainer.RegisterCallback <MouseDownEvent>(TogglePackageGroup);
        }
예제 #10
0
        public void BuildOnlines()
        {
            //start, end 为阔展查询范围

            _dailyContainer.Clear();

            var totalDays = Convert.ToInt32(_enquiryRange.Duration.TotalDays); //_dateStorage.Count;

            DayOffRemains = totalDays;

            _onlines = _timeBox.TermSet.ConvertToCell(_enquiryRange, CellUnit, t => t.OnService, item =>
                                                      item.SaftyInvoke <IIndependenceTerm>(t =>
            {
                //HrDate使用
                var date    = t.SaftyGetHrDate();
                var dateKey = date.IndexOf(_timeBox.Boundary.Start);

                if (dateKey != -1)
                {
                    if (!_dailyContainer.ContainsKey(dateKey))
                    {
                        _dailyContainer[dateKey] = new HeaderContainer <DateTime, IIndependenceTerm, int>(date, i => i).Initial(date, false);
                        if (t.IsNot <IOffWork>())
                        {
                            DayOffRemains--;
                        }
                    }
                    _dailyContainer[dateKey].Items.Add(t);
                }
            })
                                                      );


            var zeroBasedStartDate = _timeBox.Boundary.Start; //_enquiryRange.Start.Date.AddDays(-Global.HeadDayAmount); // range.start - 1day

            for (var i = 0; i < totalDays; i++)
            {
                if (_dailyContainer.ContainsKey(i))
                {
                    continue;
                }
                var dateKey = zeroBasedStartDate.AddDays(i);
                _dailyContainer[i] = new HeaderContainer <DateTime, IIndependenceTerm, int>(dateKey, @int => @int).Initial(dateKey, true);
            }
        }
예제 #11
0
        protected virtual void UpdateFlyoutHeader()
        {
            if (_headerView != null)
            {
                _headerView.LayoutChange -= OnHeaderViewLayoutChange;
                var oldHeaderView = _headerView;
                _headerView = null;
                _appBar.RemoveView(_headerFrameLayout);
                _headerFrameLayout.RemoveView(oldHeaderView);
                oldHeaderView.Dispose();
            }

            if (_flyoutHeader != null)
            {
                _flyoutHeader.MeasureInvalidated -= OnFlyoutHeaderMeasureInvalidated;
            }

            _flyoutHeader = ((IShellController)_shellContext.Shell).FlyoutHeader;
            if (_flyoutHeader != null)
            {
                _flyoutHeader.MeasureInvalidated += OnFlyoutHeaderMeasureInvalidated;

                _headerFrameLayout ??= new FrameLayout(_rootView.Context);

                _headerView = new HeaderContainer(_rootView.Context, _flyoutHeader, MauiContext)
                {
                    MatchWidth = true
                };

                _headerView.LayoutChange += OnHeaderViewLayoutChange;

                _headerFrameLayout.LayoutParameters = new AppBarLayout.LayoutParams(LP.MatchParent, LP.WrapContent)
                {
                    ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll
                };

                _headerFrameLayout.AddView(_headerView);
                _appBar.AddView(_headerFrameLayout);

                UpdateFlyoutHeaderBehavior();
            }

            UpdateContentPadding();
        }
예제 #12
0
 public void ClearDisplays(bool deletePorts)
 {
     HeaderContainer.Clear();
     PreTitleContainer.Clear();
     PostTitleContainer.Clear();
     PrimaryBodyContainer.Clear();
     InportContainer?.ClearContainers();
     for (int i = 0; i < OutportContainers.Count; i++)
     {
         OutportContainers[i]?.ClearContainers();
     }
     if (deletePorts)
     {
         OutportContainers.Clear();
         AllOutportsContainer.Clear();
     }
     SecondaryBodyContainer.Clear();
     FooterContainer.Clear();
     UpdateColor();
 }
        public static AbstractScorePage GetScorePage()
        {
            var header = new HeaderContainer(1200, 60);

            header.AddTitle("TEST TITLE");
            var footer = new FooterContainer(1200, 20);

            footer.AddCopyRights("COPYRIGHTS TEXT TEST");

            var contentContainer = new ContentContainer(1200, 600);
            var rowContainer     = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 40
            };
            var rowContainer2 = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 180
            };
            var rowContainer3 = new SimpleRowContainer(new System.Windows.Rect(0, 0, 1140, 100))
            {
                Y = 320
            };

            rowContainer.AddItem(new MeasurePrototypeItem(100));
            rowContainer2.AddItem(new MeasurePrototypeItem(100));
            rowContainer3.AddItem(new MeasurePrototypeItem(100));

            contentContainer.AddRowContainer(rowContainer);
            contentContainer.AddRowContainer(rowContainer2);
            contentContainer.AddRowContainer(rowContainer3);
            var pageElements = new List <AbstractPageElement> {
                header,
                contentContainer,
                footer
            };
            var pageLayout = new WrappedLayout(pageElements);
            var scorePage  = new StandardScorePage("ADVANCED_LAYOUT_TEST", pageLayout);

            scorePage.UpdateContent();
            return(scorePage);
        }
        protected override void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    _shellContext.Shell.PropertyChanged -= OnShellPropertyChanged;
                    _headerView.Dispose();
                    _rootView.Dispose();
                    _defaultBackground?.Dispose();
                }

                _defaultBackground = null;
                _rootView          = null;
                _headerView        = null;
                _shellContext      = null;
                _disposed          = true;
            }

            base.Dispose(disposing);
        }
예제 #15
0
        protected virtual void LoadView(IShellContext shellContext)
        {
            Profile.FrameBegin();

            var context = shellContext.AndroidContext;

            // Android designer can't load fragments or resources from layouts
            if (context.IsDesignerContext())
            {
                _rootView = new FrameLayout(context);
                return;
            }

            var coordinator = LayoutInflater.FromContext(context).Inflate(Resource.Layout.FlyoutContent, null);

            Profile.FramePartition("Find Recycler");
            var recycler = coordinator.FindViewById <RecyclerView>(Resource.Id.flyoutcontent_recycler);

            Profile.FramePartition("Find AppBar");
            var appBar = coordinator.FindViewById <AppBarLayout>(Resource.Id.flyoutcontent_appbar);

            _rootView = coordinator as ViewGroup;

            Profile.FramePartition("Add Listener");
            appBar.AddOnOffsetChangedListener(this);

            Profile.FramePartition("Add HeaderView");
            _actionBarHeight = (int)context.ToPixels(56);

            _flyoutHeader = ((IShellController)shellContext.Shell).FlyoutHeader;
            if (_flyoutHeader != null)
            {
                _flyoutHeader.MeasureInvalidated += OnFlyoutHeaderMeasureInvalidated;
            }

            _headerView = new HeaderContainer(context, _flyoutHeader)
            {
                MatchWidth = true
            };
            _headerView.SetMinimumHeight(_actionBarHeight);
            _headerView.LayoutParameters = new AppBarLayout.LayoutParams(LP.MatchParent, LP.WrapContent)
            {
                ScrollFlags = AppBarLayout.LayoutParams.ScrollFlagScroll
            };
            appBar.AddView(_headerView);

            Profile.FramePartition("Recycler.SetAdapter");
            var adapter = new ShellFlyoutRecyclerAdapter(shellContext, OnElementSelected);

            recycler.SetClipToPadding(false);
            recycler.SetLayoutManager(_layoutManager = new ScrollLayoutManager(context, (int)Orientation.Vertical, false));
            recycler.SetAdapter(adapter);

            Profile.FramePartition("Initialize BgImage");
            var metrics = context.Resources.DisplayMetrics;
            var width   = Math.Min(metrics.WidthPixels, metrics.HeightPixels);

            using (TypedValue tv = new TypedValue())
            {
                if (context.Theme.ResolveAttribute(global::Android.Resource.Attribute.ActionBarSize, tv, true))
                {
                    _actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, metrics);
                }
            }

            width -= _actionBarHeight;

            coordinator.LayoutParameters = new LP(width, LP.MatchParent);

            _bgImage = new ImageView(context)
            {
                LayoutParameters = new LP(coordinator.LayoutParameters)
            };

            Profile.FramePartition("UpdateFlyoutHeaderBehavior");
            UpdateFlyoutHeaderBehavior();
            _shellContext.Shell.PropertyChanged += OnShellPropertyChanged;

            Profile.FramePartition("UpdateFlyoutBackground");
            UpdateFlyoutBackground();

            Profile.FrameEnd();

            Profile.FramePartition(nameof(UpdateVerticalScrollMode));
            UpdateVerticalScrollMode();
            Profile.FrameEnd();
        }
예제 #16
0
 private void WhenShiftEstimatesChanged(HeaderContainer <AssignmentType, DailyCounter <AssignmentType>, DateTime> o)
 {
     _shiftEstimatesChanged = true;
 }
예제 #17
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                Disconnect();

                if (_appBar != null)
                {
                    _appBar.RemoveOnOffsetChangedListener(this);

                    if (_headerFrameLayout != null)
                    {
                        _appBar.RemoveView(_headerFrameLayout);
                    }
                }

                if (_rootView != null && _footerView != null)
                {
                    _rootView.RemoveView(_footerView);
                }

                if (View != null && View is ShellFlyoutLayout sfl)
                {
                    sfl.LayoutChanging -= OnFlyoutViewLayoutChanging;
                }

                if (_headerView != null)
                {
                    _headerView.LayoutChange -= OnHeaderViewLayoutChange;
                }

                if (_contentView != null)
                {
                    _contentView.View = null;
                }

                _flyoutContentView?.Dispose();
                _headerView?.Dispose();

                _rootView?.Dispose();
                _defaultBackgroundColor?.Dispose();
                _bgImage?.Dispose();

                _contentView            = null;
                _rootView               = null;
                _headerView             = null;
                _shellContext           = null;
                _appBar                 = null;
                _flyoutContentView      = null;
                _defaultBackgroundColor = null;
                _bgImage                = null;
                _footerView             = null;
            }

            base.Dispose(disposing);
        }
예제 #18
0
        private void Load()
        {
            RelativeSizeAxes     = Axes.Both;
            RelativePositionAxes = Axes.Both;

            Children = new Drawable[]
            {
                textBox = new BasicTextBox
                {
                    Anchor = Anchor.BottomLeft,
                    Origin = Anchor.BottomLeft,
                    Size   = new Vector2(200, 40),
                },
                search = new SearchContainer
                {
                    Anchor = Anchor.TopRight,
                    Origin = Anchor.TopRight,

                    RelativeSizeAxes = Axes.X,
                    Size             = new Vector2(1f),

                    AutoSizeAxes = Axes.Y,

                    Child = head = new HeaderContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        Size             = new Vector2(1f),
                        AutoSizeAxes     = Axes.Y,
                    },
                }
            };

            var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location) + "\\Songs\\TestMap\\Difficulty1.ini";

            MapPack mapPack = new MapPack(new []
            {
                new Map(path, "random text"),
                new Map(path, "title of this test map")
            });

            var mapPackReversed = mapPack.Maps.Reverse().ToArray();

            List <MapPackDrawer> mapPackDrawer = new List <MapPackDrawer>();
            List <MapPack>       mapPacksGot   = new List <MapPack>()
            {
                mapPack, new MapPack(mapPackReversed)
            };

            mapPacksGot.ForEach((x) =>
            {
                mapPackDrawer.Add(new MapPackDrawer(x.Maps, x.Maps[0].Title)
                {
                    RelativeSizeAxes = Axes.X,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Colour           = Color4.Blue,
                });
            });

            head.AddRange(mapPackDrawer);

            textBox.Current.ValueChanged += e => search.SearchTerm = e.NewValue;
        }
예제 #19
0
        public static HeaderContainer <T, DailyCounter <T>, DateTime> BuildDailyCounter <T>(this HeaderContainer <T, DailyCounter <T>, DateTime> obj, DailyCounter <T>[] sources,
                                                                                            Action <DailyCounter <T> > instanceCreated, DateTime initial, int days)
        {
            var results = new DailyCounter <T> [days];

            var addedCount = 0;

            foreach (var item in sources)
            {
                var i = item.Date.GetIndex(initial, 1440, days);
                if (i < 0 || i >= results.Length)
                {
                    continue;
                }
                results[i] = item;
                addedCount++;
            }

            if (addedCount < days)
            {
                for (var i = 0; i < days; i++)
                {
                    if (results[i] == null)
                    {
                        results[i] = new DailyCounter <T>(obj.Header, initial.AddDays(i), 0);
                        instanceCreated(results[i]);
                    }
                }
            }

            obj.Items = new List <DailyCounter <T> >(results);
            return(obj);
        }
 private void WhenShiftEstimatesChanged(HeaderContainer<AssignmentType, DailyCounter<AssignmentType>, DateTime> o)
 {
     _shiftEstimatesChanged = true;
 }
예제 #21
0
        public void SetUp() => Schedule(() =>
        {
            Children = new Drawable[]
            {
                textBox = new BasicTextBox
                {
                    Size = new Vector2(300, 40),
                },
                search = new SearchContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Margin       = new MarginPadding {
                        Top = 40
                    },
                    Children = new[]
                    {
                        new HeaderContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Children     = new[]
                            {
                                new HeaderContainer("Subsection 1")
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new Drawable[]
                                    {
                                        new SearchableText {
                                            Text = "test",
                                        },
                                        new SearchableText {
                                            Text = "TEST",
                                        },
                                        new SearchableText {
                                            Text = "123",
                                        },
                                        new SearchableText {
                                            Text = "444",
                                        },
                                        new FilterableFlowContainer
                                        {
                                            Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both,
                                            Children  = new[]
                                            {
                                                new SpriteText {
                                                    Text = "multi",
                                                },
                                                new SpriteText {
                                                    Text = "piece",
                                                },
                                                new SpriteText {
                                                    Text = "container",
                                                },
                                            }
                                        },
                                        new SearchableText {
                                            Text = "öüäéèêáàâ",
                                        }
                                    }
                                },
                                header = new HeaderContainer("Subsection 2")
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Children     = new[]
                                    {
                                        new SearchableText {
                                            Text = "?!()[]{}"
                                        },
                                        new SearchableText {
                                            Text = "@€$"
                                        },
                                    },
                                },
                            },
                        }
                    }
                }
            };

            textBox.Current.ValueChanged += e => search.SearchTerm = e.NewValue;
        });
예제 #22
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            HeaderContainer.InsertSeparator();
        }
예제 #23
0
        private void EnsureHeaderContainer()
        {
            if (myHeaderContainer == null)
            {
                if (myHeaderBounds.HasHeaders && DisplayColumnHeaders)
                {
                    myHeaderContainer = new HeaderContainer(this);

                    // forces evaluation of Handle
                    var handle = myHeaderContainer.Handle;
                }
            }
        }