Пример #1
0
        private static void UpdateCountriesWithPlace(IDictionary <string, Country> countries, Status status)
        {
            string placeName = status.Place.FullName;

            string countryName = status.Place.Country;

            if (!countries.ContainsKey(countryName))
            {
                countries[countryName] = new Country(countryName);
            }
            if (!countries[countryName].Places.ContainsKey(placeName))
            {
                Model.Place toAdd = new Model.Place()
                {
                    Name = placeName, Type = status.Place.PlaceType, Country = countryName
                };
                countries[countryName].Places[placeName] = toAdd;
            }
            countries[countryName].Places[placeName].Sources.Add(status.URL);
            foreach (Hashtag tag in status.Entities.Hashtags)
            {
                if (!countries[countryName].Places[placeName].Hashtags.Contains(tag.Text))
                {
                    countries[countryName].Places[placeName].Hashtags.Add(tag.Text);
                }
            }
        }
Пример #2
0
        public TurnPanel(Model.Place party, Model.Place location)
        {
            foreach (var c in party.characters)
            {
                turns.Add(new Turn(c));
            }
            foreach (var c in location.characters)
            {
                turns.Add(new Turn(c));
            }
            turns.Sort();

            var next_turn = new FlatButton {
                Content = "Next turn"
            };

            Children.Add(new Label {
                Content = "Turns", FontSize = 16
            });
            Children.Add(next_turn);

            Update();

            next_turn.Click += (s, e) =>
            {
                var time = turns[0].value;
                foreach (var item in turns)
                {
                    item.value = item.value - time;
                }
                turns[0].Next();
                turns.Sort();
                Update();
            };
        }
Пример #3
0
        public CharacterPanel(Model.Place p, Dock tab_dock) : base(p.characters, tab_dock)
        {
            place = p;

            NewEntryText            = "New character";
            NoEntryText             = "No character selected";
            NoEntryWidth            = 190;
            ((Label)Header).Content = place.name;
        }
Пример #4
0
 //Saves a place
 private void savePlace()
 {
     try
     {
         Model.Place mPlace = new Model.Place();
         mPlace.id        = Convert.ToInt32(txtPlaceId.Text);
         mPlace.name      = txtPlaceName.Text;
         mPlace.idCountry = (int)cmbPlaceByPCountry.SelectedValue;
         Controller.Place cPlaces = new Controller.Place(mPlace);
         cPlaces.insert();
         refreshPlace();
     }
     catch
     {
     }
 }
Пример #5
0
 //does an action of the country tab
 private void doPlace()
 {
     Model.Place      mPlace = new Model.Place();
     Controller.Place cPlace = new Controller.Place();
     if (cmbCountryAction.SelectedIndex == 0)
     {
         MessageBox.Show("Please, choose an action!");
         cmbPlace.Enabled = false;
     }
     else if (cmbPlacesActions.SelectedIndex == 1) //select
     {
         refreshCountry();
         cmbPlace.Enabled = false;
         refreshPlace();
     }
     else if (cmbPlacesActions.SelectedIndex == 2) //delete
     {
         cmbPlace.Enabled = true;
         mPlace.id        = Convert.ToInt32(cmbPlace.SelectedValue.ToString());
         cPlace           = new Controller.Place(mPlace);
         cPlace.delete();
         refreshPlace();
     }
     else if (cmbPlacesActions.SelectedIndex == 3)
     {
         cmbPlace.Enabled       = true;
         gbNewCountry.Visible   = true;
         gbPlaceActions.Visible = true;
         txtPlaceId.Text        = cmbPlace.SelectedValue.ToString();
     }
     else if (cmbPlacesActions.SelectedIndex == 4)
     {
         cmbPlace.Enabled       = false;
         gbPlaceActions.Visible = true;
         txtPlaceId.Text        = "0";
     }
 }
Пример #6
0
 public Place(Model.Place places)
 {
     this.places = places;
 }
Пример #7
0
 public Place()
 {
     this.places = new Model.Place();
 }
Пример #8
0
 public PlaceView(Model.Place place = null)
 {
     InitializeComponent();
     this.BindingContext = new PlaceViewModel(place);
 }