Exemplo n.º 1
0
        private MenuItemStyle ReplaceMenuItem(MenuItemStyle oldMenuItem, MenuItemStyle newMenuItem)
        {
            DeleteMenuItem(oldMenuItem);
            AddMenuItem(newMenuItem);

            return(newMenuItem);
        }
Exemplo n.º 2
0
        public bool Equals(MenuItemStyle other)
        {
            bool result = Selected == other.Selected &&
                          IsMouseOver == other.IsMouseOver &&
                          Background == other.Background &&
                          NotSelectedAndMouseIsNotOverBackgroundColor == other.NotSelectedAndMouseIsNotOverBackgroundColor &&
                          NotSelectedAndMouseIsOverBackgroundColor == other.NotSelectedAndMouseIsOverBackgroundColor &&
                          SelectedAndMouseIsNotOverBackgroundColor == other.SelectedAndMouseIsNotOverBackgroundColor &&
                          SelectedAndMouseIsOverBackgroundColor == other.SelectedAndMouseIsOverBackgroundColor;

            return(result);
        }
Exemplo n.º 3
0
        private void RefreshMenuItems(object sender, PropertyChangedEventArgs args)
        {
            if (args != null && args.PropertyName == "Selected")
            {
                MenuItemStyle menuItem = sender as MenuItemStyle;

                if (menuItem != null && menuItem.Selected)
                {
                    menuItems.Where(item => item != menuItem).ToList().ForEach(item => item.Selected = false);
                    OnMenuChanged(menuItem.Name);
                }
            }
        }
Exemplo n.º 4
0
        public MenuItemsStyle(IDomainContext domainContext,
                              LinearGradientBrush notSelectedAndMouseIsNotOverColorBrush,
                              LinearGradientBrush notSelectedAndMouseIsOverColorBrush,
                              LinearGradientBrush selectedAndMouseIsNotOverColorBrush,
                              LinearGradientBrush selectedAndMouseIsOverColorBrush)
        {
            notSelectedAndMouseIsNotOverBackgroundColor = notSelectedAndMouseIsNotOverColorBrush;
            notSelectedAndMouseIsOverBackgroundColor    = notSelectedAndMouseIsOverColorBrush;
            selectedAndMouseIsNotOverBackgroundColor    = selectedAndMouseIsNotOverColorBrush;
            selectedAndMouseIsOverBackgroundColor       = selectedAndMouseIsOverColorBrush;

            priceListMenuItemStyle = new MenuItemStyle(MenuItemName.PriceList, domainContext,
                                                       notSelectedAndMouseIsNotOverColorBrush,
                                                       notSelectedAndMouseIsOverColorBrush,
                                                       selectedAndMouseIsNotOverColorBrush,
                                                       selectedAndMouseIsOverColorBrush);
            ordersMenuItemStyle = new MenuItemStyle(MenuItemName.Orders, domainContext,
                                                    notSelectedAndMouseIsNotOverColorBrush,
                                                    notSelectedAndMouseIsOverColorBrush,
                                                    selectedAndMouseIsNotOverColorBrush,
                                                    selectedAndMouseIsOverColorBrush);
            documentsMenuItemStyle = new MenuItemStyle(MenuItemName.Documents, domainContext,
                                                       notSelectedAndMouseIsNotOverColorBrush,
                                                       notSelectedAndMouseIsOverColorBrush,
                                                       selectedAndMouseIsNotOverColorBrush,
                                                       selectedAndMouseIsOverColorBrush);
            syncMenuItemStyle = new MenuItemStyle(MenuItemName.Sync, domainContext,
                                                  notSelectedAndMouseIsNotOverColorBrush,
                                                  notSelectedAndMouseIsOverColorBrush,
                                                  selectedAndMouseIsNotOverColorBrush,
                                                  selectedAndMouseIsOverColorBrush);
            settingsMenuItemStyle = new MenuItemStyle(MenuItemName.Settings, domainContext,
                                                      notSelectedAndMouseIsNotOverColorBrush,
                                                      notSelectedAndMouseIsOverColorBrush,
                                                      selectedAndMouseIsNotOverColorBrush,
                                                      selectedAndMouseIsOverColorBrush);

            menuItems = new List <MenuItemStyle>();

            AddMenuItem(priceListMenuItemStyle);
            AddMenuItem(ordersMenuItemStyle);
            AddMenuItem(documentsMenuItemStyle);
            AddMenuItem(syncMenuItemStyle);
            AddMenuItem(settingsMenuItemStyle);
        }
Exemplo n.º 5
0
 private void UnsubscribeToEventOnChangeMenuItem(MenuItemStyle menuItem)
 {
     menuItem.PropertyChanged -= RefreshMenuItems;
 }
Exemplo n.º 6
0
 private void DeleteMenuItem(MenuItemStyle menuItem)
 {
     UnsubscribeToEventOnChangeMenuItem(menuItem);
     menuItems.Remove(menuItem);
 }
Exemplo n.º 7
0
 private void AddMenuItem(MenuItemStyle menuItem)
 {
     menuItems.Add(menuItem);
     SubscribeToEventOnChangeMenuItem(menuItem);
 }