Exemplo n.º 1
0
        private void DisconnectFromSpotify_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _winleafsServerClient.SpotifyEndpoint.Disconnect();
                PopupCreator.Success(Options.Resources.DisconnectSuccessful, true);

                DisconnectFromSpotifyButton.Visibility = Visibility.Hidden;
                ConnectToSpotifyButton.Visibility      = Visibility.Visible;
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unknown error when trying to connect to Spotify");
                PopupCreator.Error(Options.Resources.SpotifyUnknownError);
            }
        }
Exemplo n.º 2
0
        private void GeoIp_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var geoIpClient = new GeoIpClient();
                var geoIpData   = geoIpClient.GetGeoIpData();
                OptionsViewModel.Latitude  = geoIpData.Latitude.ToString("N7", CultureInfo.InvariantCulture);
                OptionsViewModel.Longitude = geoIpData.Longitude.ToString("N7", CultureInfo.InvariantCulture);

                LatitudeTextBox.Text  = OptionsViewModel.Latitude;
                LongitudeTextBox.Text = OptionsViewModel.Longitude;

                PopupCreator.Success(string.Format(Options.Resources.LocationDetected, geoIpData.City, geoIpData.Country));
            }
            catch
            {
                PopupCreator.Error(Options.Resources.LatLongReceiveError);
            }
        }