public int checkCounter() { var conn = this.ConnectionTypeNumberMethod; switch (conn) { //Drukarki czarne case 1: PrinterHttpConnector.GetCountersFromPrinter(PrinterCounterUri); var unparsedCountersOption1 = PrinterHttpConnector.GetParsedCounterResponse(); this.BlackCounter = Convert.ToInt32(unparsedCountersOption1.ElementAt(0)); break; //Drukarki kolorowe ze skanerem case 2: PrinterHttpConnector.GetCountersFromPrinter(PrinterCounterUri); var unparsedCountersOption4 = PrinterHttpConnector.GetParsedCounterResponse(); this.BlackCounter = Convert.ToInt32(unparsedCountersOption4.ElementAt(1)); this.ColorCounter = Convert.ToInt32(unparsedCountersOption4.ElementAt(0)); break; } return(this.BlackCounter); }
public async System.Threading.Tasks.Task setConnectionAsync() { var conn = this.ConnectionTypeNumberMethod; switch (conn) { case 1: try { await PrinterHttpConnector.ConnectAndEstabilishSession(this.ConnectionUri); } catch (Exception E) { ErrorConnectionHandler(); } break; //implementuj tutaj drugą metodę case 2: try { await PrinterHttpConnector.ConnectAndEstabilishSession(this.ConnectionUri); } catch (Exception E) { ErrorConnectionHandler(); } break; } }