protected void _constructBase(string phoneNum, string imei, string nick, bool debug, bool hidden) { this.messageQueue = new List <ProtocolTreeNode>(); this.phoneNumber = phoneNum; this.password = imei; this.name = nick; this.hidden = hidden; //WhatsApp.DEBUG = debug; this.reader = new BinTreeNodeReader(); this.loginStatus = WhatsAPI.UniversalApps.Libs.Constants.Enums.CONNECTION_STATUS.DISCONNECTED; this.BinWriter = new BinTreeNodeWriter(); this.whatsNetwork = new Sockets(Constants.Information.WhatsAppHost, Constants.Information.WhatsPort, this.timeout); }
public async Task Connect() { try { if (isTryingToConnect) { return; } isTryingToConnect = true; await this.whatsNetwork.Connect(); this.loginStatus = WhatsAPI.UniversalApps.Libs.Constants.Enums.CONNECTION_STATUS.CONNECTED; //success isTryingToConnect = false; this.fireOnConnectSuccess(); } catch (Exception e) { isTryingToConnect = false; this.fireOnConnectFailed(e); } }
public void Disconnect(Exception ex = null) { this.whatsNetwork.Disconnect(); this.loginStatus = WhatsAPI.UniversalApps.Libs.Constants.Enums.CONNECTION_STATUS.DISCONNECTED; this.fireOnDisconnect(ex); }