Ejemplo n.º 1
0
        private void OnMenuItemButton_Click(ContentItemEnum itemButtonEnum, object parameter)
        {
            if (_selectedContentItemEnum == itemButtonEnum)
            {
                return;
            }
            _selectedContentItemEnum = itemButtonEnum;
            mainContentPanel.Controls.Clear();

            switch (itemButtonEnum)
            {
            case ContentItemEnum.Summary:
                mainContentPanel.Controls.Add(_summaryUserControl);
                break;

            case ContentItemEnum.Passbook:
                mainContentPanel.Controls.Add(_passbookUserControl);
                break;

            case ContentItemEnum.TransactionParty:
                mainContentPanel.Controls.Add(_transactionPartyUserControl);
                break;

            case ContentItemEnum.Transaction:
                mainContentPanel.Controls.Add(_transactionUserControl);
                break;

            case ContentItemEnum.ManageTransaction:
                mainContentPanel.Controls.Add
                (
                    new ManageTransactionUserControl(OnMenuItemButton_Click, parameter as TransactionEntity)
                {
                    Dock    = DockStyle.Fill,
                    Visible = true,
                    Padding = new Padding(0),
                    Margin  = new Padding(0)
                }
                );
                break;

            case ContentItemEnum.Task:
                mainContentPanel.Controls.Add(_taskUserControl);
                break;

            case ContentItemEnum.LogAlert:
                mainContentPanel.Controls.Add(_logUserControl);
                break;

            default:
                throw new NotImplementedException($"ContentItemEnum - {itemButtonEnum}, not implemented");
            }
        }
        public MenuItemUserControl(ContentItemEnum menuItemButtonEnum,
                                   Action <ContentItemEnum> menuItemButtonAction,
                                   Image menuItemButtonImage,
                                   string menuItemButtonText)
        {
            InitializeComponent();
            _itemButtonEnum = menuItemButtonEnum;
            _action         = menuItemButtonAction;

            Size menuItemImageSize = new Size(45, 45);

            _image = new Bitmap(menuItemButtonImage, menuItemImageSize);

            Visible         = true;
            Enabled         = true;
            Name            = $"MenuItemUserControl-{(short)menuItemButtonEnum}";
            TabIndex        = (int)menuItemButtonEnum;
            menuButton.Text = menuItemButtonText;
        }
Ejemplo n.º 3
0
        private void InitializeInterfaceComonents()
        {
            #region Menu Items

            MenuItemUserControl CreateMenuItem(ContentItemEnum itemButtonEnum, Image menuItemImage, string itemButtonText)
            {
                return(new MenuItemUserControl(itemButtonEnum, OnMenuItemButton_Click, menuItemImage, itemButtonText)
                {
                    Size = new Size(280, 50)
                });
            }

            //Image image = global::FinAndTime.Views.Properties.Resources.summary_icon;
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Summary, Properties.Resources.summary_icon, "Dashboard"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Passbook, Properties.Resources.Passbook_icon, "Passbook"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.TransactionParty, Properties.Resources.Transaction_party_icon, "Transaction Party"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Transaction, Properties.Resources.Transaction_icon, "Transactions"));
            menuFlowLayoutPanel.Controls.Add(CreateMenuItem(ContentItemEnum.Task, Properties.Resources.Tasks_icon, "Tasks"));

            #endregion

            #region Content section

            _summaryUserControl = new DashboardUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _passbookUserControl = new PassbookUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _transactionPartyUserControl = new TransactionPartyUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _transactionUserControl = new TransactionUserControl(OnMenuItemButton_Click)
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _taskUserControl = new TaskUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _logUserControl = new LogUserControl()
            {
                Dock    = DockStyle.Fill,
                Visible = true,
                Padding = new Padding(0),
                Margin  = new Padding(0)
            };

            _selectedContentItemEnum = ContentItemEnum.Summary;
            mainContentPanel.Controls.Add(_summaryUserControl);
            #endregion
        }
Ejemplo n.º 4
0
 private void OnMenuItemButton_Click(ContentItemEnum itemButtonEnum)
 {
     OnMenuItemButton_Click(itemButtonEnum, null);
 }