internal void cancelDump() { if (mydump != null) { mydump.cancelMysqlDumpProcess(); mydump = null; } }
/// <summary> /// main mysql dump executor task /// start/running in ASYNC mode. /// internal its calling other task/jobs and waits for completion. /// with every task completed its firing notification events(listener) /// --BASIC FLOW-- /// </summary> async void DumpMysqlTaskExecutor() { Task <List <string> > testConnectionTask = testCon(); List <string> tables = await testConnectionTask; if (tables != null) { onProgress("connected"); onInitDumpTables(tables); mydump = new MysqlDump(); mydump.credentialsConfigInstance = credentialsConfigInstance; mydump.CompressProgress += onCompressProgressHandler; mydump.CompressStart += onCompressStartHandler; mydump.TableRowCount += onTableRowCountHandler; mydump.TableStartDump += onTableStartDumpHandler; Task <DumpResultSet> result = dumptask(mydump); DumpResultSet dumpresult = null; try { dumpresult = await result; } catch (Exception ex) { //xtipaei mysqlException alla edo den mpenei pote Console.WriteLine("MYSQLEXCEPTION" + ex.Message); if (!(ex is NullReferenceException)) { dumpresult = new DumpResultSet(); dumpresult.wasSuccessful = false; dumpresult.errorNumber = 2; dumpresult.mysqldumpexeStandardError = "Error in MySQLDumpAdapter:\n" + ex.Message; onCompleted(dumpresult); } } //me mysqlexception kanonika les kai den trexei tipota sinexizei edo xoris na mpei sto catch Console.WriteLine("NOTMYSQLEXCEPTION"); onCompleted(dumpresult); mydump = null; } else { //we need enumaration classes for all kind of different erros //..We still need enumaration class for all kind of dif erros onError(-1); mydump = null; } }
/// <summary> /// main mysql dump executor task /// start/running in ASYNC mode. /// internal its calling other task/jobs and waits for completion. /// with every task completed its firing notification events(listener) /// --BASIC FLOW-- /// </summary> async void DumpMysqlTaskExecutor() { Task <List <string> > testConnectionTask = testCon(); List <string> tables = await testConnectionTask; if (tables != null) { onProgress("connected"); onInitDumpTables(tables); mydump = new MysqlDump(); mydump.credentialsConfigInstance = credentialsConfigInstance; mydump.CompressProgress += onCompressProgressHandler; mydump.CompressStart += onCompressStartHandler; mydump.TableRowCount += onTableRowCountHandler; mydump.TableStartDump += onTableStartDumpHandler; Task <DumpResultSet> result = dumptask(mydump); DumpResultSet dumpresult = null; try { dumpresult = await result; } catch (Exception ex) { if (!(ex is NullReferenceException)) { dumpresult = new DumpResultSet(); dumpresult.wasSuccessful = false; dumpresult.errorNumber = 2; dumpresult.mysqldumpexeStandardError = "Error in MySQLDumpAdapter:\n" + ex.Message; } } onCompleted(dumpresult); mydump = null; } else { //we need enumaration classes for all kind of different erros //..We still need enumaration class for all kind of dif erros onError(-1); mydump = null; } }
static async Task <DumpResultSet> dumptask(MysqlDump mydump) { return(mydump.executeDump()); }