public void TestCollectionSync()
        {
            string item0 = "Item0";
            string item1 = "Item1";
            string item2 = "Item2";
            string item3 = "Item3";

            ObservableCollection<string> collection = new ObservableCollection<string>();

            HelperLabeledViewModelCollection viewModel = new HelperLabeledViewModelCollection(null, collection, o => o);

            collection.Add(item0);
            collection.Add(item1);
            collection.Add(item3);
            Assert.IsTrue(CompareCollectionValues(collection, viewModel), "Add did not work.");

            collection.Insert(2, item2);
            Assert.IsTrue(CompareCollectionValues(collection, viewModel), "Insert did not work.");

            collection.Remove(item3);
            Assert.IsTrue(CompareCollectionValues(collection, viewModel), "Remove did not work.");

            collection.Move(0, 1);
            Assert.IsTrue(CompareCollectionValues(collection, viewModel), "Move did not work.");

            collection.Clear();
            Assert.IsTrue(CompareCollectionValues(collection, viewModel), "Clear did not work.");
        }
		public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			var results = new ObservableCollection<object>();
			string[] parameters;
			if (parameter is string)
			{
				parameters = ((string)parameter).Split(',');
				for (var i = 0; i < parameters.Length; i++)
				{
					parameters[i] = parameters[i].Trim();
				}
			}
			else
			{
				parameters = new string[0];
			}
			var index = 0;
			foreach (var value in values)
			{
				if (value is IEnumerable)
				{
					results.Add(index < parameters.Length
									? new BindingGroup(value as IEnumerable, parameters[index])
									: value);
				}
				else
				{
					results.Add(value);
				}
				index++;
			}

			return results;
		}
示例#3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            _permission_List = new ObservableCollection<SYSPermission>();
            _permission_List2 = new List<sys_permission_rpc>();
            /*
            ad 广告操作
            community 社区操作
            entrance 编辑门禁
            role 角色管理操作
            user 用户操作
            */
            _permission_List.Add(new SYSPermission(new sys_permission_rpc() { name = "ad", desc = "广告操作" }));
            _permission_List.Add(new SYSPermission(new sys_permission_rpc() { name = "community", desc = "社区操作" }));
            _permission_List.Add(new SYSPermission(new sys_permission_rpc() { name = "entrance", desc = "编辑门禁" }));
            _permission_List.Add(new SYSPermission(new sys_permission_rpc() { name = "role", desc = "角色管理操作" }));
            _permission_List.Add(new SYSPermission(new sys_permission_rpc() { name = "user", desc = "用户操作" }));

            //var list = (Application.Current as App).Client.Proxy.get_permissions();
            //foreach(var item in list)
            //{
            //    _permission_List.Add(new SYSPermission(item));
            //}
            _permission_List2.Add(new sys_permission_rpc() { name = "user", desc = "用户操作" });
            PermissionList = _permission_List;
            SelectedList = _permission_List2;
            //listView.ItemsSelected = SelectedList;
        }
        public ProductCommentsViewModel()
        {
            ProductDisplayed = new Product()
            {
                Name = "Bolacha Maria"
            };

            UserRatings = new ObservableCollection<UserRating>();

            UserRatings.Add(new UserRating(){
                Id="1",
                Like = true,
                Comment="Me fez super bem",
                Profile=EnumProfile.Lactose,
                User=new User(){
                    Id="1",
                    Name="Zé Carioca",
                    Profiles = EnumProfile.Lactose | EnumProfile.Wheat
                }
            });

            UserRatings.Add (new UserRating () {
                Id = "21",
                Like = true,
                Comment = "Gostei do produto sem lactose",
                Profile = EnumProfile.Lactose,
                User = new User () {
                    Id = "21",
                    Name = "Zé Colméia",
                    Profiles =  EnumProfile.Lactose | EnumProfile.Wheat
                }
            });
        }
        public LeftPaneViewModel()
        {
            _assetTypesList = new ObservableCollection<AssetType>();
            _assetTypesList.Add(new AssetType { Name = "Bond", Value = "Bond" });
            _assetTypesList.Add(new AssetType { Name = "Stock", Value = "Stock" });

            this.addAssetCommand = new DelegateCommand(this.AddAssetExecute, this.AddAssetCanExecute);
        }
 public void Test_ObservableCollection_Count()
 {
     var list = new ObservableCollection<int>();
     Assert.Equal(0, list.Count);
     list.Add(3);
     Assert.Equal(1, list.Count);
     list.Add(3);
     Assert.Equal(2, list.Count);
 }
    static void Main()
    {
        ObservableCollection<string> items = new ObservableCollection<string>();
        items.CollectionChanged += items_CollectionChanged;

        items.Add("new item");
        items.Add("another item");
        items.Add("one more item");
        items[1] = "new value";
        items.RemoveAt(0);
    }
        public MainWindowViewModel()
        {
            _SelectableItemCollection = new ObservableCollection<SelectableItem>();
            _SelectableItemCollection.Add(new SelectableItem() { IsSelected = false, Name = "One" });
            _SelectableItemCollection.Add(new SelectableItem() { IsSelected = true, Name = "Two" });
            _SelectableItemCollection.Add(new SelectableItem() { IsSelected = false, Name = "Three" });

            _DateValue = DateTime.Now;

            _ExitCommand = new DelegateCommand(DoExit, CanDoExit);
        }
        public LibraryViewModel()
        {
            Sources = new ObservableCollection<Source>();
            Mangas = new ObservableCollection<MangaViewModel>();
            Sources.Add(new MangaHereSource());
            Sources.Add(new MangaReaderSource());
            UpdateMangasWithRecentChaptersCommand = new Command(UpdateMangasWithRecentChapters, true);
            UpdateMangasWithRecentChapters();
            ListCollectionView _customerView = CollectionViewSource.GetDefaultView(Mangas) as ListCollectionView;
            //_customerView.CustomSort = new MangaSorter(); 

        }
        public void ShouldSynchroniseChangedListAddMultipleSelectedItems()
        {
            //Arrange
              ObservableCollection<string> secondSelectedNames = new ObservableCollection<string>();

              // Act
              MultiSelectorBehaviours.SetSynchronizedSelectedItems(listView, (IList)secondSelectedNames);
              secondSelectedNames.Add(this.names.First());
              secondSelectedNames.Add(this.names.Last());

              // Assert
              this.listView.SelectedItems.ShouldBeEquivalentTo(secondSelectedNames);
        }
