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);
            }
        }
Beispiel #2
0
        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));
                //}
            }
        }