示例#1
0
        public ActionResult MenuHeader()
        {
            List <MenuHeader> list = new List <MenuHeader>();
            MenuHeader        mnh  = new MenuHeader();

            mnh.Menu = "Sản Phẩm";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "Hướng dẫn mua hàng";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "thanh toán và vận chuyển";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "chính sách mua sỉ";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "chính sách đại lý va ctv";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "tin tức";
            list.Add(mnh);

            mnh      = new MenuHeader();
            mnh.Menu = "liên hệ";
            list.Add(mnh);

            return(View(list));
        }
示例#2
0
        public async Task <IActionResult> Edit(int id, [Bind("MenuHeaderId,ApplicationCode,Comment,ImageUri,MenuHeaderParentId,Name,RoleId,Timestamp,Title,VersionNumber")] MenuHeader val)
        {
            if (val.MenuHeaderId != id)
            {
                return(NotFound());
            }

            this.FixNullFields(val);

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(val);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Exists(val.MenuHeaderId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuHeaderParentId"] = new SelectList(_context.MenuHeader, "MenuHeaderId", "Name", val.MenuHeaderParentId);
            ViewData["RoleId"]             = new SelectList(_context.Role, "RoleId", "Description", val.RoleId);
            return(View(val));
        }
示例#3
0
        public ActionResult AddMenuHeader(MenuHeader MenuHeader, int IDRestaurant, int IDMenu)
        {
            MenuHeader.IdMenu = IDMenu;
            Core.AddMenuHeader(MenuHeader);

            return(RedirectToAction("Menu", "Menu", IDMenu));
        }
示例#4
0
文件: Menu.cs 项目: lanceewing/agile
        /// <summary>
        /// Shows the menu items for the given MenuHeader.
        /// </summary>
        /// <param name="header">The MenuHeader to show the menu items of.</param>
        private void ShowMenu(MenuHeader header)
        {
            // Interestingly, it would seem that the width is always calculated using the first item. The
            // original AGI games tended to make the item names a consistent length within each menu.
            MenuItem firstItem = (header.Items.Count > 0 ? header.Items[0] : null);
            int      height    = header.Height;
            int      width     = (firstItem != null ? firstItem.Name.Length : header.Title.Name.Length);
            int      column    = (firstItem != null ? firstItem.Col : header.Title.Col);

            // Compute window size and position and put them into the appropriate bytes of the words.
            int menuDim = ((height * CHARHEIGHT + 2 * VMARGIN) << 8) | (width * CHARWIDTH + 2 * HMARGIN);
            int menuPos = (((column - 1) * CHARWIDTH) << 8) | ((height + 1) * CHARHEIGHT + VMARGIN - 1);

            // Show the menu title as being selected.
            Select(header.Title);

            // Open a window for this menu using the calculated position and dimensions.
            textGraphics.OpenWindow(new TextWindow(menuPos, menuDim, 15, 0));

            // Render each of the items in this menu.
            foreach (MenuItem item in header.Items)
            {
                if (item == header.CurrentItem)
                {
                    Select(item);
                }
                else
                {
                    Deselect(item);
                }
            }
        }
示例#5
0
        public ActionResult AddMenuItem(MenuItem MenuItem, int IDHeader)
        {
            MenuHeader MenuHeader = Core.GetMenuHeaderById(IDHeader);

            MenuItem.MenuHeader = MenuHeader;
            Core.AddMenuItem(MenuItem);
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
示例#6
0
 /// <summary>
 /// </summary>
 private void CreateMenuHeader()
 {
     MenuHeader = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_gamepad_console), "score", "results",
                                 "View in-depth results of a play", ColorHelper.HexToColor("#69acc5"))
     {
         Parent = Container
     };
 }
 /// <summary>
 /// </summary>
 private void CreateHeader()
 {
     Header = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_gamepad_console), "Song", "Select",
                             "Select a map to play", Colors.MainAccent)
     {
         Parent    = Container,
         Alignment = Alignment.TopLeft
     };
 }
 /// <summary>
 /// </summary>
 private void CreateMenuHeader()
 {
     Header = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_download_to_storage_drive), "Download", "Maps",
                             "Download new maps to play", Colors.MainAccent)
     {
         Parent    = Container,
         Alignment = Alignment.TopLeft
     };
 }
