Beispiel #1
0
        protected override void OnSelectedMenuItem(MenuItemViewModel o)
        {
            if (o != null)
            {
                if (SelectedType != null)
                {
                    var objectsOfPreviousType = _Objects.OfType(SelectedType);
                    objectsOfPreviousType.CollectionChanged -= MasterItemsChangedEventHandler;
                }

                var menuItemType  = SelectedType = (Type)o.Tag;
                var objectsOfType = _Objects.OfType(menuItemType);
                MasterItemsChangedEventHandler   = new NotifyCollectionChangedEventHandler((s, e) => DirectItemsChanged?.Invoke(e));
                objectsOfType.CollectionChanged += MasterItemsChangedEventHandler;
                MasterItems = objectsOfType;
                Changed("MasterItems");

                var staticMethods   = menuItemType.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
                var staticFunctions = GetFunctions(null, staticMethods);

                MasterCommands.Clear();
                foreach (var function in staticFunctions)
                {
                    MasterCommands.Add(new ActionViewModel
                    {
                        Label  = function.Item1,
                        Icon   = function.Item2,
                        Action = function.Item3,
                    });
                }
            }
        }
Beispiel #2
0
 void SessionManagerUserLoggedIn(object sender, EventArgs e)
 {
     IsLoggedIn = SessionManager.CurrentUser != null;
     MasterCommands.RefreshRestartApplicationNotification();
     MasterCommands.RefreshRestartServerNotification();
 }