コード例 #1
0
ファイル: App.xaml.cs プロジェクト: yousefm87/FilePlayer
 private void EventHandler(ViewEventArgs e)
 {
     if (e.action.Equals("EXIT"))
     {
         Dispatcher.Invoke((Action)delegate
         {
             this.iEventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Publish(new ViewEventArgs("GAMEPAD_ABORT", new String[] { }));
             Application.Current.Shutdown();
         });
     }
 }
コード例 #2
0
        public void TestMoveDown(int numMoves)
        {
            ViewEventArgs moveDownEventArgs = new ViewEventArgs("ITEMLIST_MOVE_DOWN", new string[] { numMoves.ToString() });
            ItemListViewModel viewModel = new ItemListViewModel(eventAggregator);
            for (int i = 1; i <= viewModel.AllItemNames.Count() + 1; i++)
            {
                int expected = viewModel.SelectedItemIndex + numMoves;
                if (expected > viewModel.AllItemNames.Count() - 1)
                {
                    expected = viewModel.AllItemNames.Count() - 1;
                }
                this.eventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Publish(moveDownEventArgs);

                int actual = viewModel.SelectedItemIndex;

                Assert.IsTrue(expected == actual, "Move Down failed. Expected: " + expected + " Actual: " + actual);
            }
        }
コード例 #3
0
        public void TestMoveRight()
        {
            ViewEventArgs moveRightEventArgs = new ViewEventArgs("ITEMLIST_MOVE_RIGHT", new string[] { });
            ItemListViewModel viewModel = new ItemListViewModel(eventAggregator);

            for (int i = 1; i <= viewModel.ItemLists.GetConsoleCount() + 1; i++)
            {
                int expected = viewModel.ItemLists.CurrConsole + 1;
                if (expected > viewModel.ItemLists.GetConsoleCount() - 1)
                {
                    expected = viewModel.ItemLists.GetConsoleCount() - 1;
                }
                this.eventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Publish(moveRightEventArgs);

                int actual = viewModel.ItemLists.CurrConsole;

                Assert.IsTrue(expected == actual, "Move Right failed. Expected: " + expected + " Actual: " + actual);
            }
        }
コード例 #4
0
 private void EventHandler(ViewEventArgs e)
 {
     if (eventMap.ContainsKey(e.action))
     {
         eventMap[e.action]();
     }
 }
コード例 #5
0
 void PerformViewAction(object sender, ViewEventArgs e)
 {
     if(eventMap.ContainsKey(e.action))
     {
         eventMap[e.action](e.addlInfo);
     }
 }
コード例 #6
0
        public void Test_ToggleFilter()
        {
            ViewEventArgs filterEventArgs = new ViewEventArgs("TOGGLE_FILTER", new string[] { });
            ItemListViewModel viewModel = new ItemListViewModel(eventAggregator);

            for (int i = 1; i <= 10; i++)
            {
                Visibility expected;
                if (viewModel.FilterVisibility == Visibility.Hidden)
                {
                    expected = Visibility.Visible;
                }
                else
                {
                    expected = Visibility.Hidden;
                }

                this.eventAggregator.GetEvent<PubSubEvent<ViewEventArgs>>().Publish(filterEventArgs);

                Visibility actual = viewModel.FilterVisibility;

                Assert.IsTrue(expected == actual, "Toggle filter failed. Expected: " + expected + " Actual: " + actual);
            }
        }
コード例 #7
0
        void EventHandler(ViewEventArgs e)
        {
            if (EventMapParam.ContainsKey(e.action))
            {
                EventMapParam[e.action](e.addlInfo[0]);
            }

            if (EventMap.ContainsKey(e.action))
            {
                EventMap[e.action]();
            }
        }
コード例 #8
0
        private void EventHandler(ViewEventArgs e)
        {
            if (eventMap.ContainsKey(e.action))
            {
                eventMap[e.action]();
            }

            if (eventMapParam.ContainsKey(e.action))
            {
                eventMapParam[e.action](e.addlInfo);
            }
        }