示例#1
0
    public ExplorerLike()
    {
        Text      = "Windows Explorer-Like Program";
        BackColor = SystemColors.Window;
        ForeColor = SystemColors.WindowText;

        // Create controls.

        filelist        = new FileListView();
        filelist.Parent = this;
        filelist.Dock   = DockStyle.Fill;

        Splitter split = new Splitter();

        split.Parent    = this;
        split.Dock      = DockStyle.Left;
        split.BackColor = SystemColors.Control;

        dirtree              = new DirectoryTreeView();
        dirtree.Parent       = this;
        dirtree.Dock         = DockStyle.Left;
        dirtree.AfterSelect +=
            new TreeViewEventHandler(DirectoryTreeViewOnAfterSelect);

        // Create View menu.

        Menu = new MainMenu();
        Menu.MenuItems.Add("&View");

        string[]     astrView = { "Lar&ge Icons", "S&mall Icons",
                                  "&List",            "&Details" };
        View[]       aview = { View.LargeIcon, View.SmallIcon,
                               View.List,            View.Details };
        EventHandler eh = new EventHandler(MenuOnView);

        for (int i = 0; i < 4; i++)
        {
            MenuItemView miv = new MenuItemView();
            miv.Text       = astrView[i];
            miv.View       = aview[i];
            miv.RadioCheck = true;
            miv.Click     += eh;

            if (i == 3)            // Default == View.Details
            {
                mivChecked         = miv;
                mivChecked.Checked = true;
                filelist.View      = mivChecked.View;
            }
            Menu.MenuItems[0].MenuItems.Add(miv);
        }
        Menu.MenuItems[0].MenuItems.Add("-");

        // View Refresh menu item

        MenuItem mi = new MenuItem("&Refresh",
                                   new EventHandler(MenuOnRefresh), Shortcut.F5);

        Menu.MenuItems[0].MenuItems.Add(mi);
    }
示例#2
0
        private void NavBarItem_Click(object sender, System.EventArgs e)
        {
            NavBarItem ss = sender as NavBarItem;

            //消除对tab的多次创建
            foreach (DXTabItem variable in dxTabControl.Items)
            {
                if (ss == null || variable.Header.ToString() != ss.Content.ToString())
                {
                    continue;
                }
                variable.IsSelected = true;
                return;
            }
            //创建新的TabItem
            DXTabItem dxTabItem = new DXTabItem();

            dxTabItem.Header     = ss.Content;
            dxTabItem.IsSelected = true;
            dxTabItem.AllowHide  = DefaultBoolean.True;
            Frame        tabFrame = new Frame();
            MenuItemView menuItem = new MenuItemView();

            tabFrame.Content  = menuItem;
            dxTabItem.Content = tabFrame;
            dxTabControl.Items.Add(dxTabItem);
        }
示例#3
0
        public JsonResult Save([Bind(Include = "MenuID,Caption,MenuLevel,ItemOrder,Module,ScreenCode,ParentID,HasChild,Description,IsActive,SetOn,SetBy, IsDelete")] MenuItemView menuItemView, bool isInsert)
        {
            MenuItem menuItem = menuItemView.ToMenuItem();

            menuItem.MenuID = Convert.ToInt32(menuItem.MenuID);
            menuItem.SetBy  = LoginInformation.UserID;
            menuItem.SetOn  = DateTime.Now;

            if (!ModelState.IsValid)
            {
                return(GetMenuItem(menuItem.MenuID));
            }
            if (isInsert)
            {
                var menuMaxId = _unitOfWork.MenuItemRepository.GetAll().Max(m => m.MenuID);
                menuItem.MenuID = menuMaxId != null?Convert.ToInt32(menuMaxId) + 1 : 1;

                _unitOfWork.MenuItemRepository.Insert(menuItem);
            }
            else
            {
                _unitOfWork.MenuItemRepository.Update(menuItem);
            }
            _unitOfWork.Save();
            return(GetMenuItem(menuItem.MenuID));
        }
        public JsonResult Save([Bind(Include = "Caption,MenuLevel,ItemOrder,ScreenCode,ParentID,HasChild,Description,IsActive,SetOn,SetBy, IsDelete")] MenuItemView menuItemView, bool isInsert)
        {
            var menuItem = Mapper.Map <DAL.MenuItem>(menuItemView);

            menuItem.MenuID = Convert.ToByte(menuItem.MenuID);
            menuItem.SetBy  = LoginInformation.UserID;
            menuItem.SetOn  = DateTime.Now;

            //if (!ModelState.IsValid)
            //{
            //    return GetMenuItem(menuItem.MenuID);
            //}

            if (ModelState.IsValid)
            {
                if (isInsert)
                {
                    _unitOfWork.MenuItemRepository.Insert(menuItem);
                }
                else
                {
                    _unitOfWork.MenuItemRepository.Update(menuItem);
                }
                _unitOfWork.Save();
            }
            return(GetMenuItem(menuItem.MenuID));
        }
