Beispiel #1
0
        internal static void ProcessAsync(AppJson appJson)
        {
            if (UtilSession.Request(appJson, CommandEnum.BulmaNavbarItemIsClick, out CommandJson commandJson, out BulmaNavbar navbar))
            {
                var  navbarItem = navbar.ItemListAll().Single(item => item.Id == commandJson.BulmaNavbarItemId);
                Grid grid       = navbarItem.Grid;

                // User clicked navbar button
                if (navbarItem.ItemEnum == BulmaNavbarItemEnum.Text)
                {
                    appJson.RequestJson.CommandAdd(new CommandJson {
                        CommandEnum = CommandEnum.GridIsClickRow, ComponentId = grid.Id, RowStateId = navbarItem.RowStateId
                    });
                }

                // User changed navbar filter text
                if (navbarItem.ItemEnum == BulmaNavbarItemEnum.Filter)
                {
                    string filterText = commandJson.BulmaFilterText;
                    int    rowStateId = navbarItem.RowStateId;

                    var column = grid.ColumnList.Single(item => item.FieldNameCSharp == navbarItem.FilterFieldNameCSharp);
                    var cell   = grid.CellList.Single(item => item.RowStateId == rowStateId && item.ColumnId == column.Id && item.CellEnum == GridCellEnum.Filter);

                    appJson.RequestJson.CommandAdd(new CommandJson {
                        CommandEnum = CommandEnum.GridCellIsModify, ComponentId = grid.Id, RowStateId = navbarItem.RowStateId, GridCellId = cell.Id, GridCellText = filterText
                    });
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// User clicked home button for example on navbar.
        /// </summary>
        public static Task ProcessHomeIsClickAsync(AppJson appJson)
        {
            if (UtilSession.Request(appJson, CommandEnum.HomeIsClick, out _, out ComponentJson _))
            {
                // User clicked home button
            }

            return(Task.FromResult(0));
        }
Beispiel #3
0
 /// <summary>
 /// User clicked internal link or clicked backward, forward navigation history. Instead of GET and download Angular again a POST command is sent.
 /// </summary>
 public static async Task ProcessNavigateLinkAsync(AppJson appJson)
 {
     // User clicked internal link.
     if (UtilSession.Request(appJson, RequestCommand.NavigateLink, out CommandJson commandJson, out ComponentJson _))
     {
         await appJson.NavigateSessionInternalAsync(commandJson.NavigateLinkPath, commandJson.NavigateLinkPathIsAddHistory);
     }
     // User clicked backward, forward navigation button.
     if (UtilSession.Request(appJson, RequestCommand.NavigateLinkBackwardForward, out commandJson, out ComponentJson _))
     {
         await appJson.NavigateSessionInternalAsync(commandJson.NavigateLinkPath, commandJson.NavigateLinkPathIsAddHistory);
     }
 }
Beispiel #4
0
        /// <summary>
        /// User clicked internal link or user clicked backward or forward button in browser. Instead of GET and download Angular again a POST command is sent.
        /// </summary>
        public static async Task ProcessNavigatePostAsync(AppJson appJson)
        {
            // User clicked internal link.
            if (UtilSession.Request(appJson, CommandEnum.NavigatePost, out CommandJson commandJson, out ComponentJson _))
            {
                await appJson.NavigateSessionInternalAsync(commandJson.NavigatePath, commandJson.NavigatePathIsAddHistory);
            }

            // User clicked backward or forward button in browser.
            if (UtilSession.Request(appJson, CommandEnum.NavigateBackwardForward, out commandJson, out ComponentJson _))
            {
                await appJson.NavigateSessionInternalAsync(commandJson.NavigatePath, commandJson.NavigatePathIsAddHistory);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Process navbar button click.
 /// </summary>
 public static async Task ProcessBootstrapNavbarAsync(AppJson appJson)
 {
     if (UtilSession.Request(appJson, CommandEnum.BootstrapNavbarButtonIsClick, out CommandJson commandJson, out BootstrapNavbar navbar))
     {
         if (navbar.ButtonList != null)
         {
             var buttonList = new List <BootstrapNavbarButton>();
             ProcessBootstrapNavbarButtonListAll(navbar.ButtonList, buttonList);
             foreach (BootstrapNavbarButton button in buttonList)
             {
                 if (commandJson.BootstrapNavbarButtonId == button.Id)
                 {
                     GridRowState rowState = button.Grid.RowStateList[button.RowStateId - 1];
                     await UtilGrid.RowSelectAsync(button.Grid, rowState, isRender : true);
                 }
             }
         }
     }
 }