private void CustomProductCommandButtons_DeleteClicked(object sender, RoutedEventArgs e)
        {
            CommandListingButtonsControl    button  = (CommandListingButtonsControl)sender;
            RedemptionStoreProductViewModel product = (RedemptionStoreProductViewModel)button.DataContext;

            product.Command = null;
        }
Exemplo n.º 2
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);
        }
 private void Window_CommandSaved(object sender, CommandModelBase command)
 {
     if (this.lastSelectedProductCommand != null)
     {
         this.lastSelectedProductCommand.Command = command;
     }
     this.lastSelectedProductCommand = null;
 }
 private void CustomProductNewCommandWindow_CommandSaveSuccessfully(object sender, CommandBase e)
 {
     if (this.lastSelectedProductCommand != null)
     {
         this.lastSelectedProductCommand.Command = (CustomCommand)e;
     }
     this.lastSelectedProductCommand = null;
 }
        private void CustomProductCommandButtons_EditClicked(object sender, RoutedEventArgs e)
        {
            CommandButtonsControl           button  = (CommandButtonsControl)sender;
            RedemptionStoreProductViewModel product = (RedemptionStoreProductViewModel)button.DataContext;
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(product.Command));

            window.Show();
        }
        private void CustomProductNewCommandButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            this.lastSelectedProductCommand = (RedemptionStoreProductViewModel)button.DataContext;
            CommandEditorWindow window = new CommandEditorWindow(CommandTypeEnum.Custom, MixItUp.Base.Resources.CustomProductRedemption);

            window.CommandSaved += Window_CommandSaved;
            window.Show();
        }
        private void CustomProductNewCommandButton_Click(object sender, RoutedEventArgs e)
        {
            Button button = (Button)sender;

            this.lastSelectedProductCommand = (RedemptionStoreProductViewModel)button.DataContext;
            CommandWindow window = new CommandWindow(new CustomCommandDetailsControl(new CustomCommand(MixItUp.Base.Resources.CustomProductRedemption)));

            window.CommandSaveSuccessfully += CustomProductNewCommandWindow_CommandSaveSuccessfully;
            window.Show();
        }