Beispiel #1
0
        public static T GetCommandFromCommandButtons <T>(object sender) where T : CommandModelBase
        {
            CommandListingButtonsControl commandListingButtonsControl = (CommandListingButtonsControl)sender;

            if (commandListingButtonsControl != null && commandListingButtonsControl.DataContext != null)
            {
                if (commandListingButtonsControl.DataContext is CommandModelBase)
                {
                    return((T)commandListingButtonsControl.DataContext);
                }
                else if (commandListingButtonsControl.DataContext is EventCommandItemViewModel)
                {
                    EventCommandItemViewModel commandItem = (EventCommandItemViewModel)commandListingButtonsControl.DataContext;
                    return((T)(CommandModelBase)commandItem.Command);
                }
                else if (commandListingButtonsControl.DataContext is StreamPassCustomLevelUpCommandViewModel)
                {
                    StreamPassCustomLevelUpCommandViewModel commandItem = (StreamPassCustomLevelUpCommandViewModel)commandListingButtonsControl.DataContext;
                    return((T)commandItem.Command);
                }
                else if (commandListingButtonsControl.DataContext is RedemptionStoreProductViewModel)
                {
                    RedemptionStoreProductViewModel commandItem = (RedemptionStoreProductViewModel)commandListingButtonsControl.DataContext;
                    return((T)commandItem.Command);
                }
                else if (commandListingButtonsControl.DataContext is GameOutcomeViewModel)
                {
                    GameOutcomeViewModel commandItem = (GameOutcomeViewModel)commandListingButtonsControl.DataContext;
                    return((T)(CommandModelBase)commandItem.Command);
                }
            }
            return(null);
        }
Beispiel #2
0
 public T GetCommandFromCommandButtons <T>() where T : CommandModelBase
 {
     return(CommandListingButtonsControl.GetCommandFromCommandButtons <T>(this));
 }
Beispiel #3
0
 public CommandModelBase GetCommandFromCommandButtons()
 {
     return(CommandListingButtonsControl.GetCommandFromCommandButtons <CommandModelBase>(this));
 }