示例#11
0
文件: Marks.cs 项目: jahe/AP-HA
        public void InitializeMarks()
        {
            marks = new ObservableCollection<Mark>();

            // add default marks
            marks.Add(new Mark() { Name = "Herz" });
            marks.Add(new Mark() { Name = "Leber" });
            marks.Add(new Mark() { Name = "Nieren" });

            // binding
            marksListBox.ItemsSource = marks;

            // update labels in project
            updateLabels();
        }
        public void CanFilterCollection()
        {
            var originalCollection = new ObservableCollection<ItemMetadata>();
            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.Name == "Posible");

            originalCollection.Add(new ItemMetadata(new object()));

            Assert.AreEqual(0, viewsCollection.Count());

            var item = new object();
            originalCollection.Add(new ItemMetadata(item) { Name = "Posible" });
            Assert.AreEqual(1, viewsCollection.Count());

            Assert.AreSame(item, viewsCollection.First());
        }
示例#13
0
        public void PopulateReminderList()
        {
            //Populate complete list inside Reminder list
            ReminderItemList = new ObservableCollection<ReminderItem>();

            ReminderItemList.Add(new ReminderItem { Id = 1, Description = "desc1" });
            ReminderItemList.Add(new ReminderItem { Id = 2, Description = "desc2" });
            ReminderItemList.Add(new ReminderItem { Id = 3, Description = "desc3" });

            //foreach (var item in new ReminderItemDatabase().GetItems())
            //{
            //    ReminderList.Add(new ReminderListItem { Id = item.Id, VehiclePhoto = item.VehicleType + ".png", Name = item.Name, NextServiceDate = item.NextServiceDate.ToString("d") });

            //}
        }
		public void InitializeAvailableDevices(GKGuardZone zone)
		{
			AvailableDevices = new ObservableCollection<GuardZoneDeviceViewModel>();
			foreach (var device in GKManager.Devices)
			{
				if (device.Driver.HasGuardZone && !zone.GuardZoneDevices.Any(x => x.DeviceUID == device.UID))
				{
					if (device.GuardZones.Count > 0 || (device.IsInMPT && !GlobalSettingsHelper.GlobalSettings.ShowMPTsDevices)
							|| (device.ZoneUIDs.Count > 0 && !GlobalSettingsHelper.GlobalSettings.ShowZonesDevices)
							|| (device.Door != null && !GlobalSettingsHelper.GlobalSettings.ShowDoorsDevices))
						continue;

					var guardZoneDevice = new GKGuardZoneDevice
					{
						DeviceUID = device.UID,
						Device = device
					};
					var deviceViewModel = new GuardZoneDeviceViewModel(guardZoneDevice);
					AvailableDevices.Add(deviceViewModel);
				}
			}

			OnPropertyChanged(() => AvailableDevices);
			SelectedAvailableDevice = AvailableDevices.FirstOrDefault();
		}
