Пример #1
0
 public MenuTestViewModel()
 {
     _mvvmMenuItem = new MenuItem
     {
         Name = "Root"
     };
     DrawMenus(LoggedUserInfo.WFM_MenuesPermissions);
 }
Пример #2
0
 private static void DrawChild(TblAuthPermission row, MenuItem subList)
 {
     foreach (var childrow in LoggedUserInfo.WFM_MenuesPermissions.OrderBy(x => x.PermOrder).Where(x => x.ParentPerm == row.Iserial))
     {
         var newmenu = new MenuItem
         {
             Text          = LoggedUserInfo.CurrLang == 0 ? childrow.Aname : childrow.Ename,
             Tag           = childrow.ReportServer,
             PermissionTyp = childrow.PermissionTyp,
             IsCheckable   = childrow.PermissionTyp != "P",
             Name          = childrow.Code,
             MenuLink      = childrow.MenuLink
         };
         DrawChild(childrow, newmenu);
         if (!subList.Contains(newmenu))
         {
             subList.Add(newmenu);
         }
     }
 }
Пример #3
0
        private void DrawMenus(ObservableCollection <TblAuthPermission> wfmMenuesPermissions)
        {
            var menulist = new MenuItem();

            foreach (var tblAuthJobPermission in wfmMenuesPermissions.OrderBy(x => x.PermOrder).Where(x => x.ParentPerm == 0))
            {
                var subList = new MenuItem();
                foreach (var row in wfmMenuesPermissions.OrderBy(x => x.PermOrder).Where(x => x.ParentPerm == tblAuthJobPermission.Iserial))
                {
                    var newMenu = new MenuItem
                    {
                        Tag           = row.ReportServer,
                        Text          = LoggedUserInfo.CurrLang == 0 ? row.Aname : row.Ename,
                        PermissionTyp = row.PermissionTyp,
                        Name          = row.Code,
                        IsCheckable   = row.PermissionTyp != "M"
                    };

                    DrawChild(row, newMenu);
                    if (!subList.Contains(newMenu))
                    {
                        subList.Add(newMenu);
                    }
                }

                menulist.Add(new MenuItem
                {
                    Tag           = tblAuthJobPermission.ReportServer,
                    Text          = LoggedUserInfo.CurrLang == 0 ? tblAuthJobPermission.Aname : tblAuthJobPermission.Ename,
                    PermissionTyp = tblAuthJobPermission.PermissionTyp,
                    Name          = tblAuthJobPermission.Code,
                    IsCheckable   = tblAuthJobPermission.PermissionTyp != "M",
                    MenuItems     = subList,
                });
            }

            _mvvmMenuItem.MenuItems = menulist;
        }
        public MenuViewModel()
        {
            mvvmMenuItem = new MenuItem()
            {
                Name = "Root"
            };

            var mnuFile = new MenuItem() { Name = "mnuFile", Text = "Αρχεία" };
               // var mnuEdit = new MenuItem() { Name = "mnuEdit", Text = "Edit" };
               // var mnuWindow = new MenuItem() { Name = "mnuWindow", Text = "Window" };
            var mnuHelp = new MenuItem() { Name = "mnuHelp", Text = "Βοήθεια" };

            var mnuNew = new MenuItem() { Name = "mnuNew", Text = "Νέο" };
            var mnuSeparator1 = new MenuItem() { Name = "mnuSeparator1", Text = "-" };
            var mnuOpenFile = new MenuItemExtension() { Name = "mnuOpenFile", Text = "Ανοιγμα αρχείου", IsEnabled = true,Command = new DelegateCommand(()=>
                                                                                                                                                  {
                                                                                                                                                      Mediator.Instance.LoadProjectFromXml();
                                                                                                                                                  })};
            var mnuSaveFile = new MenuItemExtension()
            {
                Name = "mnuSave",
                Text = "Αποθήκευση αρχείου",
                IsEnabled = true,
                Command = new DelegateCommand(() =>
                                                                                                                                                  {
                                                                                                                                                      Mediator.Instance.SaveProjectAsXml();
                                                                                                                                                  })};
              //  var mnuCloseFile = new MenuItem() { Name = "mnuClose", Text = "Close File", IsEnabled = false };
            var mnuSeparator2 = new MenuItem() { Name = "mnuSeparator2", Text = "-" };
            var mnuExit = new MenuItem() { Name = "mnuExit", Text = "Exit" };

            var mnuNewFile = new MenuItemExtension() { Name = "mnuNewFile", Text = "Νέο Έργο(Μέλετη)"  ,Command = new DelegateCommand(() =>
                {
                    Mediator.Instance.CreateNewProjectStudy();
                }) };
            var mnuNewProject = new MenuItemExtension()
            {
                Name = "mnuNewProject",
                Text = "Νέο Έργο(Επιθεώρηση)",
                Command = new DelegateCommand(() =>
                {
                    Mediator.Instance.CreateNewProject();
                })
            };
              //  var mnuNewSolution = new MenuItem() { Name = "mnuNewSolution", Text = "New Solution" };

            var mnuCut = new MenuItem() { Name = "mnuCut", Text = "Cut" };
            var mnuCopy = new MenuItem() { Name = "mnuCopy", Text = "Copy" };
            var mnuPaste = new MenuItem() { Name = "mnuPaste", Text = "Paste" };
            var mnuDelete = new MenuItem() { Name = "mnuDelete", Text = "Delete" };

            var mnuWindow1 = new MenuItem() { Name = "mnuWindow1", Text = "Window 1", IsChecked = true, IsCheckable = true };
            var mnuWindow2 = new MenuItem() { Name = "mnuWindow2", Text = "Window 2", IsChecked = false, IsCheckable = true };
            var mnuWindow3 = new MenuItem() { Name = "mnuWindow3", Text = "Window 3", IsChecked = false, IsCheckable = true };

            var mnuAbout = new MenuItem() { Name = "mnuViewHelp", Text = "Σχετικά με Την Εφαρμογή" };

            var mnuRefreash = new MenuItem() { Name = "mnuRefreash", Text = " " };
            mnuNew.Add(mnuNewFile);
            mnuNew.Add(mnuNewProject);
               //     mnuNew.Add(mnuNewSolution);

            mnuFile.Add(mnuNew);
            mnuFile.Add(mnuSeparator1);
            mnuFile.Add(mnuOpenFile);
            mnuFile.Add(mnuSaveFile);
               // mnuFile.Add(mnuCloseFile);
            mnuFile.Add(mnuSeparator2);
            mnuFile.Add(mnuExit);

            //mnuEdit.Add(mnuCut);
            //mnuEdit.Add(mnuCopy);
            //mnuEdit.Add(mnuPaste);
            //mnuEdit.Add(mnuDelete);

            //mnuWindow.Add(mnuWindow1);
            //mnuWindow.Add(mnuWindow2);
            //mnuWindow.Add(mnuWindow3);

            mnuHelp.Add(mnuAbout);

            mvvmMenuItem.Add(mnuFile);
              //  mvvmMenuItem.Add(mnuEdit);
              //  mvvmMenuItem.Add(mnuWindow);
            mvvmMenuItem.Add(mnuHelp);
            mvvmMenuItem.Add(mnuRefreash);
        }