示例#9
0
        /// <summary>
        /// </summary>
        private void CreateHeader()
        {
            Header = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_group_profile_users), "MULTIPLAYER", "LOBBY",
                                    "find or create an online match", Colors.MainAccent)
            {
                Parent = Container
            };

            Header.Y = -Header.Height;
            Header.MoveToY(0, Easing.OutQuint, 600);
        }
示例#10
0
        /// <summary>
        /// </summary>
        private void CreateHeader()
        {
            Header = new MenuHeader(FontAwesome.Get(FontAwesomeIcon.fa_earth_globe), "MULTIPLAYER", "GAME",
                                    "play a match in real-time with others", Colors.MainAccent)
            {
                Parent = Container
            };

            Header.Y = -Header.Height;
            Header.MoveToY(0, Easing.OutQuint, 600);
        }
示例#11
0
        public async Task <IActionResult> Create([Bind("MenuHeaderId,ApplicationCode,Comment,ImageUri,MenuHeaderParentId,Name,RoleId,Timestamp,Title,VersionNumber")] MenuHeader val)
        {
            this.FixNullFields(val);
            if (ModelState.IsValid)
            {
                _context.Add(val);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MenuHeaderParentId"] = new SelectList(_context.MenuHeader, "MenuHeaderId", "Name", val.MenuHeaderParentId);
            ViewData["RoleId"]             = new SelectList(_context.Role, "RoleId", "Description", val.RoleId);
            return(View(val));
        }
示例#12
0
文件: Menu.cs 项目: lanceewing/agile
        /// <summary>
        /// Signals to the menu system that the menu has now been fully defined. No further SetMenu
        /// or SetMenuItem calls will be processed. The current header and item is reset back to the
        /// first item in the first menu, ready for usage when the menu is activated.
        /// </summary>
        public void SubmitMenu()
        {
            // If the last menu didn't have any items, disable it.
            if (currentHeader.Items.Count == 0)
            {
                currentHeader.Title.Enabled = false;
            }

            // Make the first menu the current one.
            currentHeader = (headers.Count > 0? headers[0] : null);
            currentItem   = ((currentHeader != null) && (currentHeader.Items.Count > 0) ? currentHeader.Items[0] : null);

            // Remember that the submit has happened. We can't process menu definitions after submit.menu
            menuSubmitted = true;
        }
示例#13
0
 private void FixNullFields(MenuHeader val)
 {
     if (String.IsNullOrWhiteSpace(val.Comment))
     {
         val.Comment = "N/A";
     }
     if (String.IsNullOrWhiteSpace(val.ImageUri))
     {
         val.ImageUri = "N/A";
     }
     if (String.IsNullOrWhiteSpace(val.Name))
     {
         val.Name = "N/A";
     }
     if (String.IsNullOrWhiteSpace(val.Title))
     {
         val.Title = "N/A";
     }
 }
示例#14
0
文件: Menu.cs 项目: lanceewing/agile
        /// <summary>
        /// Creates a new menu with the given name.
        /// </summary>
        /// <param name="menuName">The name of the new menu.</param>
        public void SetMenu(string menuName)
        {
            // We can't accept any more menu definitions if submit.menu has already been executed.
            if (menuSubmitted)
            {
                return;
            }

            if (currentHeader == null)
            {
                // The first menu header starts at column 1.
                menuCol = 1;
            }
            else if (currentHeader.Items.Count == 0)
            {
                // If the last header didn't have any items, then disable it.
                currentHeader.Title.Enabled = false;
            }

            // Create a new MenuHeader.
            MenuHeader header = new AGILE.Menu.MenuHeader();

            // Set the position of this menu name in the menu strip (leave two
            // chars between menu titles).
            header.Title         = new MenuItem();
            header.Title.Row     = 0;
            header.Title.Name    = menuName;
            header.Title.Col     = menuCol;
            header.Title.Enabled = true;
            header.Items         = new List <MenuItem>();
            header.Height        = 0;

            this.currentHeader = header;
            this.headers.Add(header);

            // Adjust the menu column for the next header.
            menuCol += menuName.Length + 1;

            // Initialize stuff for the menu items to follow.
            currentItem = null;
            itemRow     = 1;
        }
示例#15
0
        private void CreateMenuHeader()
        {
            Header = new MenuHeader(UserInterface.QuaverLogoStylish, "Main", "Menu", "Find something to play, or use the editor",
                                    Colors.MainAccent)
            {
                Parent    = Container,
                Alignment = Alignment.TopLeft
            };

            // ReSharper disable once ObjectCreationAsStatement
            new Sprite
            {
                Parent    = Header,
                Alignment = Alignment.MidLeft,
                X         = Header.Icon.X,
                Image     = UserInterface.QuaverLogoFull,
                Size      = new ScalableVector2(138, 30)
            };

            Header.Icon.Visible   = false;
            Header.Title.Visible  = false;
            Header.Title2.Visible = false;
        }
示例#16
0
        public List <MenuHeader> GetMenuHeadersByStoreIdCustomerId(string connectionString, string CustomerId, string StoreId)
        {
            List <MenuHeader> lm  = new List <MenuHeader>();
            string            Sql = "";

            #region SQL
            Sql += "select Bootstrap_Button,Colour,Html_Colour,[Description],Menu_ID,Priority_No,Hotline_No ";
            Sql += "from " + CustomerId + "_" + StoreId + "_" + "Menu_Header ";
            Sql += "order by Priority_No ";
            #endregion SQL
            #region Execute SQL
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                using (SqlCommand command = new SqlCommand(Sql, connection))
                {
                    SqlDataReader reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        MenuHeader m = new MenuHeader();
                        #region Fill Model
                        try{ m.BootstrapButton = reader.GetString(0); }catch {}
                        try{ m.Colour = reader.GetString(1); }catch {}
                        try{ m.HtmlColour = reader.GetString(2); }catch {}
                        try{ m.Description = reader.GetString(3); }catch {}
                        try{ m.MenuId = reader.GetString(4); }catch {}
                        try{ m.PriorityNo = reader.GetInt32(5); }catch {}
                        try{ m.HotlineNo = reader.GetInt32(6); }catch {}
                        #endregion Fill Model
                        lm.Add(m);
                    }
                }
            }
            #endregion Execute SQL
            return(lm);
        }