示例#15
0
        public ObservableCollection<LinkageSetOR> selectAllDate()
        {
            string sql = @"select tl.*,t.StationName,d.DeviceName,c.ChannelName
             ,tLine.StationName as LineStationName,dLine.DeviceName as LineDeviceName,cLine.ChannelName  as LineChannelName
            from t_LinkageSet tl
            inner join t_Station t  on tl.StationID=t.StationID
            inner join t_Device d on tl.DeviceID=d.DeviceID
            inner join t_Channel c on tl.ChannelNo=c.ChannelNo and c.DeviceID=d.DeviceID
            inner join t_Station tLine  on tl.LinkageStationID=tLine.StationID
            inner join t_Device dLine on tl.LinkageDeviceID=dLine.DeviceID
            inner join t_Channel cLine on tl.LinkageChannelNo=cLine.ChannelNo and cLine.DeviceID=dLine.DeviceID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<LinkageSetOR> _List = new ObservableCollection<LinkageSetOR>();
            foreach (DataRow dr in dt.Rows)
            {
                LinkageSetOR obj = new LinkageSetOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
        private async Task<IEnumerable> GetUpdatesDataCore(string userID)
        {
            //Get all updates
            var updates = await ParseObject.GetQuery("Update").Include("User").FindAsync();

            var updatesModel = from c in updates select new UpdateModel(c);

            var groupedData = from u in updatesModel
                              group u by u.Date.Date into groupData
                              select new
                              {
                                  Name = groupData.Key,
                                  Items = groupData
                              };

            ObservableCollection<GroupedData<UpdateModel>> data = new ObservableCollection<GroupedData<UpdateModel>>();
            foreach (var item in groupedData)
            {
                GroupedData<UpdateModel> list = new GroupedData<UpdateModel>();
                list.Key = item.Name;
                foreach (var itemInGroup in item.Items)
                {
                    list.Add(itemInGroup);
                }
                data.Add(list);
            }

            return data;
        }
        public void RaisesCollectionChangedWithAddAndRemoveWhenFilteredCollectionChanges()
        {
            var originalCollection = new ObservableCollection<ItemMetadata>();
            IViewsCollection viewsCollection = new ViewsCollection(originalCollection, x => x.IsActive);
            bool addedToCollection = false;
            bool removedFromCollection = false;
            viewsCollection.CollectionChanged += (s, e) =>
                                                     {
                                                         if (e.Action == NotifyCollectionChangedAction.Add)
                                                         {
                                                             addedToCollection = true;
                                                         }
                                                         else if (e.Action == NotifyCollectionChangedAction.Remove)
                                                         {
                                                             removedFromCollection = true;
                                                         }
                                                     };
            var filteredInObject = new ItemMetadata(new object()) {IsActive = true};

            originalCollection.Add(filteredInObject);

            Assert.IsTrue(addedToCollection);
            Assert.IsFalse(removedFromCollection);

            originalCollection.Remove(filteredInObject);

            Assert.IsTrue(removedFromCollection);
        }
        private void LoadScreenList()
        {
            if (_menuScreens != null)
                return;

            _menuScreens = new ObservableCollection<MenuScreenAttribute>();

            var types = typeof (MenuViewModel).GetTypeInfo().Assembly.DefinedTypes
                .Where(x => x.CustomAttributes.Any(y => y.AttributeType == typeof(MenuScreenAttribute)));

            foreach (var viewModelType in types)
            {
                var attributes = viewModelType.GetCustomAttributes(typeof (MenuScreenAttribute));
                var attr = attributes.FirstOrDefault() as MenuScreenAttribute;
                
                if (attr != null)
                {
                    var requiredRoles = GetRequiredRoles(viewModelType);

                    //if (requiredRoles.All(x => GlobalState.User.IsInRole(x)))
                        attr.Visibility = Visibility.Visible;
                    //else
                    //    attr.Visibility = Visibility.Collapsed;

                    _menuScreens.Add(attr);
                }
            }
        }
示例#19
0
        public ObservableCollection<InspectionOR> selectAllDate()
        {
            string sql = @"select fp.*
            ,t.StationName,d.DeviceName,c.ChannelName,ty.TypeName  from t_Inspection fp
            inner join t_Station t  on fp.StationID=t.StationID
            inner join t_Device d on fp.DeviceID=d.DeviceID
            inner join t_DeviceType ty on ty.DeviceTypeID=d.DeviceTypeID
            inner join t_Channel c on fp.ChannelNO=c.ChannelNo and c.DeviceID=d.DeviceID";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<InspectionOR> _List = new ObservableCollection<InspectionOR>();
            foreach (DataRow dr in dt.Rows)
            {
                InspectionOR obj = new InspectionOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
    internal override ObservableCollection<object> QuerySubCollectionViewGroupList( GroupDescription subGroupBy, int nextLevel, bool nextLevelIsBottom )
    {
      DataGridVirtualizingCollectionView collectionView = this.GetCollectionView() as DataGridVirtualizingCollectionView;

      Debug.Assert( collectionView != null );

      List<GroupNameCountPair> subGroupInfos = collectionView.OnQueryGroups( this );
      int subGroupCount = subGroupInfos.Count;

      // Create the collection of sub CollectionViewGroups
      ObservableCollection<object> subCollectionViewGroupList = new ObservableCollection<object>();

      int runningCount = this.StartGlobalIndex;
      for( int i = 0; i < subGroupCount; i++ )
      {
        object subGroupName = subGroupInfos[ i ].Name;
        int subGroupItemCount = subGroupInfos[ i ].ItemCount;

        subCollectionViewGroupList.Add(
          new DataGridVirtualizingCollectionViewGroup( subGroupName, subGroupItemCount, runningCount, this, nextLevel, nextLevelIsBottom ) );

        runningCount += subGroupItemCount;
      }

      return subCollectionViewGroupList;
    }
示例#21
0
        public ObservableCollection<FalseAlarmPolicyOR> selectAllDate()
        {
            string sql = @"select fp.*,t.StationName,d.DeviceName,c.ChannelName  from t_FalseAlarmPolicy fp
            inner join t_AlarmPolicyManagement am on fp.PolicyID= am.AlarmPolicyManagementID
            inner join t_Station t  on am.StationID=t.StationID
            inner join t_Device d on am.DeviceID=d.DeviceID
            inner join t_Channel c on am.DeviceChannelID=c.ChannelNo and c.DeviceID=d.DeviceID
            ";

            DataTable dt = null;
            try
            {
                dt = db.ExecuteQuery(sql);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            ObservableCollection<FalseAlarmPolicyOR> _List = new ObservableCollection<FalseAlarmPolicyOR>();
            foreach (DataRow dr in dt.Rows)
            {
                FalseAlarmPolicyOR obj = new FalseAlarmPolicyOR(dr);
                _List.Add(obj);
            }
            return _List;
        }
示例#22
0
		public void InitializeAvailableDevice()
		{
			var availableDevices = new HashSet<GKDevice>();
			foreach (var device in GKManager.Devices)
			{
				if (device.Driver.HasZone && device.ZoneUIDs.Count == 0)
				{
					if ((device.IsInMPT && !GlobalSettingsHelper.GlobalSettings.ShowMPTsDevicesForZone) ||
						(device.GuardZones.Count > 0 && !GlobalSettingsHelper.GlobalSettings.ShowGuardZonesDevices) ||
						(device.Door != null && !GlobalSettingsHelper.GlobalSettings.ShowDoorsDevicesForZone))
						continue;

					availableDevices.Add(device);
				}
			}

			AvailableDevices = new ObservableCollection<ZoneDeviceViewModel>();
			foreach (var device in availableDevices)
			{
				var deviceViewModel = new ZoneDeviceViewModel(device)
				{
					IsBold = device.Driver.HasZone
				};

				AvailableDevices.Add(deviceViewModel);
			}

			OnPropertyChanged(() => AvailableDevices);
			SelectedAvailableDevice = AvailableDevices.FirstOrDefault();
		}
        public MinifyView()
        {
            InitializeComponent();

            Variables = new ObservableCollection<CheckedListItem<Variables>>();
            Funciones = new ObservableCollection<CheckedListItem<Funciones>>();
            ArchivosPHP = new ObservableCollection<CheckedListItem<ArchivosPHP>>();

            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$this" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$GLOBALS" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_SERVER" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_GET" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_POST" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_FILES" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_REQUEST" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_SESSION" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_ENV" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$_COOKIE" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$php_errormsg" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$HTTP_RAW_POST_DATA" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$http_response_header" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$argc" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$argv" }, true));
            Variables.Add(new CheckedListItem<Variables>(new Variables() { Name = "$num_rows" }, true));

            Funciones.Add(new CheckedListItem<Funciones>(new Funciones() { Name = "__construct" }, true));


            DataContext = this;
        }
示例#24
0
		public void Initialize(GKZone zone)
		{
			Zone = zone;
			var devices = new HashSet<GKDevice>();

			foreach (var device in GKManager.Devices)
			{
				if (device.Driver.HasZone)
				{
					if (device.ZoneUIDs.Contains(Zone.UID) && device.ZoneUIDs.Count != 0)
					{
						devices.Add(device);
					}
				}
			}

			Devices = new ObservableCollection<ZoneDeviceViewModel>();
			foreach (var device in devices)
			{
				var deviceViewModel = new ZoneDeviceViewModel(device)
				{
					IsBold = device.ZoneUIDs.Contains(Zone.UID)
				};
				Devices.Add(deviceViewModel);
			}

			OnPropertyChanged(() => Devices);
			SelectedDevice = Devices.FirstOrDefault();

		}
		public ZonesSelectationViewModel(List<XZone> zones, bool canCreateNew = false)
		{
			Title = "Выбор зон";
			AddCommand = new RelayCommand<object>(OnAdd, CanAdd);
			RemoveCommand = new RelayCommand<object>(OnRemove, CanRemove);
			AddAllCommand = new RelayCommand(OnAddAll, CanAddAll);
			RemoveAllCommand = new RelayCommand(OnRemoveAll, CanRemoveAll);
			CreateNewCommand = new RelayCommand(OnCreateNew);

			Zones = zones;
			CanCreateNew = canCreateNew;
			TargetZones = new ObservableCollection<XZone>();
			SourceZones = new ObservableCollection<XZone>();

			foreach (var zone in XManager.DeviceConfiguration.SortedZones)
			{
				if (Zones.Contains(zone))
					TargetZones.Add(zone);
				else
					SourceZones.Add(zone);
			}

			SelectedTargetZone = TargetZones.FirstOrDefault();
			SelectedSourceZone = SourceZones.FirstOrDefault();
		}
        /// <summary>
        /// Constructs a new GeomagicTouch View Model
        /// </summary>
        public GeomagicTouchViewModel()
        {
            DeviceNames = new ObservableCollection<string>();
            SignalSources = new ObservableDictionary<string, SignalSourceViewModel>();

            SignalSources.Add("X", new SignalSourceViewModel("X Position"));
            SignalSources.Add("Y", new SignalSourceViewModel("Y Position"));
            SignalSources.Add("Z", new SignalSourceViewModel("Z Position"));
            SignalSources.Add("Theta1", new SignalSourceViewModel("Gimbal Theta 1"));
            SignalSources.Add("Theta2", new SignalSourceViewModel("Gimbal Theta 2"));
            SignalSources.Add("Theta3", new SignalSourceViewModel("Gimbal Theta 3"));
            SignalSources.Add("Inkwell", new SignalSourceViewModel("Inkwell Switch"));
            SignalSources.Add("Button1", new SignalSourceViewModel("Button 1"));
            SignalSources.Add("Button2", new SignalSourceViewModel("Button 2"));
            SignalSources.Add("Button3", new SignalSourceViewModel("Button 1"));
            SignalSources.Add("Button4", new SignalSourceViewModel("Button 2"));

            TypeName = "Geomagic Touch";

            // Get a list of all GeomagicTouch device names
            foreach(string device in GetGeomagicDevices())
            {
                DeviceNames.Add(device);
            }

            UpdateTimer = new System.Timers.Timer();
            UpdateTimer.Elapsed += UpdateTimer_Elapsed;
            UpdateTimer.Interval = 50;
        }
示例#27
0
        //public static int Insert(string dbFile, string sql,)
        public static ObservableCollection<Jewelry> GetAll()
        {
            ObservableCollection<Jewelry> ob = new ObservableCollection<Jewelry>();

            using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=c:/xhz/ms.db;"))
            //using (SQLiteConnection conn = new SQLiteConnection(@"Data Source=DB/ms.db;"))
            {
                conn.Open();

                string sql = string.Format("select * from detail");

                SQLiteCommand cmd = new SQLiteCommand(sql, conn);

                using (SQLiteDataReader dr1 = cmd.ExecuteReader())
                {
                    while (dr1.Read())
                    {
                        var d = dr1;
                        var dd = dr1.GetValue(0);
                        var data = dr1.GetValue(1);
                        var insert = dr1.GetValue(2);
                        var update = dr1.GetValue(3);
                    }
                }

                conn.Close();
            }

            ob.Add(new Jewelry());

            return ob;
        }
        public ColorGeneratorViewModel()
        {
            m_colors = new ObservableCollection<RybColor>();

            m_generateColorsCommand = new RelayCommand(parameter =>
                {
                    string text = CountText;
                    if (text == null)
                        return;

                    int count;
                    if (int.TryParse(text, out count))
                    {
                        var colorsGenerator = new ColorGenerator(count);
                        m_colors.Clear();

                        for (int i = 0; i < count; i++)
                        {
                            var color = colorsGenerator.PickNextColor();
                            m_colors.Add(color);
                        }
                    }
                });

            CountText = "15";
        }
示例#29
0
 public MainViewModel()
 {
     XML xml = new XML();
     player = xml.Player;
     players.Add(player);
     highScores = new ObservableCollection<Model.HighScores>();
     highScores.Add(xml.HighScores);
     highScores[0].players = players;
     mc = new MovementController(players, highScores);
     mc.Win += mc_Win;
     NewHighScoreCommand = new RelayCommand(NewHighScore);
     KeyDownCommand = new RelayCommand<KeyEventArgs>(KeyDown);
     KeyUpCommand = new RelayCommand<KeyEventArgs>(KeyUp);
     NewGameCommand = new RelayCommand(NewGame);
     ContinueCommand = new RelayCommand(Continue);
     HighScoreCommand = new RelayCommand(HighScore);
     ExitCommand = new RelayCommand(Exit);
     SaveHighScoreCommand = new RelayCommand<String>(SaveHighScore);
     MainMenuCommand = new RelayCommand(MainMenuC);
     SavePlayerCommand = new RelayCommand(SavePlayer);
     NewPlayerCommandLVL1 = new RelayCommand(NewPlayerLVL1);
     NewPlayerCommandLVL2 = new RelayCommand(NewPlayerLVL2);
     DeathCommand = new RelayCommand(Death);
     WinCommand = new RelayCommand(Win);
     LevelSelectCommand = new RelayCommand(LevelSelectC);
 }
		public void ShowCards(IEnumerable<DominionBase.Cards.Card> cards, DominionBase.Piles.Visibility visibility)
		{
			int index = 0;
			Cards = new ObservableCollection<CardViewModel>();
			foreach (DominionBase.Cards.Card card in cards)
				Cards.Add(new CardViewModel { CardName = card.Name, ICard = card, Visibility = visibility, OriginalIndex = index++ });
		}