public MainWindow() { try { this.InitializeComponent(); var connection = new Connection { ApplicationId = 2745992, Scope = (int)ScopeList.AccessToAudio }; var dialog = new SigningWindow(connection); if (dialog.ShowDialog() == true) { DataContext = new SearcherViewModel(new AudioAdapter(dialog.Connection)); } else { Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { var connection = new Connection { ApplicationId = 2745992, Scope = (int)ScopeList.AccessToMessages }; var authenticationService = new AuthenticationService(connection); var result = authenticationService.Authenticate(); var dialog = new SigningWindow(connection); if (dialog.ShowDialog() == true) { var adapter = new WallAdapter(connection); var messageAdapter = new MessageAdapter(connection); DeleteMessages(messageAdapter); Spam( 100, i => { var message = "Hello" +(i % 2 == 0 ? "!" : "!!"); var responce = messageAdapter.SendMessage(3767334, message); if (responce.Success) { Console.WriteLine(string.Format("Message #{0} with text '{1}' was sended."), i, message); } return responce; }, TimeSpan.FromSeconds(10)); //var response = adapter.Post(171584020, "Привет", new[] { "Hello" }); //var message = "Заплетенные в косичку волосы – отличная прическа на все случаи жизни.Косички – очень модная тенденция сегодня, их можно носить на работу или учебу, выходя в свет или отправляясь в путешествие.Приглашаю всех в свою группу, где вы найдете много всего интересного"; //int posts = 0; //foreach (var receiver in receivers) //{ // var result = adapter.Post(receiver, message, new[] { "photo137457222_281801028", "http://vk.com/club37310676" }); // if (result) // { // posts++; // } // Thread.Sleep(TimeSpan.FromSeconds(10)); //} } }
/// <summary> /// Подключение к базе данных вконтакте /// </summary> /// <param name="connection"> /// The connection. /// </param> public void Connect(Connection connection) { this.Connection = connection; string uri = string.Format( "https://oauth.vk.com/authorize?client_id={0}&display=popup&scope={1}&response_type=token", connection.ApplicationId, connection.Scope); this.Navigate(new Uri(uri)); }
public SigningWindow(Connection connection) { this.InitializeComponent(); this.MinWidth = this.SignInControl.ClientSize.Width; this.MinHeight = this.SignInControl.ClientSize.Height; this.Connection = connection; this.SignInControl.SignInCompleted += OnSignInCompleted; this.SignInControl.Connect(this.Connection); }
public ViewModelWithConnection(Connection connection) { this.Connection = connection; }
public WallAdapter(Connection connection) : base(connection) { }
/// <summary> /// Конструктор без параметров /// </summary> /// <param name="connection"></param> public MessageAdapter(Connection connection) : base(connection) { }
public DocumentAdapter(Connection connection) : base(connection) { }
public AudioAdapter(Connection connection) : base(connection) { }
private static int[] SearchRecivers(Connection connection) { var profileAdapter = new ProfileAdapter(connection); // Находим друзей var friends = profileAdapter.GetFriends<UserExtended>(); // Находим друзей друзей var friendsOfFriends = new List<UserExtended>(); foreach (var userExtended in friends) { friendsOfFriends.AddRange(profileAdapter.GetFriends<UserExtended>(userExtended.Id).ToList()); Console.WriteLine(friendsOfFriends.Count); } // Складываем всех друзей friendsOfFriends.AddRange(friends.ToList()); var groupAdapter = new GroupAdapter(connection); var groups = groupAdapter.GetGroups(connection.UserId); var adminGroup = groups.First(); var members = groupAdapter.GetGroupMembers(adminGroup.Id); friendsOfFriends = friendsOfFriends.Where(person => !members.Contains(person.Id)).ToList(); friendsOfFriends = friendsOfFriends.Where(person => person.Sex == "1").ToList(); friendsOfFriends = friendsOfFriends.Where(person => person.City == 144).ToList(); var ids = friendsOfFriends.Select(person => person.Id).ToArray(); ids = ids.Distinct().ToArray(); using (var writer = new StreamWriter("ids.txt")) { foreach (var id in ids) { writer.WriteLine(id); } } return ids; }
public VideoAdapter(Connection connection) : base(connection) { }
public PhotoAdapter(Connection connection) : base(connection) { }
public LikeAdapter(Connection connection) : base(connection) { }