示例#17
0
        protected void ChangeSearchPhrase()
        {
            var parts        = (SearchPhrase.Value ?? string.Empty).Split(':');
            var database     = parts.Length > 1 ? parts[0] : string.Empty;
            var phrase       = parts.Length > 1 ? parts[1] : parts[0];
            var recentHeader = new MenuHeader();

            SearchResults.Controls.AddAt(0, recentHeader);
            Scripts.Controls.Clear();
            if (string.IsNullOrEmpty(phrase))
            {
                recentHeader.Header = "Most Recently opened scripts:";
                foreach (Item item in ApplicationSettings.GetIseMruContainerItem().Children)
                {
                    var messageString = item["Message"];
                    var message       = Message.Parse(null, messageString);
                    var db            = message.Arguments["db"];
                    var id            = message.Arguments["id"];
                    var scriptItem    = Factory.GetDatabase(db).GetItem(id);
                    if (scriptItem != null)
                    {
                        RenderRecent(scriptItem);
                    }
                }
            }
            else if (database.Length > 0)
            {
                recentHeader.Header = "Scripts matching: '" + phrase + "' in '" + database + "*' database";
                foreach (var index in ContentSearchManager.Indexes)
                {
                    if (index.Name.StartsWith("sitecore_" + database) &&
                        index.Name.EndsWith("_index"))
                    {
                        SearchDatabase(index.Name, phrase);
                    }
                }
            }
            else
            {
                recentHeader.Header = "Scripts matching: '" + phrase + "' in all databases";
                var masterIndex  = "sitecore_" + ApplicationSettings.ScriptLibraryDb + "_index";
                var scriptsFound = SearchDatabase(masterIndex, phrase);
                foreach (var index in ContentSearchManager.Indexes)
                {
                    if (!string.Equals(masterIndex, index.Name, StringComparison.OrdinalIgnoreCase) &&
                        index.Name.StartsWith("sitecore_") &&
                        index.Name.EndsWith("_index"))
                    {
                        scriptsFound |= SearchDatabase(index.Name, phrase);
                    }
                }
                if (!scriptsFound)
                {
                    Context.ClientPage.AddControl(Scripts,
                                                  new Literal {
                        Text = "<div class='noScript'><br/><br/>No scripts found... Do you need to re-index your databases?</div>"
                    });
                    Scripts.CssStyle = "text-align: center;";
                }
            }
            var writer = new HtmlTextWriter(new StringWriter());

            SearchResults.RenderControl(writer);
            SheerResponse.SetOuterHtml(SearchResults.ID, writer.InnerWriter.ToString());
        }
