private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (About.Aboutnavigation == true)
            {
                About.Aboutnavigation = false; return;
            }

            else
            {
                if (Favorites["LoadFavorites"].ToString() == "true")
                {
                    TryLoadFavorites(); this.FavoritesSwitch.IsChecked = true;
                }
                else if (FavoritesListEnabled == true)
                {
                    LoadFavorites();
                }
                else
                {
                    CityList.ItemsSource = GetCity.GetAllCitiesData(); this.FavoritesSwitch.IsChecked = false;
                }
            }
        }
        public void TryLoadFavorites()
        {
            List <string> Favorites = new List <string>();

            Favorites = DbEngine.GetFavoriteAirports();

            if (Favorites.Count == 0)
            {
                MessageBox.Show("Δεν βρέθηκε καταχώρηση στα αγαπημένα...");
                this.CityList.ItemsSource = GetCity.GetAllCitiesData();
                FavoritesListEnabled      = false;
            }

            else
            {
                this.CityList.ItemsSource    = GetCity.GetFavoriteCities(Favorites);
                this.CanvasOption.Visibility = Visibility.Collapsed;
                FavoritesListEnabled         = true;
                this.MainLabel.Text          = "Αγαπημένα";
            }

            this.CityList.Visibility = Visibility.Visible;
        }
        private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (FavoritesListEnabled == true)
            {
                e.Cancel = true; CityList.ItemsSource = GetCity.GetAllCitiesData(); FavoritesListEnabled = false; MainLabel.Text = "Airport Weather Pro"; return;
            }

            if (CanvasOption.Visibility == Visibility.Visible)
            {
                e.Cancel = true;
                CanvasOption.Visibility = Visibility.Collapsed; CityList.Visibility = Visibility.Visible;
                MainLabel.Text          = "Airport Weather Pro";
            }

            else
            {
                MessageBoxResult result = MessageBox.Show("Έξοδος ?", "Επιβεβαίωση", MessageBoxButton.OKCancel);
                if (result != MessageBoxResult.OK)
                {
                    e.Cancel = true;
                }
            }
        }
        private void AddRemoveFavoriteButton_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            City     itemViewModel = new City();
            DbEngine EngineWorker  = new DbEngine();

            itemViewModel = CityList.SelectedItem as City;
            string Code = itemViewModel.AirportCode;

            CityList.SelectedItem = null;

            if (EngineWorker.AddAirportToFavorites(Code) == true)
            {
                MessageBox.Show("Το Αεροδρόμιο " + itemViewModel.AirportName + " Προστέθηκε στα Αγαπημένα !"); this.CityList.ItemsSource = GetCity.GetAllCitiesData();
                return;
            }

            else
            {
                MessageBox.Show("Το Aεροδρόμιο " + itemViewModel.AirportName + "Αφαιρέθηκε απο τα Αγαπημένα");
                DbEngine.GetFavoriteAirports();
                List <string> Favorites = new List <string>();
                Favorites = DbEngine.GetFavoriteAirports();
                this.CityList.ItemsSource = null;
                this.CityList.ItemsSource = GetCity.GetFavoriteCities(Favorites);
                if (this.CityList.Items.Count == 0)
                {
                    MessageBox.Show("Δεν βρέθηκε καταχώρηση στα αγαπημένα. Επιστροφή..."); CityList.ItemsSource = GetCity.GetAllCitiesData();
                }
                return;
            }
        }