using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VkNet;
using VkNet.Enums.Filters;
using VkNet.Exception;
namespace ConsoleApplication5 {
class Program {
static void Main(string[] args) {
Singlet.Api = new VkApi();
try {
Singlet.Api.Authorize(12345, "---@mail.ru", "-----", Settings.Friends);
Console.WriteLine("Autorization completed!");
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
}
public class Singlet {
public static VkApi Api { get; set; }
private static Singlet instance;
public static Singlet Instance {
get {
if (instance == null) {
instance = new Singlet();
}
return instance;
}
}
private Singlet() {
}
}
}
Singlet.Api = new VkApi();
public void button1_Click(object sender, EventArgs e)
{
try
{
ulong appID = ...;
string login = textBox3.Text;
string password = textBox4.Text;
Settings settings = Settings.All;
Singlet.Api.Authorize(new ApiAuthParams
{
ApplicationId = appID,
Login = login,
Password = password,
Settings = settings,
});
}
catch
{
MessageBox.Show("Ошибка авторизации");
}
}
public class Singlet
{
public static VkApi Api { get; set; }
private static Singlet instance;
public static Singlet Instance
{
get
{
if (instance == null)
{
instance = new Singlet();
}
return instance;
}
}
private Singlet()
{
}
}