예제 #1
0
        public void Initalize()
        {
            var tasksSection = new MenuSection <ItemCommand <ClientViewModel> >();

            var tasksSubMenu = new NavigationalEntry <ItemCommand <ClientViewModel> >
            {
                Header = Tx.T("TasksInfrastructure:CreateTask.Commands", 2), IsOrdered = true, Icon = _icons.SelectCommandColumn
            };

            InitializeCommands(tasksSubMenu);
            tasksSection.Add(tasksSubMenu);

            var createTaskCommand = new ItemCommand <ClientViewModel>
            {
                Header  = Tx.T("TasksInfrastructure:CreateTask"),
                Icon    = _icons.NewCatalog,
                Command = new DelegateCommand <ClientViewModel>(client => CreateTaskCommand(new List <ClientViewModel> {
                    client
                })),
                MultipleCommand = new DelegateCommand <IList <ClientViewModel> >(CreateTaskCommand)
            };

            tasksSection.Add(createTaskCommand);

            _clientsContextMenu.Add(tasksSection);
        }
예제 #2
0
        private void SelectMenuItem(MenuSection menuSection)
        {
            switch (menuSection)
            {
            case MenuSection.Map:
                this.ShowViewModel <MapViewModel>();
                _selectedMenuSection = MenuSection.Map;
                break;

            case MenuSection.Routes:
                this.ShowViewModel <RoutesViewModel>();
                _selectedMenuSection = MenuSection.Routes;
                this.IsBusy          = false;
                break;

            case MenuSection.RouteStops:
                this.ShowViewModel <RouteStopsViewModel>();
                _selectedMenuSection = MenuSection.RouteStops;
                this.IsBusy          = false;
                break;

            case MenuSection.Preferences:
                this.ShowViewModel <PreferencesViewModel>();
                _selectedMenuSection = MenuSection.Preferences;
                this.IsBusy          = false;
                break;

            case MenuSection.About:
                this.ShowViewModel <AboutViewModel>();
                _selectedMenuSection = MenuSection.About;
                this.IsBusy          = false;
                break;
            }
        }
예제 #3
0
 public void With_Should_Add_Current_MenuSection_And_Set_Parent()
 {
     var actual = new MenuSection("MyMenuSection");
     _sut.With(() => actual);
     Assert.IsTrue(_sut._menuSections.Contains(actual));
     Assert.AreEqual(actual.Parent,_sut);
 }
예제 #4
0
        private void LoadMenuFromConfiguration()
        {
            MenuSection menu = (MenuSection)ConfigurationManager.GetSection("Menu");

            foreach (Edge.Applications.PM.Client.Configuration.MenuItem item in menu.MenuItems)
            {
                Image itemImage = null;
                if (!String.IsNullOrEmpty(item.Image))
                {
                    itemImage = Image.FromFile(item.Image);
                }

                ToolStripMenuItem menuItem = new ToolStripMenuItem(item.Name, itemImage);

                //If Top Menu
                if (item.MenuItems.Count > 0)
                {
                    foreach (Edge.Applications.PM.Client.Configuration.MenuItem subItem in item.MenuItems)
                    {
                        ToolStripMenuItem subMenuItem = new ToolStripMenuItem(subItem.Name, null, new EventHandler(ToolStripMenuItem_Click));
                        subMenuItem.Tag = subItem;
                        menuItem.DropDownItems.Add(subMenuItem);
                    }
                }
                else
                {
                    menuItem.Click += new EventHandler(ToolStripMenuItem_Click);
                }

                menuItem.Tag = item;
                this.menuStrip.Items.Add(menuItem);
            }
        }
예제 #5
0
 private int UpdateMenuSection(MenuSectionViewModel model)
 {
     MenuSection menuSection;
     if (model.MenuSectionId == 0)
     {
         menuSection = new MenuSection
         {
             Name = model.Name,
             Number = model.Number,
         };
         _context.MenuSections.Add(menuSection);
     }
     else
     {
         menuSection = _context.MenuSections.FirstOrDefault(s => s.MenuSectionId == model.MenuSectionId);
         if (menuSection == null) return 0;
         menuSection.Name = model.Name;
         menuSection.Number = model.Number;
     }
     _context.SaveChanges();
     model.MenuSectionId = menuSection.MenuSectionId;
     RemoveExceedMenuItems(model);
     foreach (var menuItem in model.Items)
     {
         menuItem.MenuSectionId = model.MenuSectionId;
         menuItem.MenuId = model.MenuId;
         var id = UpdateMenuItem(menuItem);
         menuItem.MenuItemId = id;
     }
     return model.MenuSectionId;
 }
