public void Folder_OnChanged(object sender, CssLib.MigrationObjectEventArgs e) { //while (!_shouldStop) { CssLib.MigrationFolder f = (CssLib.MigrationFolder)sender; if (e.PropertyName == "CurrentCountOfItems") { if (f.FolderName != null) { if (e.NewValue.ToString() != "0") { string msg1 = "{0} of {1} for account " + f.AccountID.ToString(); string msgF = String.Format(msg1, f.CurrentCountOfItems, f.TotalCountOfItems); if (f.CurrentCountOfItems > 0) { System.Console.WriteLine(msgF); } } } } if (e.PropertyName == "TotalCountOfItems") // finish up with the last folder { if (f.FolderName != null) { string msg2 = "{0} of {1} for account " + f.AccountID.ToString(); string msgF = String.Format(msg2, f.CurrentCountOfItems, f.TotalCountOfItems); if (f.CurrentCountOfItems > 0) { System.Console.WriteLine(msgF); } } } if (e.PropertyName == "FolderName") { if (e.NewValue != null) { string folderName = e.NewValue.ToString(); // string folderType = GetFolderTypeForUserResults(f.FolderView); string msg3 = "Migrating {0} " + " For " + f.AccountID; /*ar.PBMsgValue = */ string msgF = String.Format(msg3, folderName); System.Console.WriteLine(msgF); } if (_shouldStop) { System.Console.WriteLine(); System.Console.WriteLine(); string Messg = "Migration For UserAccount Cancelled"; /* ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Red, * "Migration For UserAccount Cancelled");*/ System.Console.WriteLine(Messg); System.Console.WriteLine(); System.Console.WriteLine(); Countdown.Signal(); CancelAsync(); Thread.CurrentThread.Abort(); } } } }
public void Acct_OnAcctChanged(object sender, CssLib.MigrationObjectEventArgs e) { // while (!_shouldStop) { //string msg = ""; CssLib.MigrationAccount a = (CssLib.MigrationAccount)sender; if (e.PropertyName == "TotalItems") { /*System.Console.WriteLine(); * * ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Yellow, * "TotalItems to Migrate For UserAccount " + a.AccountID.ToString() + " is " + e.NewValue.ToString()); * System.Console.WriteLine();*/ // a.TotalItems = Convert.ToInt32(e.NewValue); Currentuser.StatusMessage = "Total Items to Migrate For UserAccount " + a.AccountID + " is " + e.NewValue.ToString(); /*System.Console.WriteLine(); * System.Console.WriteLine();*/ } if (e.PropertyName == "TotalErrors") { this.NumofErrors = (int)a.TotalErrors + 1; // this happens first System.Console.WriteLine(); if (a.MaxErrorCount > 0) { if (this.NumofErrors >= a.MaxErrorCount) { System.Console.WriteLine(); if (a.LastProblemInfo != null) { System.Console.WriteLine(); string mesg = a.LastProblemInfo.Msg; System.Console.WriteLine(mesg); System.Console.WriteLine(); } System.Console.WriteLine(); Currentuser.StatusMessage = "Total Errors For UserAccount " + a.AccountID.ToString() + " are " + this.NumofErrors.ToString(); System.Console.WriteLine(Currentuser.StatusMessage); string Messg = "Migration For UserAccount Cancelled because MaxErrorCount has been reached"; /* ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Red, * "Migration For UserAccount Cancelled");*/ System.Console.WriteLine(Messg); System.Console.WriteLine(); System.Console.WriteLine(); //this.countdown.Signal(); //this.RequestCancel(); // this.RequestStop(); //Countdown.Signal(); CancelAsync(); //Thread.CurrentThread.Abort(); } } if (a.LastProblemInfo != null) { System.Console.WriteLine(); string mesg = a.LastProblemInfo.Msg; System.Console.WriteLine(mesg); System.Console.WriteLine(); } /* ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Yellow, * "TotalErrors For UserAccount " + a.AccountID.ToString() + Numoferrors.ToString());*///donot use progressutil we want to have consistent logging. /*Currentuser.StatusMessage = "Total Errors For UserAccount " + a.AccountID.ToString() + "are" + NumofErrors.ToString(); * System.Console.WriteLine(Currentuser.StatusMessage); * System.Console.WriteLine(); * System.Console.WriteLine();*/ } else if (e.PropertyName == "TotalWarnings") { NumofWarns = (int)a.TotalWarnings + 1; System.Console.WriteLine(); /* ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Yellow, * "TotalWarnings For UserAccount " + a.AccountID.ToString() + NumofWarns.ToString());*/ //donot use progressutil we want to have consistent logging. Currentuser.StatusMessage = "Total Warnings For UserAccount " + a.AccountID.ToString() + NumofWarns.ToString(); System.Console.WriteLine(Currentuser.StatusMessage); System.Console.WriteLine(); } else { /* System.Console.WriteLine(); * * ProgressUtil.RenderConsoleProgress(30, '\u2591', ConsoleColor.Yellow, * "TotalItems to Migrate For UserAccount " + a.AccountName.ToString() + " is " + e.NewValue.ToString()); * System.Console.WriteLine();/* * * msg = "Begin {0} Migration"; * * string msgF = String.Format(msg, a.AccountName); * System.Console.WriteLine(msgF);*/ } } }