示例#5
0
文件: explorer.cs 项目: dbremner/hycs
    void MenuOnView(object obj, EventArgs ea)
    {
        mivChecked.Checked = false;
        mivChecked = (MenuItemView)obj;
        mivChecked.Checked = true;

        filelist.View = mivChecked.View;
    }
示例#6
0
    void MenuOnView(object obj, EventArgs ea)
    {
        mivChecked.Checked = false;
        mivChecked         = (MenuItemView)obj;
        mivChecked.Checked = true;

        filelist.View = mivChecked.View;
    }
    // the OnViewSelect event for the View menu items.

    void MenuOnViewSelect(object obj, EventArgs ea)
    {
        // Uncheck the currently checked item.
        mivChecked.Checked = false;
        // Cast the event sender and check it.
        mivChecked         = (MenuItemView)obj;
        mivChecked.Checked = true;
        // Change how the files are viewed in the FileListView control.
        flvFiles.View = mivChecked.view;
    }
        public void Initialize(MenuItemView menuItem)
        {
            Categories.Clear();
            Categories.AddRange(_viewProvider.Get <CategoryView>());

            _id              = menuItem.MenuItemId;
            Title            = menuItem.Title;
            Description      = menuItem.Description;
            SelectedCategory = Categories.First(x => x.CategoryId == menuItem.CategoryId);
        }
示例#9
0
 public static MenuItem ToModel(this MenuItemView menuItem)
 {
     return(new MenuItem()
     {
         Id = menuItem.Id,
         Title = menuItem.Title,
         Description = menuItem.Description,
         Price = menuItem.Price,
         Currency = menuItem.Currency,
         ImageUrl = menuItem.ImageUrl,
         Slug = menuItem.Slug
     });
 }
示例#10
0
        public void OnGet(int id)
        {
            var menuItem = _menuItemsService.GetById(id);

            if (menuItem == null)
            {
                ErrorMessage = $"There is no menu item with ID: {id}";
            }
            else
            {
                MenuItem = menuItem.ToMenuItemView();
            }
        }
示例#11
0
 public IActionResult OnPost(MenuItemView menuItem)
 {
     if (ModelState.IsValid)
     {
         var domainModel = menuItem.ToModel();
         var response    = _menuItemsService.Create(domainModel);
         if (!response.IsSuccessfull)
         {
             ErrorMessage = response.Message;
             return(Page());
         }
     }
     return(RedirectToPage("/Admin/MenuItemsList"));
 }
示例#12
0
 public static MenuItem ToMenuItem(this MenuItemView menuItemView)
 {
     return(new MenuItem
     {
         MenuID = Convert.ToInt32(menuItemView.MenuID),
         Caption = menuItemView.Caption,
         MenuLevel = menuItemView.MenuLevel,
         ItemOrder = menuItemView.ItemOrder,
         ParentID = menuItemView.ParentID,
         ScreenCode = menuItemView.ScreenCode,
         Description = menuItemView.Description,
         IsActive = menuItemView.IsActive,
         IsDelete = menuItemView.IsDelete,
         HasChild = menuItemView.HasChild,
         SetOn = Convert.ToDateTime(menuItemView.SetOn),
         SetBy = menuItemView.SetBy
     });
 }
示例#13
0
文件: explorer.cs 项目: dbremner/hycs
    public ExplorerLike()
    {
        BackColor = SystemColors.Window;
        ForeColor = SystemColors.WindowText;

        filelist = new FileListView();
        filelist.Parent = this;
        filelist.Dock = DockStyle.Fill;

        Splitter split = new Splitter();
        split.Parent = this;
        split.Dock = DockStyle.Left;
        split.BackColor = SystemColors.Control;

        Menu = new MainMenu();
        Menu.MenuItems.Add("&View");

        string[] astrView = { "Lar&ge Icons", "S&mall Icons",
                                "&List", "&Details" };
        View[] aview = { View.LargeIcon, View.SmallIcon,
                           View.List, View.Details };
        EventHandler eh = new EventHandler(MenuOnView);

        for (int i = 0; i < 4; i++) {
            MenuItemView miv = new MenuItemView();
            miv.Text = astrView[i];
            miv.View = aview[i];
            miv.RadioCheck = true;
            miv.Click += eh;

            if (i == 3)         // Default == View.Details
               {
                mivChecked = miv;
                mivChecked.Checked = true;
                filelist.View = mivChecked.View;
            }
            Menu.MenuItems[0].MenuItems.Add(miv);
        }
        Menu.MenuItems[0].MenuItems.Add("-");

        MenuItem mi = new MenuItem("&Refresh",
                            new EventHandler(MenuOnRefresh), Shortcut.F5);
        Menu.MenuItems[0].MenuItems.Add(mi);
    }
