Example #1
0
 private void ApplicationBarIconButton_Click(object sender, EventArgs e)
 {
     CTConnection.LogOut();
     this.Dispatcher.BeginInvoke(() =>
     {
         this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
     });
 }
Example #2
0
 private void btnSendTweet_Click(object sender, RoutedEventArgs e)
 {
     CTConnection.getCompanyTweet().SendTweet(txtMsg.Text.ToString(), () =>
     {
         this.Dispatcher.BeginInvoke(() => txtMsg.Text = "");
     },
                                              ManageExceptionCallback);
 }
Example #3
0
 // Code to execute when the application is deactivated (sent to background)
 // This code will not execute when the application is closing
 private void Application_Deactivated(object sender, DeactivatedEventArgs e)
 {
     try
     {
         CTConnection.getCompanyTweet().Logout();
     }
     catch
     {
     }
 }
Example #4
0
        private void btn_Login(object sender, EventArgs e)
        {
            OnLogin LoginDelegate = () =>
                                    Dispatcher.BeginInvoke(() => NavigationService.Navigate(new Uri("/UsersList.xaml", UriKind.Relative)));
            OnException ExceptionDelegate = (ex) =>
                                            Dispatcher.BeginInvoke(() => MessageBox.Show(ex.Message));

            CTConnection.ResetProxy();
            CTConnection.LoginUser(txtName.Text, LoginDelegate, ExceptionDelegate);
        }
Example #5
0
 private void UsersList_Loaded(object sender, RoutedEventArgs e)
 {
     if (CTConnection.IsNull())
     {
         this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
     }
     else
     {
         LoadUsersList();
     }
 }
Example #6
0
 private void LoadUsersList()
 {
     CTConnection.getCompanyTweet().UsersList(users =>
     {
         this.Dispatcher.BeginInvoke(() =>
         {
             int i = 0;
             for (i = 0; i < users.size(); i++)
             {
                 listBox1.Items.Add(users.getJSONObject(i).getString("username"));
             }
         });
     }, ManageExceptionCallback);
 }
Example #7
0
        private void Follow_Users(object sender, EventArgs e)
        {
            TJSONArray users = new TJSONArray();

            if (listBox1.SelectedItems.Count != 0)
            {
                for (int i = 0; i < listBox1.SelectedItems.Count; i++)
                {
                    users.add(new TJSONString(listBox1.SelectedItems[i].ToString()));
                }
                CTConnection.getCompanyTweet().SetUsersToFollow(users, () =>
                {
                    this.Dispatcher.BeginInvoke(() => { this.NavigationService.Navigate(new Uri("/MainTweetPage.xaml", UriKind.Relative)); });
                });
            }
            else
            {
                this.Dispatcher.BeginInvoke(() => { this.NavigationService.Navigate(new Uri("/MainTweetPage.xaml", UriKind.Relative)); });
            }
        }
Example #8
0
        private void SaveSettings(object sender, EventArgs e)
        {
            this.Dispatcher.BeginInvoke(() =>
            {
                settings["hostname"] = txt_hostname.Text.ToString();
                settings["port"]     = txt_port.Text.ToString();

                settings.Save();
                CTConnection.ResetProxy();

                try
                {
                    Convert.ToInt32(txt_port.Text.ToString());
                    this.NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                }
                catch (Exception)
                {
                    MessageBox.Show("Invalid port number!");
                }
            });
        }
Example #9
0
 private void PhoneApplicationPage_BackKeyPress(object sender, System.ComponentModel.CancelEventArgs e)
 {
     CTConnection.LogOut();
 }