Пример #1
0
        public UserControl LoadApplication(UserControl requestedApplication)
        {
            int startIndexOfFullName = requestedApplication.ToString().LastIndexOf('.') + 1;
              int lastIndexOfFullName = requestedApplication.ToString().IndexOf('_');
              string appTileName = requestedApplication.ToString().Substring(startIndexOfFullName, lastIndexOfFullName - startIndexOfFullName);
              foreach (UserControl Apps in AppLauncherControl.AppContent)
              {
            startIndexOfFullName = Apps.ToString().LastIndexOf('.') + 1;
            lastIndexOfFullName = Apps.ToString().IndexOf('_');
            string appContentName = Apps.ToString().Substring(startIndexOfFullName, lastIndexOfFullName - startIndexOfFullName);

            if (appTileName == appContentName)
            {
              currentLoadedApplication = Apps;
              break;
            }
              }
              return currentLoadedApplication;
        }
Пример #2
0
        public ContextMenu creationMenuClicDroitMain(UserControl usercontrol)
        {
            ContextMenu contextMenu = this.creationBaseMenuClicDroit();

            if (((App)App.Current).securite.VerificationDroitActionsCRUD(usercontrol.ToString(), "Look"))
            {
                MenuItem itemAfficher = new MenuItem();
                itemAfficher.Header = "Afficher";
                itemAfficher.Click += new RoutedEventHandler(delegate { ((App)App.Current)._theMainWindow._CommandLook.Command.Execute(((App)App.Current)._theMainWindow); });

                contextMenu.Items.Add(itemAfficher);
            }
            if (((App)App.Current).securite.VerificationDroitActionsCRUD(usercontrol.ToString(), "Add"))
            {
                MenuItem itemAfficher = new MenuItem();
                itemAfficher.Header = "Ajouter";
                itemAfficher.Click += new RoutedEventHandler(delegate { ((App)App.Current)._theMainWindow._CommandAdd.Command.Execute(((App)App.Current)._theMainWindow); });

                contextMenu.Items.Add(itemAfficher);
            }
            if (((App)App.Current).securite.VerificationDroitActionsCRUD(usercontrol.ToString(), "Update"))
            {
                MenuItem itemAfficher = new MenuItem();
                itemAfficher.Header = "Modifier";
                itemAfficher.Click += new RoutedEventHandler(delegate { ((App)App.Current)._theMainWindow._CommandUpdate.Command.Execute(((App)App.Current)._theMainWindow); });

                contextMenu.Items.Add(itemAfficher);
            }
            if (((App)App.Current).securite.VerificationDroitActionsCRUD(usercontrol.ToString(), "Remove"))
            {
                MenuItem itemAfficher = new MenuItem();
                itemAfficher.Header = "Supprimer";
                itemAfficher.Click += new RoutedEventHandler(delegate { ((App)App.Current)._theMainWindow._CommandDelete.Command.Execute(((App)App.Current)._theMainWindow); });

                contextMenu.Items.Add(itemAfficher);
            }

            return contextMenu;
        }