示例#14
0
        public void AddNewItem(MenuItemView addingMenuItem)
        {
            var element = AddedElements.FirstOrDefault(x => x.Id == addingMenuItem.MenuItemId && !x.Ordered);

            if (element != null)
            {
                element.Quantities++;
                AddedElements.Refresh();
            }
            else
            {
                AddedElements.Add(new OrderMenuItemModel()
                {
                    Id         = addingMenuItem.MenuItemId,
                    Price      = addingMenuItem.Price,
                    Ordered    = false,
                    Quantities = 1,
                    Title      = addingMenuItem.Title
                });
            }

            TotalPrice += addingMenuItem.Price;
        }
 public static DetailMenuItem_MenuItemDetailView ConvertToDetailMenuItem_MenuItemDetailView(
     this MenuItemView menuItems)
 {
     return(Mapper.Map <MenuItemView,
                        DetailMenuItem_MenuItemDetailView>(menuItems));
 }
 public static ModifyMenuItemRequest ConvertToModifyMenuItemRequest(
     this MenuItemView menuItems)
 {
     return(Mapper.Map <MenuItemView,
                        ModifyMenuItemRequest>(menuItems));
 }
 public static MenuItemDetailView ConvertToMenuItemDetailView(
     this MenuItemView menuItem)
 {
     return(Mapper.Map <MenuItemView,
                        MenuItemDetailView>(menuItem));
 }
 public static MenuItemFlatViewModel ConvertToMenuItemFlatViewModel(
     this MenuItemView menuItem)
 {
     return(Mapper.Map <MenuItemView,
                        MenuItemFlatViewModel>(menuItem));
 }
示例#19
0
 /// <summary>
 /// Creates a new MenuDialogView object.
 /// </summary>
 /// <param name="menuItemViews">An array of MenuItemViews.</param>
 /// <param name="menuDialog">The dedicated MenuDialog.</param>
 public MenuDialogView(MenuItemView[] menuItemViews, MenuDialog menuDialog)
 {
     this.menuItemViews = menuItemViews;
     this.menuDialog = menuDialog;
 }
示例#20
0
 public static MenuItem ConvertToMenuItem(
     this MenuItemView menuItemView)
 {
     return(Mapper.Map <MenuItemView,
                        MenuItem>(menuItemView));
 }
示例#21
0
    public ExplorerStyleViewer()
    {
        //This call is required by the Windows Form Designer.

        InitializeComponent();
        //Add any initialization after the InitializeComponent() call
        // End default How To code. Begin code added for this particular How To...
        // Create a flvFilesView instance.
        flvFiles        = new FileListView();
        flvFiles.Parent = this;
        flvFiles.Dock   = DockStyle.Fill;

        // Create a Splitter instance.
        Splitter split = new Splitter();

        split.Parent    = this;
        split.Dock      = DockStyle.Left;
        split.BackColor = SystemColors.Control;
        // Create a DirectoryTreeView instance and add an OnAfterSelect event handler.

        dtvwDirectory        = new DirectoryTreeView();
        dtvwDirectory.Parent = this;
        dtvwDirectory.Dock   = DockStyle.Left;
        // Dynamically add an AfterSelect event handler.

        dtvwDirectory.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(DirectoryTreeViewOnAfterSelect);

        // Add a View menu command to the existing main menu.

        MenuItem mnuView = new MenuItem("&View");

        mnuView.Index = 1;
        this.mnuMain.MenuItems.Add(mnuView);

        // Add four menu items to the new View menu. Start by creating arrays to set
        // properties of each menu item.

        string[] astrView = { "Lar&ge Icons", "S&mall Icons", "&List", "&Details" };
        View[]   aview    = { View.LargeIcon, View.SmallIcon, View.List, View.Details };

        // Create an event handler for the menu items.

        EventHandler eh = new System.EventHandler(MenuOnViewSelect);

        for (int i = 0; i <= 3; i++)
        {
            // Use a custom class MenuItemView, which extends MenuItem to support a
            // View property.

            MenuItemView miv = new MenuItemView();
            miv.Text       = astrView[i];
            miv.view       = aview[i];
            miv.RadioCheck = true;

            // Associate the handler created earlier with the Click event.
            miv.Click += eh;

            // Set the Default view to Details.

            if (i == 3)
            {
                mivChecked         = miv;
                mivChecked.Checked = true;
                flvFiles.View      = mivChecked.view;
            }

            // Add the new menu item to the View menu.
            mnuView.MenuItems.Add(miv);
        }
    }