Example #1
0
		public static UIColor ColorFrom(ListColor colorType)
		{
			switch (colorType) {
				case ListColor.Gray:
					return GrayColor;

				case ListColor.Blue:
					return BlueColor;

				case ListColor.Green:
					return BreenColor;

				case ListColor.Yellow:
					return YellowColor;

				case ListColor.Orange:
					return OrangeColor;

				case ListColor.Red:
					return RedColor;

				default:
					throw new NotImplementedException ();
			}
		}
Example #2
0
        public static UIColor ColorFrom(ListColor colorType)
        {
            switch (colorType)
            {
            case ListColor.Gray:
                return(GrayColor);

            case ListColor.Blue:
                return(BlueColor);

            case ListColor.Green:
                return(BreenColor);

            case ListColor.Yellow:
                return(YellowColor);

            case ListColor.Orange:
                return(OrangeColor);

            case ListColor.Red:
                return(RedColor);

            default:
                throw new NotImplementedException();
            }
        }
Example #3
0
 private void BackwardColorAction()
 {
     if (SelectedColor == ListColor.First().Value)
     {
         SelectedColor = ListColor.Last().Value;
     }
     else
     {
         SelectedColor = ListColor.ElementAt(ListColor.IndexOf(ListColor.First(x => x.Value == SelectedColor)) - 1).Value;
     }
 }
Example #4
0
        public void OnListColorCellDidChangeSelectedColor(ListColor color)
        {
            List.Color = color;

            TextAttributes = new UIStringAttributes {
                Font            = UIFont.PreferredHeadline,
                ForegroundColor = AppColors.ColorFrom(List.Color)
            };

            NSIndexPath[] indexPaths = TableView.IndexPathsForVisibleRows;
            TableView.ReloadRows(indexPaths, UITableViewRowAnimation.None);
        }
		void ColorTap(UITapGestureRecognizer tapGestureRecognizer)
		{
			if (tapGestureRecognizer.State != UIGestureRecognizerState.Ended)
				return;

			CGPoint tapLocation = tapGestureRecognizer.LocationInView (ContentView);
			UIView view = ContentView.HitTest (tapLocation, null);

			// If the user tapped on a color (identified by its tag), notify the delegate.
			ListColor color = (ListColor)(int)view.Tag;
			SelectedColor = color;
			ViewController.OnListColorCellDidChangeSelectedColor (SelectedColor);
		}
Example #6
0
        void ConfigureListItemCell(CheckBoxCell itemCell, ListColor color, ListItem item)
        {
            itemCell.CheckBox.TintColor = AppColors.ColorFrom(color);
            itemCell.CheckBox.Checked   = item.IsComplete;
            itemCell.Label.Text         = item.Text;

            itemCell.Label.TextColor = UIColor.White;

            // Configure a completed list item cell.
            if (item.IsComplete)
            {
                itemCell.Label.TextColor = UIColor.LightGray;
            }
        }
        public void UpdateDocumentColor(NSUrl documentUrl, ListColor newColor)
        {
            ListInfo listInfo = new ListInfo(documentUrl);

            int index = listInfos.IndexOf(listInfo);

            if (index != -1)
            {
                listInfo       = listInfos[index];
                listInfo.Color = newColor;

                NSIndexPath indexPath = NSIndexPath.FromRowSection(index, 0);
                ListCell    cell      = (ListCell)TableView.CellAt(indexPath);
                cell.ListColorView.BackgroundColor = AppColors.ColorFrom(newColor);
            }
        }
Example #8
0
        void ColorTap(UITapGestureRecognizer tapGestureRecognizer)
        {
            if (tapGestureRecognizer.State != UIGestureRecognizerState.Ended)
            {
                return;
            }

            CGPoint tapLocation = tapGestureRecognizer.LocationInView(ContentView);
            UIView  view        = ContentView.HitTest(tapLocation, null);

            // If the user tapped on a color (identified by its tag), notify the delegate.
            ListColor color = (ListColor)(int)view.Tag;

            SelectedColor = color;
            ViewController.OnListColorCellDidChangeSelectedColor(SelectedColor);
        }
        public void PickColor(UIButton sender)
        {
            // Use the button's tag to determine the color.
            selectedColor = (ListColor)(int)sender.Tag;

            // Clear out the previously selected button's border.
            if (selectedButton != null)
            {
                selectedButton.Layer.BorderWidth = 0;
            }

            sender.Layer.BorderWidth = 5f;
            sender.Layer.BorderColor = UIColor.LightGray.CGColor;
            selectedButton           = sender;

            TitleLabel.TextColor = AppColors.ColorFrom(selectedColor);
            Toolbar.TintColor    = AppColors.ColorFrom(selectedColor);
        }