示例#18
0
        protected void ChangeSearchPhrase()
        {
            var parts = (SearchPhrase.Value ?? string.Empty).Split(':');
            var database = parts.Length > 1 ? parts[0] : string.Empty;
            var phrase = parts.Length > 1 ? parts[1] : parts[0];
            var recentHeader = new MenuHeader();
            SearchResults.Controls.AddAt(0, recentHeader);
            Scripts.Controls.Clear();
            if (string.IsNullOrEmpty(phrase))
            {
                recentHeader.Header = "Most Recently opened scripts:";
                foreach (Item item in ApplicationSettings.GetIseMruContainerItem().Children)
                {
                    var messageString = item["Message"];
                    var message = Message.Parse(null, messageString);
                    var db = message.Arguments["db"];
                    var id = message.Arguments["id"];
                    var scriptItem = Factory.GetDatabase(db).GetItem(id);
                    if (scriptItem != null)
                    {
                        RenderRecent(scriptItem);
                    }
                }

            }
            else if (database.Length > 0)
            {
                recentHeader.Header = "Scripts matching: '" + phrase + "' in '" + database + "*' database";
                foreach (var index in ContentSearchManager.Indexes)
                {
                    if (index.Name.StartsWith("sitecore_" + database) &&
                        index.Name.EndsWith("_index"))
                    {
                        SearchDatabase(index.Name, phrase);
                    }
                }
            }
            else
            {
                recentHeader.Header = "Scripts matching: '" + phrase + "' in all databases";
                var masterIndex = "sitecore_" + ApplicationSettings.ScriptLibraryDb + "_index";
                var scriptsFound = SearchDatabase(masterIndex, phrase);
                foreach (var index in ContentSearchManager.Indexes)
                {
                    if (!string.Equals(masterIndex, index.Name, StringComparison.OrdinalIgnoreCase) &&
                        index.Name.StartsWith("sitecore_") &&
                        index.Name.EndsWith("_index"))
                    {
                        scriptsFound |= SearchDatabase(index.Name, phrase);
                    }
                }
                if (!scriptsFound)
                {
                    Context.ClientPage.AddControl(Scripts,
                        new Literal {Text = "<div class='noScript'><br/><br/>No scripts found... Do you need to re-index your databases?</div>" });
                    Scripts.CssStyle = "text-align: center;";
                }
            }
            var writer = new HtmlTextWriter(new StringWriter());
            SearchResults.RenderControl(writer);
            SheerResponse.SetOuterHtml(SearchResults.ID, writer.InnerWriter.ToString());
        }
