Beispiel #1
0
        ActionsCollection miniMaxOps(int state)
        {
            var arr = new ActionsCollection();

            arr.Add(plus1);
            arr.Add(plus3);
            return(arr);
        }
        void AddEventClick(object sender, RoutedEventArgs e)
        {
            BaseAction a = (BaseAction)System.Activator.CreateInstance((Type)((Button)sender).Tag);

            ActionsCollection.GetActions(AdornedElement as FrameworkElement).ActionsList.Add(a);
            FillActions();
            UpdateLayout();
        }
 void DeleteActionClicked(object sender, RoutedEventArgs e)
 {
     foreach (RadioButton butt in ActionsPanel.Children)
     {
         if (butt.IsChecked.Value)
         {
             ActionsCollection.GetActions(AdornedElement as FrameworkElement).ActionsList.Remove((BaseAction)butt.Tag);
             break;
         }
     }
     FillActions();
 }
Beispiel #4
0
 public ViewModel(IAction[] actions, ITranslator[] translators, Dictionary <string, ITranslator> checkers, ILogger logger)
 {
     _model                = new CalculatorModel();
     Translators           = translators;
     this.checkers         = checkers;
     CalculateCommand      = new DelegateCommand(ExecuteCalculate);
     TranslateCommand      = new DelegateCommand(ExecuteTranslate);
     ClearCalculateCommand = new DelegateCommand(ExecuteClearCalculate);
     ClearTranslateCommand = new DelegateCommand(ExecuteClearTranslate);
     GetPreviousCommand    = new DelegateCommand(ExecuteGetPrevious);
     Actions               = new ActionsCollection(actions);
     CalculatorInput       = new string[2];
     TranslatorChosen      = new bool[Translators.Length];
     _logger               = logger;
 }
 void FillActions()
 {
     ActionsPanel.Children.Clear();
     helperObject.RenderOpen().Close();
     foreach (BaseAction action in ActionsCollection.GetActions(AdornedElement as FrameworkElement).ActionsList)
     {
         RadioButton b = new RadioButton();
         b.BorderBrush     = Brushes.Blue;
         b.BorderThickness = new Thickness(1);
         b.Background      = Brushes.White;
         //TextBlock t = new TextBlock();
         //t.Text = action.GetType().Name;
         b.Content = action.GetType().Name;
         ActionsPanel.Children.Add(b);
         //b.MouseLeftButtonDown+=new MouseButtonEventHandler(ActionPresed);
         b.Click += new RoutedEventHandler(ActionClicked);
         b.Tag    = action;
     }
 }
 private void ReceiveScriptBrickCollectionMessageAction(GenericMessage <List <Object> > message)
 {
     _actionsCollection            = message.Content[0] as ActionsCollection;
     _firstVisibleScriptBrickIndex = ((PortableListBoxViewPort)message.Content[1]).FirstVisibleIndex;
     _lastVisibleScriptBrickIndex  = ((PortableListBoxViewPort)message.Content[1]).LastVisibleIndex;
 }