예제 #1
0
		public MainViewModel()
        {
			////if (IsInDesignMode)
			////{
			////    // Code runs in Blend --> create design time data.
			////}
			////else
			////{
			////    // Code runs "for real"
			////}
			Instructions = Enum.GetNames(typeof(Instruction));
			Board = new Board();
			Droid1 = new Droid();
			Droid1.color = DroidColor.Yellow;
			Droid1.position = new Position(1, 1);
			Droid1.direction = Direction.Right;
			Droid1.Instructions.Add(Instruction.Move1);
			Droid1.Instructions.Add(Instruction.Move1);
			//Board.boardElements.Add(Droid1);
			Board.Droids.Add(Droid1);

			ExecutePhaseCommand = new RelayCommand(() => ExecutePhaseButtonAction());

			Droid1AddInstructionCommand = new RelayCommand(
				() => {
					//MessageBox.Show(String.Format("You you want add this instruction: {0}", Droid1SelectedInstruction));
					Droid1.Instructions.Add(Droid1SelectedInstruction);
				},
				() => Droid1.Instructions.Count < 5)
				;
		}
예제 #2
0
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;

            Posts = new ObservableCollection<Post>(ModelFactory.GetRandomPosts(10000));
            SortCommand = new RelayCommand(Sort);

            aggregate_comparer = new AggregateComparer<Post>(CollectionViewSource.GetDefaultView(Posts) as ListCollectionView, new ComparerFactory());
        }