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++) { int sindex = listBox1.Items.IndexOf(listBox1.SelectedItems[i]); if (sindex > -1) { if (CTConnection.getCurUserID() != UsersArray[sindex].UserID) { users.add(new TJSONString(UsersArray[sindex].UserID)); } //users.add(new TJSONString(listBox1.SelectedItems[i].ToString())); } } CTConnection.getLoginUserInstance().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)); }); } }
public static void LogOut() { if (manager != null) { CTConnection.getLoginUserInstance().Logout(); ResetProxy(); } }
// 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.getLoginUserInstance().Logout(); } catch { } }
private void LoadUsersList() { CTConnection.getLoginUserInstance().GetUserList(users => { this.Dispatcher.BeginInvoke(() => { listBox1.Items.Clear(); UsersArray.Clear(); int i = 0; for (i = 0; i < users.size(); i++) { TJSONObject userItem = users.getJSONObject(i); UsersArray.Add(new UserRecord(userItem.getString("userid"), userItem.getString("username"))); listBox1.Items.Add(userItem.getString("username")); } //listBox1.DataContext = UsersArray; //listBox1.DisplayMemberPath = "UserName"; }); }, ManageExceptionCallback); }
private void LoadAccBookList() { CTConnection.getLoginUserInstance().GetAccListJSON(result => { this.Dispatcher.BeginInvoke(() => { lbAccBook.Items.Clear(); AccBookArray.Clear(); TJSONArray accbooks = result.getJSONArray("accbooks"); int i = 0; for (i = 0; i < accbooks.size(); i++) { TJSONObject AccItem = accbooks.getJSONObject(i); AccBookArray.Add(new AccBook(AccItem.getString("syaccbookcode"), AccItem.getString("syaccbookname"))); lbAccBook.Items.Add(AccItem.getString("syaccbookname")); } if (lbAccBook.Items.Count > 0) { lbAccBook.SelectedIndex = 0; } }); }, ManageExceptionCallback); }
private void btnRing_Click(object sender, RoutedEventArgs e) { CTConnection.getLoginUserInstance().SendCMDToAll("ring"); }
private void btnSendTweet_Click(object sender, RoutedEventArgs e) { CTConnection.getLoginUserInstance().SendMessageToAll(txtMsg.Text.ToString(), OnSendCallback, ManageExceptionCallback); }
private void btnVibrate_Click(object sender, RoutedEventArgs e) { CTConnection.getLoginUserInstance().SendCMDToFollow("vibrate"); }