public static LinkGroup MenuAddGroup(LinkGroupCollection groups, string display) { LinkGroup group = new LinkGroup(); group.DisplayName = display; return(group); }
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); }
private void RebuildMenu(LinkGroupCollection groups) { this.groupMap.Clear(); if (groups != null) { // fill the group map based on group key foreach (var group in groups) { var groupKey = GetGroupKey(group); ReadOnlyLinkGroupCollection groupCollection; if (!this.groupMap.TryGetValue(groupKey, out groupCollection)) { // create a new collection for this group key groupCollection = new ReadOnlyLinkGroupCollection(new LinkGroupCollection()); this.groupMap.Add(groupKey, groupCollection); } // add the group groupCollection.List.Add(group); } } // update current selection UpdateSelection(); }
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; }
/// <summary> /// Create a new MenuViewModel /// </summary> public MenuViewModel() { Mediator.Register(this); MenuLinkGroups = new LinkGroupCollection(); SetDefaultMenu(); }
public void AddLinkGroups(LinkGroupCollection linkGroupCollection) { // CreateMenuLinkGroup(); foreach (LinkGroup linkGroup in linkGroupCollection) { this.MenuLinkGroups.Add(linkGroup); } }
private void OnLinkGroupsChanged(LinkGroupCollection oldValue, LinkGroupCollection newValue) { if (oldValue != null) { // detach old event handler oldValue.CollectionChanged -= OnLinkGroupsCollectionChanged; } if (newValue != null) { // ensures the menu is rebuild when changes in the LinkGroups occur newValue.CollectionChanged += OnLinkGroupsCollectionChanged; } RebuildMenu(newValue); }
private void OnAppAppearancePropertyChanged(object o, PropertyChangedEventArgs args) { if (args.PropertyName == nameof(AppAppearanceManager.Instance.DownloadsInSeparatePage)) { var value = AppAppearanceManager.Instance.DownloadsInSeparatePage; if (_downloadListParent != null) { _downloadListParent.Child = value ? null : (FrameworkElement)FindResource(@"DownloadsMenuSection"); } DownloadsEntry.IsAvailable = value; BrowserLinkGroup.GroupKey = value ? @"downloads" : @"content"; MenuLinkGroups = new LinkGroupCollection(MenuLinkGroups.ToList()); } }
public static void Setup(LinkGroupCollection menuLinkGroups, LinkCollection titleLinks, ref Uri contentSource) { foreach (var extensionData in PluginGruop.Singleton.ExtensionDatas) { foreach (var extensionNode in extensionData.ExtensionNodes) { if (extensionData.Type == ExtensionType.LinkGroup) { var linkGroupData = extensionNode as LinkGroupData; SetupLinkGroup(menuLinkGroups, titleLinks, linkGroupData, ref contentSource); } } } }
private void OnLinkGroupsChanged(LinkGroupCollection oldValue, LinkGroupCollection newValue) { if (oldValue != null) { oldValue.CollectionChanged -= OnLinkGroupsCollectionChanged; } if (newValue != null) { newValue.CollectionChanged += OnLinkGroupsCollectionChanged; } RebuildMenu(newValue); }
private void OnLinkGroupsChanged(LinkGroupCollection oldValue, LinkGroupCollection newValue) { if (oldValue != null) { // detach old event handler oldValue.CollectionChanged -= OnLinkGroupsCollectionChanged; } if (newValue != null) { // ensures the menu is rebuild when changes in the LinkGroups occur newValue.CollectionChanged += OnLinkGroupsCollectionChanged; } RebuildMenu(newValue); }
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 void BuidMenu() { var list = ReflectiveEnumerator.GetEnumerableOfType<AxonScreen>(); Screens = new ObservableCollection<AxonScreen>(list); LinkGroupCollection col = new LinkGroupCollection(); foreach (LinkGroup linkGroup in MenuLinkGroups) { var screens = (from s in list where s.ModuleName == linkGroup.DisplayName select s) ; foreach (AxonScreen screen in screens) { var mi = new Link { DisplayName = screen.ScreenName, Source = screen.SourcePath }; linkGroup.Links.Add(mi); } } //foreach (var s in list.ToArray()) // { // var mod = MenuLinkGroups.FirstOrDefault(n => (string)n.DisplayName == s.ModuleName); // if (mod == null ) // { // foreach (var screen in list.ToArray()) // { // if (screen.ModuleName != s.ModuleName) continue; // screen.DataService = Mds; // screen.Shell = this; // var mi = new Link // { // DisplayName = screen.ScreenName, // Source=screen.SourcePath // }; // mod.Links.Add(mi); // } // } // } this.UpdateLayout(); }
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); }
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; }
private void RebuildMenu(LinkGroupCollection groups) { _groupMap.Clear(); if (groups != null) { // fill the group map based on group key foreach (var group in groups) { var groupKey = GetGroupKey(group); ReadOnlyLinkGroupCollection groupCollection; if (!_groupMap.TryGetValue(groupKey, out groupCollection)) { // create a new collection for this group key groupCollection = new ReadOnlyLinkGroupCollection(new LinkGroupCollection()); _groupMap.Add(groupKey, groupCollection); } // add the group groupCollection.List.Add(group); } } // update current selection UpdateSelection(); }
public MainWindowViewModel(LinkGroupCollection menuLinkGroups) { this.menuLinkGroups = menuLinkGroups; Messenger.Instance.Register(o => SetNavigation(), ViewModelMessages.SetNavigation); }
/// <summary> /// Initializes a new instance of the <see cref="ReadOnlyLinkGroupCollection"/> class. /// </summary> /// <param name="list">The <see cref="LinkGroupCollection"/> with which to create this instance of the <see cref="ReadOnlyLinkGroupCollection"/> class.</param> public ReadOnlyLinkGroupCollection(LinkGroupCollection list) : base(list) { this.List = list; }
private void OnLinkGroupsChanged(LinkGroupCollection oldValue, LinkGroupCollection newValue) { if (oldValue != null) { oldValue.CollectionChanged -= OnLinkGroupsCollectionChanged; } if (newValue != null) { newValue.CollectionChanged += OnLinkGroupsCollectionChanged; } RebuildMenu(newValue); }