예제 #6
0
    void SetMenuPanelSelection(MenuSection ms)
    {
        if (ms == selectedMenuSection)
        {
            return;
        }
        else
        {
            switch (selectedMenuSection)
            {
            case MenuSection.Save:
                menuPanel.transform.GetChild(MENUPANEL_SAVE_BUTTON_INDEX).GetComponent <Image>().overrideSprite = null;
                SaveSystemUI.current.CloseButton();
                break;

            case MenuSection.Load:
                menuPanel.transform.GetChild(MENUPANEL_LOAD_BUTTON_INDEX).GetComponent <Image>().overrideSprite = null;
                SaveSystemUI.current.CloseButton();
                break;
                // case MenuSection.Options:
                //   menuPanel.transform.GetChild(MENUPANEL_OPTIONS_BUTTON_INDEX).GetComponent<Image>().overrideSprite = null;
                //   optionsPanel.SetActive(false);
                //   break;
            }
            selectedMenuSection = ms;
            switch (selectedMenuSection)
            {
            case MenuSection.Save: menuPanel.transform.GetChild(MENUPANEL_SAVE_BUTTON_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; break;

            case MenuSection.Load: menuPanel.transform.GetChild(MENUPANEL_LOAD_BUTTON_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; break;

            case MenuSection.Options: menuPanel.transform.GetChild(MENUPANEL_OPTIONS_BUTTON_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; break;
            }
        }
    }
예제 #7
0
        private void GoToCreate(object sender, System.EventArgs e)
        {
            try
            {
                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.CreateAirline);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong view.");
            }
        }
예제 #8
0
        public IHttpActionResult PutMenuSection(int id, MenuSection menuSection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != menuSection.MenuSectionId)
            {
                return(BadRequest());
            }

            db.Entry(menuSection).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MenuSectionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #9
0
        public void TilesTest()
        {
            var target = new MenuSection();
            var actual = target.Tiles;

            Assert.IsTrue(actual.Count == 0);
        }
예제 #10
0
        public void TilesSetTest()
        {
            var target = new MenuSection();

            Assert.IsNotNull(target);
            target.Tiles = new MenuTiles();
            Assert.IsNotNull(target.Tiles);
        }
예제 #11
0
        private async Task RemoveSectionItemsFromSection(MenuSection section)
        {
            var sectionItems = await _menuSectionItemRepository.GetAllListAsync(a => a.SectionId == section.Id);

            foreach (var menuSectionItem in sectionItems)
            {
                await _menuSectionItemRepository.DeleteAsync(menuSectionItem);
            }
        }
        public ActionResult Delete(int id)
        {
            MenuSection menuSection = db.MenuSections.Find(id);

            db.MenuSections.Remove(menuSection);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
예제 #13
0
 public FileExplorerListDirectoryContextMenu()
 {
     Add(Section1 = new MenuSection <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
     Section1.Add(Section1Path = new NavigationalEntry <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
     Add(Section2 = new MenuSection <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
     Section2.Add(Section2Archive = new NavigationalEntry <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
     Add(Section3 = new MenuSection <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
     Add(Section4 = new MenuSection <ContextDiItemsCommand <DirectoryViewModel, EntryViewModel, FileExplorerViewModel> >());
 }
예제 #14
0
        public void SwitchToSection(MenuSection section)
        {
            if (sectionStack.Count > 0)
            {
                sectionStack.Peek().OnHide(false);
            }

            sectionStack.Push(section);
            section.OnShow(this);
        }
예제 #15
0
        private async Task <MenuSection> CreateMenuSection(Category category, Menu menu)
        {
            var section   = MenuSection.CreateMenuSectionWithCategory(category.Name, menu, category);
            var sectionId = await _menuManager.AddSectionAsync(section);

            if (section.Id == 0)
            {
                section = _menuSectionRepository.FirstOrDefault(sectionId);
            }
            return(section);
        }
예제 #16
0
 public void HandleSectionChanged(MenuSection section)
 {
     if (section != null && gameObject == section.SectionObject)
     {
         _renderer.material = _highlightMaterial;
     }
     else
     {
         _renderer.material = _defaultMaterial;
     }
 }
예제 #17
0
        private void InitializeContextMenu(MenuSection <ItemCommand <ClientViewModel> > contextMenuSource, ContextMenu contextMenu, IItemMenuFactory menuFactory)
        {
            var items = menuFactory.Create(contextMenuSource, null);

            foreach (var item in items)
            {
                contextMenu.Items.Add(item);
            }

            ContextMenuExtensions.SetSelectedItems(contextMenu, ClientsDataGrid.SelectedItems);
        }
예제 #18
0
        public IHttpActionResult GetMenuSection(int id)
        {
            MenuSection menuSection = db.MenuSections.Find(id);

            if (menuSection == null)
            {
                return(NotFound());
            }

            return(Ok(menuSection));
        }
예제 #19
0
        public IHttpActionResult PostMenuSection(MenuSection menuSection)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.MenuSections.Add(menuSection);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = menuSection.MenuSectionId }, menuSection));
        }
    void SetMenuPanelSelection(MenuSection ms)
    {
        if (ms == selectedMenuSection)
        {
            return;
        }
        else
        {
            switch (selectedMenuSection)
            {
            case MenuSection.Save:
                buttonsHolder.GetChild(SAVE_BTN_INDEX).GetComponent <Image>().overrideSprite = null;
                saveSystem.CloseButton();
                break;

            case MenuSection.Load:
                buttonsHolder.GetChild(LOAD_BTN_INDEX).GetComponent <Image>().overrideSprite = null;
                saveSystem.CloseButton();
                break;

            case MenuSection.Options:
                buttonsHolder.GetChild(OPTIONS_BTN_INDEX).GetComponent <Image>().overrideSprite = null;
                optionsPanel.SetActive(false);
                break;

            case MenuSection.Advice:
                buttonsHolder.GetChild(ADVICE_BTN_INDEX).GetComponent <Image>().overrideSprite = null;
                advicePanel.SetActive(false);
                break;
            }
            selectedMenuSection = ms;
            switch (selectedMenuSection)
            {
            case MenuSection.Save: buttonsHolder.GetChild(SAVE_BTN_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; break;

            case MenuSection.Load: buttonsHolder.GetChild(LOAD_BTN_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite; break;

            case MenuSection.Options:
                buttonsHolder.GetChild(OPTIONS_BTN_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite;
                break;

            case MenuSection.Advice:
                buttonsHolder.GetChild(ADVICE_BTN_INDEX).GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite;
                advicePanel.GetComponent <AdvicesUI>().PrepareAdvice();
                advicePanel.SetActive(true);
                break;

            case MenuSection.NoSelection:
                break;
            }
        }
    }
예제 #21
0
 public MenuTreeRoot(IContext context, string text, MenuSection section)
 {
     Section      = section;
     MenuMenuItem = new ToolStripMenuItem(text)
     {
         Tag = this
     };
     ToolStrip = new ToolStrip {
         Tag = this, LayoutStyle = ToolStripLayoutStyle.Flow
     };
     Context        = context;
     _toolbarGroups = new List <MenuTreeGroup>();
 }
예제 #22
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio = (RadioButton)panelChild.Controls[12];

                Airport airport = new Airport
                {
                    Name      = panelChild.Controls[1].Controls[0].Text,
                    Operator  = panelChild.Controls[2].Controls[0].Text,
                    Owner     = panelChild.Controls[3].Controls[0].Text,
                    ICAO      = panelChild.Controls[4].Controls[0].Text,
                    IATA      = panelChild.Controls[5].Controls[0].Text,
                    Type      = panelChild.Controls[6].Controls[0].Text,
                    Address   = panelChild.Controls[7].Controls[0].Text,
                    Serves    = panelChild.Controls[8].Controls[0].Text,
                    Large     = int.Parse(panelChild.Controls[9].Controls[0].Text),
                    Elevation = int.Parse(panelChild.Controls[10].Controls[0].Text),
                    Status    = (myRadio.Checked) ? 1 : 0,
                };


                AirportDAO dao = new AirportDAO(Server.MariaDB);
                dao.Save(airport);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airports);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #23
0
            /// <summary>
            /// Add a section to the tree. This will create a top-level menu as well as a toolbar.
            /// </summary>
            private void AddSection(MenuSection ds)
            {
                // Create the root
                var rtn = new MenuTreeRoot(_context, ds.Description, ds);

                // When the menu is closed, push an empty string to the status bar
                rtn.MenuMenuItem.DropDownClosed += (s, a) => { Oy.Publish("Status:Information", ""); };

                // When the menu is opened, update the state of all the menu items in this section
                rtn.MenuMenuItem.DropDownOpening += (s, a) => { rtn.Update(); };

                // Add the node, menu, and toolbar
                RootNodes.Add(ds.Name, rtn);
            }
예제 #24
0
        public IHttpActionResult DeleteMenuSection(int id)
        {
            MenuSection menuSection = db.MenuSections.Find(id);

            if (menuSection == null)
            {
                return(NotFound());
            }

            db.MenuSections.Remove(menuSection);
            db.SaveChanges();

            return(Ok(menuSection));
        }
예제 #25
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio = (RadioButton)panelChild.Controls[9];
                ComboBox    myCombo = (ComboBox)panelChild.Controls[7];

                int airlaineID = new AirlineDAO(Enums.Server.MariaDB).GetID(myCombo.SelectedItem.ToString());

                Airplane avion = new Airplane
                {
                    Model     = panelChild.Controls[1].Controls[0].Text,
                    ICAO      = panelChild.Controls[2].Controls[0].Text,
                    IATA      = panelChild.Controls[3].Controls[0].Text,
                    MaxPASS   = int.Parse(panelChild.Controls[4].Controls[0].Text),
                    MaxCargo  = int.Parse(panelChild.Controls[5].Controls[0].Text),
                    Aircraft  = panelChild.Controls[6].Controls[0].Text,
                    AirlineID = airlaineID,
                    Enabled   = (myRadio.Checked) ? 1 : 0,
                };

                AirplaneDAO dao = new AirplaneDAO(Enums.Server.MariaDB);
                dao.Save(avion);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airplanes);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
        public void Id_Should_Be_Compsited_If_Parent_Is_Present()
        {
            var menuSection = new MenuSection("MyMenuSection");
            var menu = new Menu("MyMenu");
            var comboBox = new ComboBox("MyComboBox");
            var group = new Group("MyGroup");
            var tab = new Tab("MyTab");
            var ribbon = new Ribbon("MyRibbon");
            ribbon.With(() => tab
                                  .With(() => group
                                                  .With(() => comboBox.With(()=>menu.With(()=>menuSection.With(()=>_sut))))));

            Assert.AreEqual("MyRibbon.MyTab.MyGroup.MyComboBox.MyMenu.MyMenuSection.MyInsertTable", _sut.Id);
        }
예제 #27
0
 private void LoadMenu()
 {
     System.Configuration.Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
     if (config.Sections["Menu"] == null)
     {
         config.Sections.Add("Menu", new MenuSection());
         config.Save();
     }
     else
     {
         MenuSection section = (MenuSection)config.GetSection("Menu");
         foreach (MenuItemElement item in section.Items)
         {
             CreatePage(item);
         }
     }
 }
예제 #28
0
        private async Task <MenuSectionItem> CreateSectionItem(Page page, MenuSection section, List <Content> pageContents)
        {
            var menuSectionItem = MenuSectionItem.CreateMenuSectionItem(page.Name, section, page.Id);

            var id = await _menuManager.AddMenuItemAsync(menuSectionItem);

            if (menuSectionItem.Id == 0)
            {
                menuSectionItem = _menuSectionItemRepository.FirstOrDefault(id);
            }

            foreach (var pageContent in pageContents)
            {
                await CreateEditSectionItemContent(pageContent, menuSectionItem);
            }
            return(menuSectionItem);
        }
예제 #29
0
    // Update is called once per frame
    protected virtual void Update()
    {
#if UNITY_EDITOR
        Assert.IsTrue(IsValid(), "Total covered degrees cannot exceep 360 degrees and must be larger than 0.");
#endif

        Vector2 direction = Vector2.zero + TouchPosition;
        float   rotation  = (GetDegree(direction) + _offsetDegree) % 360f;

        var section = GetSection(rotation);

        if (SelectedSection != section)
        {
            SelectedSection = section;
            _hoverChanged?.Invoke(section);
        }
    }
예제 #30
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                RadioButton myRadio = (RadioButton)panelChild.Controls[7];

                Airline aerolinea = new Airline
                {
                    Name          = panelChild.Controls[1].Controls[0].Text,
                    ICAO          = panelChild.Controls[2].Controls[0].Text,
                    IATA          = panelChild.Controls[3].Controls[0].Text,
                    Country       = panelChild.Controls[4].Controls[0].Text,
                    Region        = panelChild.Controls[5].Controls[0].Text,
                    AirlineStatus = (myRadio.Checked) ? 1 : 0,
                    AircraftList  = ""
                };

                AirlineDAO dao = new AirlineDAO(Enums.Server.MariaDB);
                dao.Save(aerolinea);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Airlines);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #31
0
        private void Save(object sender, System.EventArgs e)
        {
            try
            {
                // Use trim for filelds names
                RadioButton myRadio    = (RadioButton)panelChild.Controls[5];
                ComboBox    myCombo    = (ComboBox)panelChild.Controls[3];
                int         airlaineID = new AirlineDAO(Enums.Server.MariaDB).GetID(myCombo.SelectedItem.ToString());

                Pilot piloto = new Pilot
                {
                    Name        = panelChild.Controls[1].Controls[0].Text,
                    Sex         = panelChild.Controls[2].Controls[0].Text,
                    PilotStatus = (myRadio.Checked) ? 1 : 0,
                    AirlineID   = airlaineID
                };

                PilotDAO dao = new PilotDAO(Enums.Server.MariaDB);
                dao.Save(piloto);

                // Button is the last child
                panelChild.Controls[panelChild.Controls.Count - 1].Enabled = false;

                FlatPanel parentPanel = (FlatPanel)panel.Parent;
                Control   toolbar     = parentPanel.Controls[0];

                MenuSection menuController = new MenuSection(0);
                menuController.ShowPanel(ref parentPanel, Enums.ItemMenuType.Pilots);

                PanelAdjustment();

                void PanelAdjustment()
                {
                    parentPanel.Controls[1].Dock   = DockStyle.None;
                    toolbar.Controls[0].Width      = parentPanel.Width;
                    parentPanel.Controls[1].Top    = toolbar.Top + toolbar.Height;
                    parentPanel.Controls[1].Width  = parentPanel.Width;
                    parentPanel.Controls[1].Height = parentPanel.Height - toolbar.Height;
                }
            }
            catch (Exception)
            {
                throw new OperationCanceledException("Wrong filed.");
            }
        }
예제 #32
0
        public void LeaveSection(MenuSection section)
        {
            if (sectionStack.Count > 0)
            {
                MenuSection activeSection = sectionStack.Pop();
                if (activeSection != section)
                {
                    throw new InvalidOperationException();
                }

                activeSection.OnHide(true);

                if (sectionStack.Count > 0)
                {
                    sectionStack.Peek().OnShow(this);
                }
            }
        }
예제 #33
0
        public static void GenerateReportMainPage(this List<NunitGoTest> tests, 
			string pathToSave, MainStatistics mainStats)
        {
            try
            {
                var menuElements = new List<ReportMenuItem>
                {
                    new ReportMenuItem("Main statistics", Output.Files.TestStatisticsFile , "octicon octicon-graph"),
                    new ReportMenuItem("Test list", Output.Files.TestListFile, "octicon octicon-checklist"),
                    new ReportMenuItem("Timeline", Output.Files.TimelineFile, "octicon octicon-clock")
                };
                var mainTitle = new SectionName("Test Run Report");
                var mainInformation = new MainInformationSection(mainStats);
                var reportMenu = new MenuSection(menuElements, "main-menu", "Report menu");
                var report = new HtmlPage("NUnitGo Report")
                {
                    ScriptFilePaths = new List<string>
                    {
                        Output.Files.JQueryScriptFile,
                        Output.Files.HighstockScriptFile,
                        Output.Files.StatsScript
                    },
                    PageStylePaths = new List<string>
                    {
                        Output.Files.ReportStyleFile,
                        Output.Files.PrimerStyleFile,
                        Output.Files.OcticonStyleFile
                    },
                    PageBodyCode = mainTitle.HtmlCode + mainInformation.HtmlCode + reportMenu.ReportMenuHtml
                };
                report.SavePage(Path.Combine(pathToSave, Output.Files.FullReportFile));
            }
            catch (Exception ex)
            {
                Log.Exception(ex, "Exception while generating full report page");
            }
        }
예제 #34
0
 /// <summary>
 /// Returns true if the current View is within the "MenuSection" - Uses the mapping defined in GetSection
 /// </summary>
 /// <param name="helper"></param>
 /// <param name="menuSection"></param>
 /// <returns></returns>
 public static bool IsSection(this HtmlHelper helper, MenuSection menuSection)
 {
     return helper.GetSection() == menuSection;
 }
 public void Setup()
 {
     _sut = new MenuSection("MyMenuSection");
 }
예제 #36
0
 public void Indexer_Should_Return_MenuSection()
 {
     var actual = new MenuSection("MyMenuSection");
     _sut._menuSections.Add(actual);
     Assert.AreEqual(actual, _sut["MyMenuSection"]);
 }