//------------------------------------------------------------------------------------------------ //--------------------------------------기능 함수------------------------------------------------ //------------------------------------------------------------------------------------------------ private void SaveUnfav() { for (int i = 0; i < listBitmapImage.Count; i++) { if (listBitmapImage[i].IsDownloading) { MessageBox.Show("이미지를 로딩 중입니다.", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } } for (int i = 0; i < listBitmapImage.Count; i++) { FileInstence.SaveImage(listTweet[index].mediaEntities.media[i].media_url_https, listBitmapImage[i]); } //MessageBox.Show("모든 이미지를 저장했습니다.", "알림", MessageBoxButton.OK); PacketFavorites_Destroy parameter = new PacketFavorites_Destroy(); parameter.id = listTweet[index].id; string json = WebInstence.SyncRequest(parameter); if (json.Length > 50) { listTweet[index].favorited = false; MessageBox.Show("저장, 관심글 해제 성공", "알림", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void BlockUnblock(object obj) { if (obj is long == false) { return; } long id = (long)obj; PacketBlockCreate create = new PacketBlockCreate(id); string json = WebInstence.SyncRequest(create); if (json.Length == 0) { MessageBox.Show("차단 제한! 몇 분 뒤 다시 시도해주세요(최대 15분)", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } try { UserFollow user = JsonConvert.DeserializeObject <UserFollow>(json); } catch { MessageBox.Show("차단 오류", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } PacketBlockDestroy destroy = new PacketBlockDestroy(id); string json2 = WebInstence.SyncRequest(destroy); if (json.Length == 0) { MessageBox.Show("차단 해제 제한! 몇 분 뒤 다시 시도해주세요(최대 15분)", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } try { UserFollow user = JsonConvert.DeserializeObject <UserFollow>(json2); UpdateBlock(user, false); } catch { MessageBox.Show("차단 해제 오류", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } }
public FollowWindow(string screen_name) { LoadResources(bitmapLock, Properties.Resources.lockPick_Large); InitializeComponent(); dicPanel.Add(eUserPanel.eFollower, new ListBoxUserManager(eUserPanel.eFollower, listboxFollower)); dicPanel.Add(eUserPanel.eFollowing, new ListBoxUserManager(eUserPanel.eFollowing, listboxFollowing)); dicPanel.Add(eUserPanel.eUserFollowing, new ListBoxUserManager(eUserPanel.eUserFollowing, listboxUserFollowing)); dicPanel.Add(eUserPanel.eUserFollwer, new ListBoxUserManager(eUserPanel.eUserFollwer, listboxUserFollower)); string json = WebInstence.SyncRequest(new PacketVerifyCredentials()); userMe = JsonConvert.DeserializeObject <UserFollow>(json); userMe.Init(); json = WebInstence.SyncRequest(new PacketUserShow(screen_name)); if (string.IsNullOrEmpty(json)) { Title = "상대방 계정 정보 불러오기 오류"; MessageBox.Show(this, "상대방 계정 정보를 불러 올 수 없습니다.", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } UserFollow user = JsonConvert.DeserializeObject <UserFollow>(json); user.Init(); gridUserTop.DataContext = user; Title = $"{user.screen_name} 의 프로필"; //if (isFollowing) // following_Click(null, null); //else // follower_Click(null, null); }
private void Block(object obj) { PacketBlockCreate parameter = obj as PacketBlockCreate; if (parameter == null) { return; } string json = WebInstence.SyncRequest(parameter); if (json.Length == 0) { MessageBox.Show("차단 제한! 몇 분 뒤 다시 시도해주세요(최대 15분)", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } try { UserFollow user = JsonConvert.DeserializeObject <UserFollow>(json); UpdateBlock(user, true); } catch { MessageBox.Show("차단 오류", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public FollowWindow(bool isFollowing) { LoadResources(bitmapLock, Properties.Resources.lockPick_Large); InitializeComponent(); dicPanel.Add(eUserPanel.eFollower, new ListBoxUserManager(eUserPanel.eFollower, listboxFollower)); dicPanel.Add(eUserPanel.eFollowing, new ListBoxUserManager(eUserPanel.eFollowing, listboxFollowing)); dicPanel.Add(eUserPanel.eUserFollowing, new ListBoxUserManager(eUserPanel.eUserFollowing, listboxUserFollowing)); dicPanel.Add(eUserPanel.eUserFollwer, new ListBoxUserManager(eUserPanel.eUserFollwer, listboxUserFollower)); string json = WebInstence.SyncRequest(new PacketVerifyCredentials()); userMe = JsonConvert.DeserializeObject <UserFollow>(json); userMe.Init(); gridUserTop.DataContext = userMe; if (isFollowing) { following_Click(null, null); } else { follower_Click(null, null); } }
private void Fav() { PacketFavorites_Create parameter = new PacketFavorites_Create(); parameter.id = listTweet[index].id; string json = WebInstence.SyncRequest(parameter); if (json.Length > 50) { MessageBox.Show("관심글 등록 완료", "알림", MessageBoxButton.OK, MessageBoxImage.Information); listTweet[index].favorited = true; } }
private void Unfav() { PacketFavorites_Destroy parameter = new PacketFavorites_Destroy(); parameter.id = listTweet[index].id; string json = WebInstence.SyncRequest(parameter); if (json.Length > 50) { listTweet[index].favorited = false; MessageBox.Show("관심글 해제 성공", "알림", MessageBoxButton.OK, MessageBoxImage.Information); } }
private void LoadFavoriteTweet(object obj) { PacketFavoritesList parameter = new PacketFavoritesList(); parameter.count = 200.ToString(); int loadFavCount = 0; DeleChangeText dele = new DeleChangeText(StateTextChange); for (int j = 0; j < 15; j++) { string json = WebInstence.SyncRequest(parameter); if (json.Length == 0) { MessageBox.Show("불러오기 제한! 몇 분 뒤 다시 시도해주세요(최대 15분)", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); break; } List <ClientTweet> listTemp = JsonConvert.DeserializeObject <List <ClientTweet> >(json); loadFavCount += listTemp.Count; Application.Current.Dispatcher.BeginInvoke(dele, new object[] { $"불러오는중: {loadFavCount}/{countFav}" }); for (int i = 0; i < listTemp.Count; i++) { listTemp[i].Init(); if (listTemp[i].isMedia) { if (listTemp[i].dicPhoto.Count == 1) //media가 있는데 photo일 경우에만 저장 { foreach (ClientMedia item in listTemp[i].dicPhoto.Values) { if (item.type == "photo") { listTweet.Add(listTemp[i]); } break; } } else { listTweet.Add(listTemp[i]); } } } if (loadFavCount >= countFav) { break; } parameter.max_id = listTemp[listTemp.Count - 1].id; } Application.Current.Dispatcher.BeginInvoke(dele, new object[] { "불러오기 완료" }); NextState(); }
private void LoadMyInfo(object obj) { DeleChangeText dele = new DeleChangeText(StateTextChange); Application.Current.Dispatcher.BeginInvoke(dele, new object[] { "정보 불러오는 중" }); PacketVerifyCredentials parameter = new PacketVerifyCredentials(); string json = WebInstence.SyncRequest(parameter); User user = JsonConvert.DeserializeObject <User>(json); if (user == null) { Application.Current.Dispatcher.BeginInvoke(dele, new object[] { "정보 불러오기 실패" }); return; } countFav = user.favourites_count; Application.Current.Dispatcher.BeginInvoke(dele, new object[] { "정보 불러오기 완료!" }); NextState(); }
private void LoadUser(object obj) { BasePacket parameter = obj as BasePacket; if (parameter == null) { return; } string json = WebInstence.SyncRequest(parameter); if (json.Length == 0) { MessageBox.Show("불러오기 제한! 몇 분 뒤 다시 시도해주세요(최대 15분)", "오류", MessageBoxButton.OK, MessageBoxImage.Warning); return; } Users users = JsonConvert.DeserializeObject <Users>(json); DeleAddUsers dele = new DeleAddUsers(AddUser); Application.Current.Dispatcher.BeginInvoke(dele, new object[] { users }); }
private void LoadDeahwaThread(object obj) { ClientTweet tweet = obj as ClientTweet; if (tweet == null) { return; } PacketSingleTweet parameter = new PacketSingleTweet(tweet.originalTweet.in_reply_to_status_id_str); string json = WebInstence.SyncRequest(parameter); ClientTweet dhTweet = JsonConvert.DeserializeObject <ClientTweet>(json); if (dhTweet == null) { DalsaeInstence.ShowMessageBox("이전 대화 유저가 잠금 계정 혹은 차단된 상태입니다.", "오류"); } else { dhTweet.Init(); UIProperty.DeleAddSingleTweet dele = new UIProperty.DeleAddSingleTweet(tweet.uiProperty.AddSingleTweet); Application.Current.Dispatcher.BeginInvoke (dele, new object[] { dhTweet, tweet.uiProperty.isQtTweet ? tweet.uiProperty : tweet.uiProperty.parentTweet, false }); } }
private void TaskRequestOAuth(BasePacket packet, Action <ResOAuth> callback) { WebInstence.SyncRequestOAuth(packet, callback); }
private void TaskRequestPacket(PacketMediaUpload packet, ClientSendTweet tweet, Action <ClientSendTweet, ClientMultimedia> callback) { WebInstence.SendMultimedia(packet, tweet, callback); }
private void TaskRequestPacket <TRes>(BasePacket packet, UIProperty property, Action <TRes, UIProperty> callback) { WebInstence.SyncRequest <TRes>(packet, property, callback); }
private void TaskRequestPacket <TRes>(BasePacket param, Action <TRes> callback) { WebInstence.SyncRequest <TRes>(param, callback); }