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 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;
                });
            }
        }
        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;
        }
Пример #4
0
        // 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();
        }
Пример #6
0
        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();
        }
Пример #7
0
        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();
        }
Пример #8
0
        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 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");
                    }
                }
            });
        }
        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);
            }
        }
Пример #11
0
        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();
            }
        }
        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();
        }