Example #10
0
        private async Task JoinRoomActionAsync()
        {
            using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Chargement"))
            {
                Room room = await App.DatabaseUtil.GetRoom(RoomId);

                if (room == null)
                {
                    MaterialDialog.Instance.SnackbarAsync("Aucune partie trouvée, veuillez réessayer", MaterialSnackbar.DurationLong);
                }
                if (room.Players == null)
                {
                    room.Players = new List <Player>();
                }
                if (room.Players.Where(a => a.Name == PlayerName).FirstOrDefault() != null)
                {
                    MaterialDialog.Instance.SnackbarAsync("Un joueur ou une équipe a déjà ce nom, veuillez réessayer", MaterialSnackbar.DurationLong);
                }
                else
                {
                    App.CurrentRoom   = RoomId;
                    App.CurrentPlayer = PlayerName;
                    App.IsAdmin       = false;

                    room.Players.Add(new Player()
                    {
                        Name = PlayerName, StringColor = ListColor.First(x => x.Value == SelectedColor).Name
                    });
                    await App.DatabaseUtil.EditRoom(room);

                    ListPlayersPageViewModel listPlayersPageVM = new ListPlayersPageViewModel();
                    await listPlayersPageVM.Init();

                    await App.Current.MainPage.Navigation.PushAsync(new ListPlayersPage(listPlayersPageVM), true);
                }
            }
        }
		void ConfigureListItemCell(CheckBoxCell itemCell, ListColor color, ListItem item)
		{
			itemCell.CheckBox.TintColor = AppColors.ColorFrom(color);
			itemCell.CheckBox.Checked = item.IsComplete;
			itemCell.Label.Text = item.Text;

			itemCell.Label.TextColor = UIColor.White;

			// Configure a completed list item cell.
			if (item.IsComplete)
				itemCell.Label.TextColor = UIColor.LightGray;
		}
Example #12
0
 public BWList(ListColor color)
 {
     _color = color;
 }
Example #13
0
		public List(IEnumerable<ListItem> items, ListColor color)
			: this()
		{
			this.items.AddRange (items);
			Color = color;
		}
Example #14
0
 public List(IEnumerable <ListItem> items, ListColor color)
     : this()
 {
     this.items.AddRange(items);
     Color = color;
 }
Example #15
0
        public Game RefreshUiComponents(Game _game)
        {
            string _borderColorWin    = "Lime";
            string _borderColorNormal = "Black";

            //highlight winning combination
            if (ModelGame.IsGameWon == true)
            {
                for (int i = 0; i < 4; i++)
                {
                    int c = ModelGame.WinningArrayCoordinates[i, 0];
                    int r = ModelGame.WinningArrayCoordinates[i, 1];
                    GameArrayBorderColor[c, r] = _borderColorWin;
                }
            }
            else
            {
                for (int c = 0; c < 8; c++)
                {
                    for (int r = 0; r < 7; r++)
                    {
                        GameArrayBorderColor[c, r] = _borderColorNormal;
                    }
                }
            }

            //translate moves to color
            for (int c = 0; c < 8; c++)
            {
                for (int r = 0; r < 7; r++)
                {
                    if (ModelGame.GameArrayPosition[c, r] == "Human")
                    {
                        GameArrayColor[c, r] = "LightSkyBlue";
                    }
                    else if (ModelGame.GameArrayPosition[c, r] == "Ai")
                    {
                        GameArrayColor[c, r] = "Black";
                    }
                    else
                    {
                        GameArrayColor[c, r] = "Transparent";
                    }
                }
            }

            //Color List Build
            ListColor.Clear();
            for (int c = 0; c < 8; c++)
            {
                for (int r = 0; r < 7; r++)
                {
                    ListColor.Add(GameArrayColor[c, r]);
                }
            }

            //Color Border List Build
            ListBorderColor.Clear();
            for (int c = 0; c < 8; c++)
            {
                for (int r = 0; r < 7; r++)
                {
                    ListBorderColor.Add(GameArrayBorderColor[c, r]);
                }
            }

            NotifyPropertyChanged("ListColor");
            NotifyPropertyChanged("ListBorderColor");
            return(_game);
        }
		public void OnListColorCellDidChangeSelectedColor (ListColor color)
		{
			List.Color = color;

			TextAttributes = new UIStringAttributes {
				Font = UIFont.PreferredHeadline,
				ForegroundColor = AppColors.ColorFrom (List.Color)
			};

			NSIndexPath[] indexPaths = TableView.IndexPathsForVisibleRows;
			TableView.ReloadRows (indexPaths, UITableViewRowAnimation.None);
		}
		public void PickColor(UIButton sender)
		{
			// Use the button's tag to determine the color.
			selectedColor = (ListColor)(int)sender.Tag;

			// Clear out the previously selected button's border.
			if(selectedButton != null)
				selectedButton.Layer.BorderWidth = 0;

			sender.Layer.BorderWidth = 5f;
			sender.Layer.BorderColor = UIColor.LightGray.CGColor;
			selectedButton = sender;

			TitleLabel.TextColor = AppColors.ColorFrom(selectedColor);
			Toolbar.TintColor = AppColors.ColorFrom(selectedColor);
		}
		public void UpdateDocumentColor(NSUrl documentUrl, ListColor newColor)
		{
			ListInfo listInfo = new ListInfo (documentUrl);

			int index = listInfos.IndexOf(listInfo);
			if (index != -1) {
				listInfo = listInfos[index];
				listInfo.Color = newColor;

				NSIndexPath indexPath = NSIndexPath.FromRowSection (index, 0);
				ListCell cell = (ListCell)TableView.CellAt (indexPath);
				cell.ListColorView.BackgroundColor = AppColors.ColorFrom (newColor);
			}
		}