Example #1
0
 public void Add(IGridAction action)
 {
     _pages.FirstOrNone(el => el.HasSpace())
     .ValueOr(CreateNewPage)
     .Add(action);
     CurrentPage.ApplyToGrid(_grid);
 }
Example #2
0
 public void Add(IGridAction action)
 {
     if (!HasSpace())
     {
         throw new InvalidOperationException("no space left");
     }
     _actions.Add(action);
 }
Example #3
0
        private Button RenderButton(IGridAction action, Option <Key> hotKey)
        {
            var button    = new Button();
            var textBlock = new TextBlock
            {
                Text = action.MainText + "\n\n"
            };

            textBlock.Inlines.Add(new TextBlock
            {
                Text       = action.SubText,
                FontWeight = FontWeights.Bold
            });
            hotKey.MatchSome(key => textBlock.Inlines.Add(new TextBlock
            {
                Text      = "  " + key,
                FontStyle = FontStyles.Italic
            }));
            button.Content    = textBlock;
            button.Click     += (o, a) => action.HandleClick();
            button.Template   = Application.Current.Resources["tplCubeButton"] as ControlTemplate;
            button.Background = new SolidColorBrush(Color.FromRgb(0xFF, 0xA0, 0x00));
            return(button);
        }