Beispiel #1
0
 private void FixupHarborLocationTag()
 {
     foreach (ToggleMenuFlyoutItem item in _menuHarborLocation.Items)
     {
         if (item.Tag.GetType() == typeof(string))
         {
             HarborLocation location = (HarborLocation)Enum.Parse(typeof(HarborLocation), (string)item.Tag);
             item.Tag = location;
         }
     }
 }
Beispiel #2
0
        public void OnHarborRightTapped(TileCtrl tile, HarborLocation location, RightTappedRoutedEventArgs e)
        {
            if (!_designModeSet)
            {
                return;
            }

            if (tile != _selectedTile)
            {
                SelectTile(tile);
            }

            _clickedHarberLocation = location;
            _menuHarbor.ShowAt(tile, e.GetPosition(tile));
        }
Beispiel #3
0
        private void HarborLocation_Checked(object sender, RoutedEventArgs e)
        {
            CheckBox cb = sender as CheckBox;

            if (_stopCheckBoxRecursion)
            {
                return;
            }
            try
            {
                _stopCheckBoxRecursion = true;

                HarborLocation location = (HarborLocation)cb.Tag;

                if (location == HarborLocation.None)
                {
                    for (int i = 1; i < _checkBoxList.Count; i++) // skip the first one
                    {
                        _checkBoxList[i].IsChecked = false;
                    }
                }
                else
                {
                    _checkBoxList[0].IsChecked = false;
                }



                if (_selectedTile != null)
                {
                    if ((bool)cb.IsChecked)
                    {
                        _selectedTile.AddHarborLocation(location);
                    }
                    else
                    {
                        _selectedTile.RemoveHarborLocation(location);
                    }

                    HarborLocationsAsText = _selectedTile.HarborLocationsAsShortText;
                }
            }
            finally
            {
                _stopCheckBoxRecursion = false;
            }
        }
Beispiel #4
0
        private void Menu_OnHarborLocationClicked(object sender, RoutedEventArgs e)
        {
            ToggleMenuFlyoutItem item     = sender as ToggleMenuFlyoutItem;
            HarborLocation       location = (HarborLocation)item.Tag;

            if (item.IsChecked)
            {
                _selectedTile.AddHarborLocation(location);
                _selectedTile.Harbor?.SetOrientationAsync(TileOrientation.FaceUp);
            }
            else
            {
                _selectedTile.RemoveHarborLocation(location);
            }

            //
            //  the UI will only remember the last one we selected...for now
            SetValue(CurrentHarborLocationProperty, location);

            //  ForceHexPanelUpdate();
        }