示例#1
0
        /// <summary>
        /// Get total width based on all <paramref name="appMenu"/> items.
        /// </summary>
        public static async Task <int> TotalWidthAsync(this IAppMenu appMenu)
        {
            var generalMenuItems = appMenu
                                   .LoadGeneral()
                                   .ToArray();

            var jobMenuItems = await appMenu
                               .LoadJobsAsync()
                               .ToArrayAsync()
                               .ConfigureAwait(false);

            return(generalMenuItems
                   .Concat(jobMenuItems)
                   .Max(item => item.Name.Length) + 4);
        }
示例#2
0
        /// <summary>
        /// Perform initialization.
        /// </summary>
        public async Task <JobsMenu> InitializeAsync(Pos verticalOffset)
        {
            this.Titled("jobs")
            .WithVerticalOffset(verticalOffset);

            Width = await appMenu.TotalWidthAsync().ConfigureAwait(false);

            Height = Dim.Fill();

            Add(jobButtonsFrame.Initialize());

            var jobMenuItems = await appMenu
                               .LoadJobsAsync()
                               .ToArrayAsync()
                               .ConfigureAwait(false);

            jobMenuItems
            .AsListView()
            .FillDimensions()
            .WithVerticalOffset(Pos.Bottom(jobButtonsFrame))
            .To(Add);

            return(this);
        }