예제 #1
0
        private IEnumerable <CommandButtonViewModel <object> > CreateCommandButtons()
        {
            var result = new List <CommandButtonViewModel <object> >();

            if (SelectedEntity != null)
            {
                result.AddRange(_applicationState.GetAutomationCommands().Where(x => x.DisplayOnTicketList)
                                .Select(x => new CommandButtonViewModel <object>
                {
                    Caption   = x.AutomationCommand.Name,
                    Command   = _executeAutomationCommand,
                    Color     = x.AutomationCommand.Color,
                    FontSize  = x.AutomationCommand.FontSize,
                    Parameter = x
                }));

                result.Add(new CommandButtonViewModel <object>
                {
                    Caption  = MergeTicketsCommand.Caption,
                    Command  = MergeTicketsCommand,
                    FontSize = 40,
                    Color    = "Gainsboro"
                });

                result.Add(new CommandButtonViewModel <object>
                {
                    Caption  = CloseCommand.Caption,
                    Command  = CloseCommand,
                    FontSize = 40,
                    Color    = "Red"
                });
            }
            return(result);
        }
        private IEnumerable <CommandButtonViewModel <object> > CreateCommandButtons()
        {
            var result = new List <CommandButtonViewModel <object> >();

            if (_paymentEditor.SelectedTicket != null)
            {
                result.AddRange(_applicationState.GetCalculationSelectors().Where(x => !string.IsNullOrEmpty(x.ButtonHeader))
                                .Select(x => new CommandButtonViewModel <object>
                {
                    Caption   = x.ButtonHeader,
                    Command   = _serviceSelectedCommand,
                    Color     = x.ButtonColor,
                    FontSize  = x.FontSize,
                    Parameter = x
                }));

                result.AddRange(_applicationState.GetAutomationCommands().Where(x => x.AutomationCommand != null && !string.IsNullOrEmpty(x.AutomationCommand.ButtonHeader) && x.DisplayOnPayment && x.CanDisplay(_paymentEditor.SelectedTicket))
                                .Select(x => new CommandButtonViewModel <object>
                {
                    Caption   = x.AutomationCommand.ButtonHeader,
                    Command   = _executeAutomationCommand,
                    Color     = x.AutomationCommand.Color,
                    FontSize  = x.AutomationCommand.FontSize,
                    Parameter = x
                }));
            }
            return(result);
        }
예제 #3
0
 private void UpdateAutomationCommands()
 {
     AutomationCommands = _applicationState.GetAutomationCommands().Where(x => x.DisplayOnCommandSelector && x.CanDisplay(_selectedTicket));
     RaisePropertyChanged(nameof(AutomationCommands));
     RaisePropertyChanged(nameof(ColumnCount));
 }