private static void SetupLinkGroup(LinkGroupCollection menuLinkGroups, LinkCollection titleLinks, LinkGroupData linkGroupData, ref Uri contentSource) { Uri firstUri = null; var linkGroup = new LinkGroup { DisplayName = linkGroupData.DisplayName, GroupKey = linkGroupData.GroupKey }; foreach (var link in linkGroupData.Links) { var assemblyPath = AssemblyToolkit.GetDll(linkGroupData.Assembly); var settingsLink = new Link { DisplayName = link.DisplayName, Source = new Uri(assemblyPath + "+" + link.Source, UriKind.RelativeOrAbsolute) }; linkGroup.Links.Add(settingsLink); firstUri = new Uri(assemblyPath + "+" + link.Source, UriKind.RelativeOrAbsolute); if (flag++ == 0) { contentSource = new Uri(assemblyPath + "+" + link.Source, UriKind.RelativeOrAbsolute); } } if (linkGroupData.IsTitleLink) { titleLinks.Add(new Link { DisplayName = linkGroupData.DisplayName, Source = firstUri }); } menuLinkGroups.Add(linkGroup); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { LinkGroupCollection groups = new LinkGroupCollection(); LinkGroup group = new LinkGroup() { DisplayName = "margiebot" }; groups.Add(group); group.Links.Add(new Link() { DisplayName = "configure", Source = new Uri("/Views/ConfigureView.xaml", UriKind.Relative) }); group.Links.Add(new Link() { DisplayName = "debug", Source = new Uri("/Views/DebugView.xaml", UriKind.Relative) }); if ((bool)value) { group.Links.Add(new Link() { DisplayName = "talk", Source = new Uri("/Views/TalkView.xaml", UriKind.Relative) }); } return(groups); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { LinkGroupCollection groups = new LinkGroupCollection(); LinkGroup group = new LinkGroup() { DisplayName = "margiebot" }; groups.Add(group); group.Links.Add(new Link() { DisplayName = "configure", Source = new Uri("/Views/ConfigureView.xaml", UriKind.Relative) }); group.Links.Add(new Link() { DisplayName = "debug", Source = new Uri("/Views/DebugView.xaml", UriKind.Relative) }); if ((bool)value) { group.Links.Add(new Link() { DisplayName = "talk", Source = new Uri("/Views/TalkView.xaml", UriKind.Relative) }); } return groups; }
public MasterViewModel() { _menu = new LinkGroupCollection(); String roleUser = LoginViewModel.GetUser().Role; LinkGroup groupPatient = new LinkGroup(); LinkGroup groupUser = new LinkGroup(); groupPatient.DisplayName = "Patients"; groupUser.DisplayName = "Utilisateurs"; groupPatient.Links.Add(new Link { DisplayName = "Consulter", Source = new Uri("/View/Pages/PatientList.xaml", UriKind.Relative), }); groupUser.Links.Add(new Link { DisplayName = "Consulter", Source = new Uri("/View/Pages/UserList.xaml", UriKind.Relative), }); if (!roleUser.Equals("Infirmier") && !roleUser.Equals("Infirmière")) { groupPatient.Links.Add(new Link { DisplayName = "Ajouter", Source = new Uri("/View/Pages/PatientAdd.xaml", UriKind.Relative), }); groupUser.Links.Add(new Link { DisplayName = "Ajouter", Source = new Uri("/View/Pages/UserAdd.xaml", UriKind.Relative), }); } _menu.Add(groupPatient); _menu.Add(groupUser); }
protected override void ConfigureModuleCatalog() { // Dynamic Modules are copied to a directory as part of a post-build step. // These modules are not referenced in the startup project and are discovered // by examining the assemblies in a directory. The module projects have the // following post-build step in order to copy themselves into that directory: // // xcopy "$(TargetDir)$(TargetFileName)" "$(TargetDir)modules\" /y // // WARNING! Do not forget to explicitly compile the solution before each running // so the modules are copied into the modules folder. var directoryCatalog = (DirectoryModuleCatalog)ModuleCatalog; directoryCatalog.Initialize(); Logger.Log("directoryCatalog Initialized", Category.Info, Priority.Low); linkGroupCollection = new LinkGroupCollection(); var typeFilter = new TypeFilter(InterfaceFilter); foreach (var module in directoryCatalog.Items) { var mi = (ModuleInfo)module; var asm = Assembly.LoadFrom(mi.Ref); foreach (Type t in asm.GetTypes()) { var myInterfaces = t.FindInterfaces(typeFilter, typeof(ILinkGroupService).ToString()); if (myInterfaces.Length > 0) { // We found the type that implements the ILinkGroupService interface var linkGroupService = (ILinkGroupService)asm.CreateInstance(t.FullName); var linkGroup = linkGroupService.GetLinkGroup(); linkGroupCollection.Add(linkGroup); } } } // Module CoreModule is defined in the code. var moduleCatalog = (ModuleCatalog)ModuleCatalog; moduleCatalog.AddModule(typeof(FrameworkModule)); moduleCatalog.AddModule(typeof(CoreModule)); }
public MainWindowsViewModel() { WindowTitle = "Hello " + App.CurentHuman.HoTen; // fill groups if (App.CurrentPermissions.HoTroGiaoTiepKH) { var Home = new LinkGroup { DisplayName = "Welcome" }; Home.Links.Add(new Link { DisplayName = "Home", Source = new Uri("/Pages/Home.xaml", UriKind.Relative) }); this.groups.Add(Home); var Customer = new LinkGroup { DisplayName = "Customer" }; Customer.Links.Add(new Link { DisplayName = "Customer info", Source = new Uri("/Pages/Customer.xaml", UriKind.Relative) }); Customer.Links.Add(new Link { DisplayName = "Birthday", Source = new Uri("/Pages/BirthDay.xaml", UriKind.Relative) }); this.groups.Add(Customer); this.ContentSource = new Uri("/Pages/Home.xaml", UriKind.Relative); } if (App.CurrentPermissions.BaoCaoThongKe) { var StatisticalAndReport = new LinkGroup { DisplayName = "Statistical & Report" }; StatisticalAndReport.Links.Add(new Link { DisplayName = "Statistical", Source = new Uri("/pages/Statistical.xaml", UriKind.Relative) }); StatisticalAndReport.Links.Add(new Link { DisplayName = "Report", Source = new Uri("/Pages/Reports.xaml", UriKind.Relative) }); groups.Add(StatisticalAndReport); if (ContentSource == null) { this.ContentSource = new Uri("/Pages/Statisticals.xaml", UriKind.Relative); } } if (App.CurrentPermissions.QLTTNV) // có toàn quyền quản lí nhân viên có nghĩa là Admin { var Administrator = new LinkGroup { DisplayName = "Admin Work Space" }; Administrator.Links.Add(new Link { DisplayName = "Backup", Source = new Uri("/Pages/Backup.xaml", UriKind.Relative) }); Administrator.Links.Add(new Link { DisplayName = "Setting", Source = new Uri("/Pages/AdminSettings.xaml", UriKind.Relative) }); Administrator.Links.Add(new Link { DisplayName = "User Manage", Source = new Uri("/Pages/Usermanage.xaml", UriKind.Relative) }); groups.Add(Administrator); if (ContentSource == null) { this.ContentSource = new Uri("/Pages/Backup.xaml", UriKind.Relative); } } if (App.CurrentPermissions.XemTTQuaTang) { var Gift = new LinkGroup { DisplayName = "Gift" }; Gift.Links.Add(new Link { DisplayName = "Gift View", Source = new Uri("/Pages/GiftView.xaml", UriKind.Relative) }); if (App.CurrentPermissions.QLTTQuaTang) { Gift.Links.Add(new Link { DisplayName = "Gift Manage", Source = new Uri("/Pages/GiftManage.xaml", UriKind.Relative) }); } groups.Add(Gift); } }
private async void LoadMenus() { var menuCollection = new LinkGroupCollection(); var grpScan = new LinkGroup { DisplayName = "Scan", }; //grpScan.Links.Add(new Link //{ // DisplayName = "Selection", // Source = new Uri("/Pages/DetectionSelection.xaml", UriKind.RelativeOrAbsolute) //}); grpScan.Links.Add(new Link { DisplayName = "Results", Source = new Uri("/Pages/DetectionResults.xaml", UriKind.RelativeOrAbsolute) }); menuCollection.Add(grpScan); var grpTools = new LinkGroup { DisplayName = "Tools" }; grpTools.Links.Add(new Link { DisplayName = "tools", Source = new Uri("/Pages/Tools.xaml", UriKind.RelativeOrAbsolute) }); menuCollection.Add(grpTools); var grpSettings = new LinkGroup { DisplayName = "Settings", GroupKey = "settings", }; grpSettings.Links.Add(new Link { DisplayName = "Add-in's", Source = new Uri("/Pages/AddInManager.xaml", UriKind.RelativeOrAbsolute) }); menuCollection.Add(grpSettings); var grpAbout = new LinkGroup { DisplayName = "About", GroupKey = "about", }; grpAbout.Links.Add( new Link { DisplayName = "Credits", Source = new Uri("/Pages/About.xaml", UriKind.RelativeOrAbsolute) }); menuCollection.Add(grpAbout); MenuCollection = menuCollection; }