static void Main(string[] args)
        {
            if (!LoadConfig())
            {
                SetConfig();
            }
            var serverLP = api.Messages.GetLongPollServer(true);
            VkNetExtMessageLongPollWatcher sss = new VkNetExtMessageLongPollWatcher(new MessageLongPollWatcherOptions()
            {
                Wait = 25
            }, api);

            sss.Ts           = ulong.Parse(serverLP.Ts);
            sss.Pts          = serverLP.Pts;
            sss.NewMessages += newMessage;
            sss.StartWatchAsync();
            Console.ReadLine();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            api = new VkApi();
            var token  = "ТОКЕН";
            var userId = 0;

            api.Authorize(new ApiAuthParams()
            {
                AccessToken = token, UserId = userId
            });
            VkNetExtMessageLongPollWatcher watcher = new VkNetExtMessageLongPollWatcher(new MessageLongPollWatcherOptions()
            {
                Wait = 10, StepSleepTimeMsec = 10, MaxSleepSteps = 10
            }, api);

            watcher.NewEvents += newEvents;
            initCommands();
            new Task(x => (x as VkNetExtMessageLongPollWatcher).StartWatchAsync(), watcher).Start();
            while (true)
            {
                Thread.Sleep(100);
            }
        }