示例#19
0
        protected void ChangeSearchPhrase()
        {
            var parts        = (SearchPhrase.Value ?? string.Empty).Split(':');
            var database     = parts.Length > 1 ? parts[0] : string.Empty;
            var phrase       = parts.Length > 1 ? parts[1] : parts[0];
            var recentHeader = new MenuHeader();

            SearchResults.Controls.AddAt(0, recentHeader);
            Scripts.Controls.Clear();
            try
            {
                if (string.IsNullOrEmpty(phrase))
                {
                    recentHeader.Header =
                        Translate.Text(Texts.MruGallery_ChangeSearchPhrase_Most_Recently_opened_scripts_);
                    foreach (Item item in ApplicationSettings.GetIseMruContainerItem().Children)
                    {
                        var messageString = item["Message"];
                        var message       = Message.Parse(null, messageString);
                        var db            = message.Arguments["db"];
                        var id            = message.Arguments["id"];
                        var scriptItem    = Factory.GetDatabase(db).GetItem(id);
                        if (scriptItem != null)
                        {
                            RenderRecent(scriptItem);
                        }
                        else
                        {
                            item.Delete();
                        }
                    }
                }
                else if (database.Length > 0)
                {
                    recentHeader.Header =
                        Translate.Text(Texts.MruGallery_ChangeSearchPhrase_Scripts_matching____0___in___1____database,
                                       phrase, database);
                    foreach (var index in ContentSearchManager.Indexes)
                    {
                        if (index.Name.StartsWith("sitecore_" + database) &&
                            index.Name.EndsWith("_index"))
                        {
                            SearchDatabase(index.Name, phrase);
                        }
                    }
                }
                else
                {
                    recentHeader.Header =
                        Translate.Text(Texts.MruGallery_ChangeSearchPhrase_Scripts_matching____0___in_all_databases,
                                       phrase);
                    var masterIndex  = "sitecore_" + ApplicationSettings.ScriptLibraryDb + "_index";
                    var scriptsFound = SearchDatabase(masterIndex, phrase);
                    foreach (var index in ContentSearchManager.Indexes)
                    {
                        if (!string.Equals(masterIndex, index.Name, StringComparison.OrdinalIgnoreCase) &&
                            index.Name.StartsWith("sitecore_") &&
                            index.Name.EndsWith("_index"))
                        {
                            scriptsFound |= SearchDatabase(index.Name, phrase);
                        }
                    }
                    if (!scriptsFound)
                    {
                        ShowScriptEnumerationProblem();
                    }
                }
            }
            catch (Exception ex)
            {
                PowerShellLog.Error("Error while Showing MRU entries", ex);
                ShowScriptEnumerationProblem();
            }
            var writer = new HtmlTextWriter(new StringWriter());

            SearchResults.RenderControl(writer);
            SheerResponse.SetOuterHtml(SearchResults.ID, writer.InnerWriter.ToString());
        }
示例#20
0
 public void AddMenuHeader(MenuHeader MenuHeader)
 {
     Repository.AddMenuHeader(MenuHeader);
 }
示例#21
0
 public void AddMenuHeader(MenuHeader MenuHeader)
 {
     MenuHeaderRepository.AddMenuHeader(Context, MenuHeader);
 }
示例#22
0
文件: Menu.cs 项目: lanceewing/agile
 /// <summary>
 /// Puts away the menu so that it is no longer displayed, but remembers what item
 /// in the list was selected at the time it was put away.
 /// </summary>
 /// <param name="header">The MenuHeader representing the menu to put away.</param>
 /// <param name="item">The MenuItem that was currently selected in the menu when it was put away.</param>
 private void PutAwayMenu(MenuHeader header, MenuItem item)
 {
     header.CurrentItem = item;
     Deselect(header.Title);
     textGraphics.CloseWindow();
 }
