void watcher_StatusChanged(object sender, GeoPositionStatusChangedEventArgs e) { switch (e.Status) { case GeoPositionStatus.NoData: { if (locset_tel != 2) { MessageBox.Show("We cant find your location."); IsolatedSettingsHelper.SetValue <int>("locsetting_tel", 2); } break; } case GeoPositionStatus.Disabled: { if (locset_tel != 2) { MessageBox.Show("Your location settings which is on phone settings is closed, please activate it and try again."); IsolatedSettingsHelper.SetValue <int>("locsetting_tel", 2); } break; } case GeoPositionStatus.Ready: { if (locset_tel != 1) { IsolatedSettingsHelper.SetValue <int>("locsetting_tel", 1); } break; } } }
private void webBrowser1_Loaded(object sender, RoutedEventArgs e) { var loginUrl = GetFacebookLoginUrl(AppId, ExtendedPermissions); webBrowser1.Navigate(loginUrl); IsolatedSettingsHelper.SetValue <string>("loginUri", loginUrl.ToString()); }
public void NotifyAlertControl() { if (IsolatedSettingsHelper.GetValue <bool>("sharedonfacebook")) { buyNowScreen1 = new Popup(); buyNowScreen1.Child = new NotifyAlert ("Successfully shared on Facebook"); buyNowScreen1.IsOpen = true; buyNowScreen1.VerticalOffset = 0; buyNowScreen1.HorizontalOffset = 0; } if (IsolatedSettingsHelper.GetValue <bool>("sharedontwitter")) { Dispatcher.BeginInvoke(() => { buyNowScreen = new Popup(); buyNowScreen.Child = new NotifyAlert ("Successfully shared on Twitter"); buyNowScreen.IsOpen = true; buyNowScreen.VerticalOffset = 0; buyNowScreen.HorizontalOffset = 0; }); } }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { string latest_updatex = IsolatedSettingsHelper.GetValue <string>("latest_update"); string latest_update_channelx = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); string latest_update_timex = IsolatedSettingsHelper.GetValue <string>("latest_update_time"); Helper helper = new Helper(); if (latest_updatex != null) { if (latest_updatex.Count() > 0) { latest_update.Text = latest_updatex + "\n" + latest_update_channelx.Remove(0, 1); } } if (latest_update_timex == "" || latest_update_timex == null) { //do nothing. } else { DateTime date = Convert.ToDateTime(latest_update_timex); latest_update_time.Text = helper.CalculateShareTime(date) + " ago."; } }
public MainPivot() { InitializeComponent(); pivot1.SelectionChanged += pivot1_SelectionChanged; locset_tel = IsolatedSettingsHelper.GetValue <int>("locsetting_tel"); if (watcher == null) { watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High) { MovementThreshold = 10 }; watcher.Start(); watcher.StatusChanged += watcher_StatusChanged; } if (locset_tel == 1) //app konum ayarı ve tel konum ayarı kapalı ise konumu bulma. { if (watcher != null) { watcher.PositionChanged += new EventHandler <GeoPositionChangedEventArgs <GeoCoordinate> >(watcher_PositionChanged); } } this.Loaded += MainPivot_Loaded; }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { int locsettx = IsolatedSettingsHelper.GetValue <int>("locsetting_tel"); if (locsettx == 0) { IsolatedSettingsHelper.SetValue <int>("locsetting_tel", 1); } }
void PostAPhoto_Loaded(object sender, RoutedEventArgs e) { ffid = IsolatedSettingsHelper.GetValue <string>("fid_sharetoall"); fftoken = IsolatedSettingsHelper.GetValue <string>("ftoken_sharetoall"); tokenx = IsolatedSettingsHelper.GetValue <string>("ttoken"); tokensecx = IsolatedSettingsHelper.GetValue <string>("ttokensec"); photoChooserTask.Show(); }
void CallBackVerifiedResponse(OAuthAccessToken at, TwitterResponse response) { if (at != null) { IsolatedSettingsHelper.SetValue <string>("ttoken", at.Token); IsolatedSettingsHelper.SetValue <string>("ttokensec", at.TokenSecret); try { Dispatcher.BeginInvoke(() => { ////////////////////////// OAuthCredentials credentials = new OAuthCredentials(); credentials.Type = OAuthType.ProtectedResource; credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1; credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader; credentials.ConsumerKey = TwitterSettings.ConsumerKey; credentials.ConsumerSecret = TwitterSettings.ConsumerKeySecret; credentials.Token = at.Token; credentials.TokenSecret = at.TokenSecret; credentials.Version = "1.1"; //credentials.ClientUsername = ""; credentials.CallbackUrl = "none"; var service = new TwitterService(TwitterSettings.ConsumerKey, TwitterSettings.ConsumerKeySecret); service.AuthenticateWith(at.Token, at.TokenSecret); SendTweetOptions st = new SendTweetOptions(); st.Status = "post"; service.SendTweet(new SendTweetOptions { Status = post }, CallBackVerifiedResponse1); /////////////////////////////// }); } catch { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("An error occurred,please try again."); return; }); } } else { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("Wrong pin please try again", "Error", MessageBoxButton.OK); GetTwitterToken(); }); } }
private void twitter_tg_Unchecked(object sender, RoutedEventArgs e) { if (tokenx == " " && tokensecx == " " || tokenx == null && tokensecx == null) { IsolatedSettingsHelper.SetValue <string>("ttoken", null); IsolatedSettingsHelper.SetValue <string>("ttokensec", null); MessageBox.Show("You have log outted from your twitter account.", "Log out", MessageBoxButton.OK); } }
void PostAnUpdate_Loaded(object sender, RoutedEventArgs e) { ffid = IsolatedSettingsHelper.GetValue <string>("fid_sharetoall"); fftoken = IsolatedSettingsHelper.GetValue <string>("ftoken_sharetoall"); tokenx = IsolatedSettingsHelper.GetValue <string>("ttoken"); tokensecx = IsolatedSettingsHelper.GetValue <string>("ttokensec"); update_text.Focus(); }
void CallBackVerifiedResponse1(TwitterStatus at, TwitterResponse response) { if (response.Error == null && response.StatusCode.ToString() == "OK") { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { //MessageBox.Show("Successfully shared on Twitter."); progbar.IsIndeterminate = false; progbar.Visibility = Visibility.Collapsed; }); //IsolatedSettingsHelper.SetValue<bool>("sharedontwitter", true); //if (IsolatedSettingsHelper.GetValue<bool>("sharedontwitter")) //{ Dispatcher.BeginInvoke(() => { buyNowScreen = new Popup(); buyNowScreen.Child = new NotifyAlert ("Successfully shared on Twitter"); buyNowScreen.IsOpen = true; buyNowScreen.VerticalOffset = 0; buyNowScreen.HorizontalOffset = 0; }); //} string channel = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); IsolatedSettingsHelper.SetValue <string>("latest_update", twitter_post); IsolatedSettingsHelper.SetValue <string>("latest_update_channel", channel + " Twitter"); IsolatedSettingsHelper.SetValue <string>("latest_update_time", DateTime.Now.ToString()); } else if (response.Error != null) { if (response.Error.Message.Contains("duplicate")) { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("You have already shared it!"); }); } else { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("An error occurred ,please login again."); }); } } //HideProgressIndicator(); }
private void LoginSucceded(string accessToken) { var fb = new FacebookClient(accessToken); fb.GetCompleted += (o, e) => { if (e.Error != null) { Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message)); return; } var result = (IDictionary <string, object>)e.GetResultData(); var id = (string)result["id"]; IsolatedSettingsHelper.SetValue <string>("ftoken_sharetoall", accessToken); IsolatedSettingsHelper.SetValue <string>("fid_sharetoall", id); // string _post = NavigationContext.QueryString["vpost"]; Dispatcher.BeginInvoke(() => { MessageBox.Show("Successfully shared on Facebook"); }); if (_post.Contains('|')) { string[] words = _post.Split('|'); var parameters = new Dictionary <string, object>(); //parameters["message"] = txtMessage.Text; parameters["message"] = words[0]; parameters["link"] = words[1]; //parameters["picture"] = ""; fb.PostAsync("me/feed", parameters); } else { var parameters = new Dictionary <string, object>(); //parameters["message"] = txtMessage.Text; parameters["message"] = _post; // parameters["link"] = words[1]; //parameters["picture"] = ""; fb.PostAsync("me/feed", parameters); } ////////// }; fb.GetAsync("me?fields=id"); }
private void ok_Click(object sender, EventArgs e) { if (update_text.Text.Count() > 0) { progbar.IsIndeterminate = true; progbar.Visibility = Visibility.Visible; IsolatedSettingsHelper.SetValue <string>("latest_update_channel", " "); if (ffid == " " && fftoken == " " || ffid == null && fftoken == null) { //do nothing } else { try { progbar.IsIndeterminate = true; progbar.Visibility = Visibility.Visible; ShareOnFacebook(); } catch { } } if (tokenx == " " && tokensecx == " " || tokenx == null && tokensecx == null) {//do nothing } else { try { progbar.IsIndeterminate = true; progbar.Visibility = Visibility.Visible; ShareOnTwitter(); } catch { } } progbar.IsIndeterminate = false; progbar.Visibility = Visibility.Collapsed; if (NavigationService.CanGoBack) { NavigationService.GoBack(); } } }
public CheckIn() { InitializeComponent(); latitudex = IsolatedSettingsHelper.GetValue <string>("latitudex"); longitudex = IsolatedSettingsHelper.GetValue <string>("longitudex"); ffid = IsolatedSettingsHelper.GetValue <string>("fid_sharetoall"); fftoken = IsolatedSettingsHelper.GetValue <string>("ftoken_sharetoall"); tokenx = IsolatedSettingsHelper.GetValue <string>("ttoken"); tokensecx = IsolatedSettingsHelper.GetValue <string>("ttokensec"); progbar.IsIndeterminate = true; progbar.Visibility = Visibility.Visible; GetVenues(); this.Loaded += CheckIn_Loaded; }
private void facebook_tg_Unchecked(object sender, RoutedEventArgs e) { if (ffid != " " && fftoken != " " || ffid != null && fftoken != null) { string _loginUrl = IsolatedSettingsHelper.GetValue <string>("loginUri"); string _accessToken = IsolatedSettingsHelper.GetValue <string>("ftoken_sharetoall"); webrowser2.Navigate(new Uri(String.Format("https://www.facebook.com/logout.php?next={0}&access_token={1}", _loginUrl, _accessToken))); this.ClearCookies(FacebookCookieUri); IsolatedSettingsHelper.SetValue <string>("ftoken_sharetoall", null); IsolatedSettingsHelper.SetValue <string>("fid_sharetoall", null); MessageBox.Show("You have log outted from your facebook account.", "Log out", MessageBoxButton.OK); } }
private void NewTweetCompleted(RestRequest request, RestResponse response, object userstate) { // We want to ensure we are running on our thread UI Deployment.Current.Dispatcher.BeginInvoke(() => { if (response.StatusCode == HttpStatusCode.OK) { //MessageBox.Show("Successfully shared on Twitter"); progbar1.IsIndeterminate = false; progbar1.Visibility = Visibility.Collapsed; // IsolatedSettingsHelper.SetValue<bool>("sharedontwitter", true); buyNowScreen1 = new Popup(); buyNowScreen1.Child = new NotifyAlert ("Successfully shared on Twitter"); buyNowScreen1.IsOpen = true; buyNowScreen1.VerticalOffset = 0; buyNowScreen1.HorizontalOffset = 0; string channel = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); IsolatedSettingsHelper.SetValue <string>("latest_update", "You shared a photo"); IsolatedSettingsHelper.SetValue <string>("latest_update_channel", channel + " Twitter"); IsolatedSettingsHelper.SetValue <string>("latest_update_time", DateTime.Now.ToString()); //if (NavigationService.CanGoBack) // NavigationService.GoBack(); } else { if (response.StatusCode == HttpStatusCode.Unauthorized) { MessageBox.Show("Authentication error"); } else { MessageBox.Show("Error, please try again later"); } } }); }
void Degisti(GeoPositionChangedEventArgs <GeoCoordinate> e) { konumum = new GeoCoordinate(e.Position.Location.Latitude, e.Position.Location.Longitude); IsolatedSettingsHelper.SetValue <string>("latitudex", konumum.Latitude.ToString()); IsolatedSettingsHelper.SetValue <string>("longitudex", konumum.Longitude.ToString()); }
public void ShareOnFacebook() { string post = ""; post = ""; if (ffid == " " && fftoken == " " || ffid == null && fftoken == null) { NavigationService.Navigate(new Uri(string.Format("/FacebookLoginPage.xaml?vpost={0}", post), UriKind.Relative)); } else { var fb = new FacebookClient(fftoken); fb.PostCompleted += (o, e) => { if (e.Cancelled || e.Error != null) { Dispatcher.BeginInvoke(() => MessageBox.Show(e.Error.Message)); return; } var result = e.GetResultData(); Dispatcher.BeginInvoke(() => { progbar1.IsIndeterminate = false; progbar1.Visibility = Visibility.Collapsed; // MessageBox.Show("Successfully shared on Facebook"); //if (NavigationService.CanGoBack) // NavigationService.GoBack(); buyNowScreen = new Popup(); buyNowScreen.Child = new NotifyAlert ("Successfully shared on Facebook"); buyNowScreen.IsOpen = true; buyNowScreen.VerticalOffset = 0; buyNowScreen.HorizontalOffset = 0; }); }; //IsolatedSettingsHelper.SetValue<bool>("sharedonfacebook", true); //Dispatcher.BeginInvoke(() => //{ // buyNowScreen = new Popup(); // buyNowScreen.Child = // new NotifyAlert // ("Successfully shared on Facebook"); // buyNowScreen.IsOpen = true; // buyNowScreen.VerticalOffset = 0; // buyNowScreen.HorizontalOffset = 0; //}); var parameters = new Dictionary <string, object>(); parameters["name"] = photo_text.Text; var resized = img.Resize(img.PixelWidth / 2, img.PixelHeight / 2, WriteableBitmapExtensions.Interpolation.Bilinear); var fileStream = new MemoryStream(); resized.SaveJpeg(fileStream, resized.PixelWidth, resized.PixelHeight, 100, 100); fileStream.Seek(0, SeekOrigin.Begin); parameters["TestPic"] = new FacebookMediaObject { ContentType = "image/jpeg", FileName = fileName + ".jpg" }.SetValue(fileStream.ToArray());//.SetValue(photoStream.ToArray()); //fb.PostCompleted += fb_PostCompleted; fb.PostAsync("me/Photos", parameters); string channel = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); IsolatedSettingsHelper.SetValue <string>("latest_update", "You shared a photo"); IsolatedSettingsHelper.SetValue <string>("latest_update_channel", channel + " Facebook"); IsolatedSettingsHelper.SetValue <string>("latest_update_time", DateTime.Now.ToString()); } }
void MainPivot_Loaded(object sender, RoutedEventArgs e) { progbar.IsIndeterminate = true; progbar.Visibility = Visibility.Visible; ffid = IsolatedSettingsHelper.GetValue <string>("fid_sharetoall"); fftoken = IsolatedSettingsHelper.GetValue <string>("ftoken_sharetoall"); tokenx = IsolatedSettingsHelper.GetValue <string>("ttoken"); tokensecx = IsolatedSettingsHelper.GetValue <string>("ttokensec"); locset_tel = IsolatedSettingsHelper.GetValue <int>("locsetting_tel"); if (ffid == " " && fftoken == " " || ffid == null && fftoken == null) { BitmapImage bm = new BitmapImage(new Uri("images/user_icon.png", UriKind.RelativeOrAbsolute)); user_image.Source = bm; facebook_tg.IsChecked = false; } else { try { LoadUserInfo(); } catch { BitmapImage bm = new BitmapImage(new Uri("images/user_icon.png", UriKind.RelativeOrAbsolute)); user_image.Source = bm; } facebook_tg.IsChecked = true; } if (tokenx == " " && tokensecx == " " || tokenx == null && tokensecx == null) { twitter_tg.IsChecked = false; } else { twitter_tg.IsChecked = true; } string latest_updatex = IsolatedSettingsHelper.GetValue <string>("latest_update"); string latest_update_channelx = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); string latest_update_timex = IsolatedSettingsHelper.GetValue <string>("latest_update_time"); Helper helper = new Helper(); if (latest_updatex != null) { if (latest_updatex.Count() > 0) { latest_update.Text = latest_updatex + "\n" + latest_update_channelx.Remove(0, 1); } } if (latest_update_timex == "" || latest_update_timex == null) { //do nothing. } else { DateTime date = Convert.ToDateTime(latest_update_timex); latest_update_time.Text = helper.CalculateShareTime(date) + " ago."; } // get application tile ShellTile tile = ShellTile.ActiveTiles.First(); if (null != tile) { // create a new data for tile StandardTileData data = new StandardTileData(); // to make tile flip add data to background also data.BackContent = latest_updatex; if (latest_update_timex == "" || latest_update_timex == null) { data.BackTitle = ""; } else { DateTime date = Convert.ToDateTime(latest_update_timex); data.BackTitle = helper.CalculateShareTime(date) + " ago."; } // data.BackBackgroundImage = new Uri("/Images/Green.jpg", UriKind.Relative); // update tile tile.Update(data); } progbar.IsIndeterminate = false; progbar.Visibility = Visibility.Collapsed; // NotifyAlertControl(); }
public void ShareOnFacebook() { //ShowProgressIndicator(AppResources.GettingLocationProgressText); string post = ""; post = update_text.Text; if (ffid == " " && fftoken == " " || ffid == null && fftoken == null) { NavigationService.Navigate(new Uri(string.Format("/FacebookLoginPage.xaml?vpost={0}", post), UriKind.Relative)); } else { var fb = new FacebookClient(fftoken); fb.PostCompleted += (o, args) => { if (args.Error != null) { if (args.Error.Message == "(OAuthException - #506) (#506) Duplicate status message") { Dispatcher.BeginInvoke(() => MessageBox.Show("You have already shared it!")); return; } else { Dispatcher.BeginInvoke(() => MessageBox.Show(args.Error.Message)); return; } } var result = (IDictionary <string, object>)args.GetResultData(); _lastMessageId = (string)result["id"]; string channel = IsolatedSettingsHelper.GetValue <string>("latest_update_channel"); IsolatedSettingsHelper.SetValue <string>("latest_update", post); IsolatedSettingsHelper.SetValue <string>("latest_update_channel", channel + " Facebook"); IsolatedSettingsHelper.SetValue <string>("latest_update_time", DateTime.Now.ToString()); //Dispatcher.BeginInvoke(() => //{ // // MessageBox.Show("Successfully shared on Facebook"); //}); Dispatcher.BeginInvoke(() => { buyNowScreen1 = new Popup(); buyNowScreen1.Child = new NotifyAlert ("Successfully shared on Facebook"); buyNowScreen1.IsOpen = true; buyNowScreen1.VerticalOffset = 0; buyNowScreen1.HorizontalOffset = 0; }); //IsolatedSettingsHelper.SetValue<bool>("sharedonfacebook", true); }; // string[] words = post.Split('|'); var parameters = new Dictionary <string, object>(); //parameters["message"] = txtMessage.Text; parameters["message"] = post; //parameters["link"] = words[1]; //parameters["picture"] = ""; fb.PostAsync("me/feed", parameters); progbar.IsIndeterminate = false; progbar.Visibility = Visibility.Collapsed; // HideProgressIndicator(); } }