示例#23
0
文件: Menu.cs 项目: lanceewing/agile
        /// <summary>
        /// Opens the menu system and processes all the navigation events until an item is either
        /// selected or the ESC key is pressed.
        /// </summary>
        public void MenuInput()
        {
            // Not sure why there is an ENABLE_MENU flag and the allow.menu command, but there is.
            if (state.Flags[Defines.ENABLE_MENU] && state.MenuEnabled)
            {
                // Clear the menu bar to white.
                textGraphics.ClearLines(0, 0, 15);

                // Draw each of the header titles in deselected mode.
                foreach (MenuHeader header in headers)
                {
                    Deselect(header.Title);
                }

                // Starts by showing the currently selected menu header and item.
                ShowMenu(currentHeader);

                // Now we process all navigation keys until we the user either makes a selection
                // or exits the menu system.
                while (true)
                {
                    int index;

                    switch (userInput.WaitForKey())
                    {
                    case (int)Keys.Enter:                 // Select the currently highlighted menu item.
                        if (!currentItem.Enabled)
                        {
                            continue;
                        }
                        state.Controllers[currentItem.Controller] = true;
                        PutAwayMenu(currentHeader, currentItem);
                        RestoreMenuLine();
                        state.MenuOpen = false;
                        return;

                    case (int)Keys.Escape:                // Exit the menu system without a selection.
                        PutAwayMenu(currentHeader, currentItem);
                        RestoreMenuLine();
                        state.MenuOpen = false;
                        return;

                    case (int)Keys.Up:                    // Moving up within current menu.
                        Deselect(currentItem);
                        index       = (currentHeader.Items.IndexOf(currentItem) + currentHeader.Items.Count - 1) % currentHeader.Items.Count;
                        currentItem = currentHeader.Items[index];
                        Select(currentItem);
                        break;

                    case (int)Keys.PageUp:                 // Move to top item of current menu.
                        Deselect(currentItem);
                        currentItem = currentHeader.Items.First();
                        Select(currentItem);
                        break;

                    case (int)Keys.Right:                  // Move to the menu on the right of the current menu..
                        PutAwayMenu(currentHeader, currentItem);
                        index = headers.IndexOf(currentHeader);
                        do
                        {
                            currentHeader = headers[(index = ((index + 1) % headers.Count))];
                        }while (!currentHeader.Title.Enabled);
                        currentItem = currentHeader.CurrentItem;
                        ShowMenu(currentHeader);
                        break;

                    case (int)Keys.PageDown:               // Move to bottom item of current menu.
                        Deselect(currentItem);
                        currentItem = currentHeader.Items.Last();
                        Select(currentItem);
                        break;

                    case (int)Keys.Down:                   // Move down within current menu.
                        Deselect(currentItem);
                        index       = (currentHeader.Items.IndexOf(currentItem) + 1) % currentHeader.Items.Count;
                        currentItem = currentHeader.Items[index];
                        Select(currentItem);
                        break;

                    case (int)Keys.End:                    // Move to the rightmost menu.
                        PutAwayMenu(currentHeader, currentItem);
                        currentHeader = headers.Last();
                        currentItem   = currentHeader.CurrentItem;
                        ShowMenu(currentHeader);
                        break;

                    case (int)Keys.Left:                   // Move left within current menu.
                        PutAwayMenu(currentHeader, currentItem);
                        index = headers.IndexOf(currentHeader);
                        do
                        {
                            currentHeader = headers[(index = ((index + headers.Count - 1) % headers.Count))];
                        }while (!currentHeader.Title.Enabled);
                        currentItem = currentHeader.CurrentItem;
                        ShowMenu(currentHeader);
                        break;

                    case (int)Keys.Home:                   // Move to the leftmost menu.
                        PutAwayMenu(currentHeader, currentItem);
                        currentHeader = headers.First();
                        currentItem   = currentHeader.CurrentItem;
                        ShowMenu(currentHeader);
                        break;
                    }
                }
            }
        }