public void AddHistoryEntry(CompareHistory history) { CompareHistory[] new_history = new CompareHistory[History == null ? 1 : History.Length + 1]; if (History != null) History.CopyTo (new_history, 0); new_history[new_history.Length - 1] = history; History = new_history; }
public void AddHistoryEntry(CompareHistory history) { CompareHistory[] new_history = new CompareHistory[History == null ? 1 : History.Length + 1]; if (History != null) { History.CopyTo(new_history, 0); } new_history[new_history.Length - 1] = history; History = new_history; }
public void StartCompare (WaitCallback done) { AdditionalInfoWindow.Visible = false; progressbar1.Visible = true; progressbar1.Adjustment.Lower = 0; progressbar1.Adjustment.Upper = 100; // clear our existing content if (context != null) context.StopCompare (); // Go to the actual tree page. notebook1.Page = 0; // now generate new content asynchronously context = new CompareContext (reference_loader, target_loader); context.ProgressChanged += delegate (object sender, CompareProgressChangedEventArgs e) { Application.Invoke (delegate { Status = e.Message; Progress = e.Progress; }); }; context.Error += delegate (object sender, CompareErrorEventArgs e) { Application.Invoke (delegate { Console.WriteLine ("ERROR: {0}", e.Message); MessageDialog md = new MessageDialog (this, 0, MessageType.Error, ButtonsType.Ok, false, e.Message); md.Response += delegate (object s, ResponseArgs ra) { md.Hide (); }; md.Show(); Status = String.Format ("Comparison failed at {0}", DateTime.Now); Progress = 0.0; progressbar1.Visible = false; }); }; context.Finished += delegate (object sender, EventArgs e) { Application.Invoke (delegate { DateTime finish_time = DateTime.Now; if (context.Comparison != null) { Status = String.Format ("Comparison completed at {0}", finish_time); context.Comparison.PropagateCounts (); PopulateTreeFromComparison (context.Comparison); Progress = 0.0; CompareHistory[] history = Config.Recent[0].History; if (history == null || history.Length == 0 || (history[history.Length-1].Extras != context.Comparison.Extra || history[history.Length-1].Errors != context.Comparison.Warning || history[history.Length-1].Missing != context.Comparison.Missing || history[history.Length-1].Niexs != context.Comparison.Niex || history[history.Length-1].Todos != context.Comparison.Todo)) { CompareHistory history_entry = new CompareHistory(); history_entry.CompareTime = finish_time; history_entry.Extras = context.Comparison.Extra; history_entry.Errors = context.Comparison.Warning; history_entry.Missing = context.Comparison.Missing; history_entry.Niexs = context.Comparison.Niex; history_entry.Todos = context.Comparison.Todo; Config.Recent[0].AddHistoryEntry (history_entry); Config.Save (); } } else Status = "Comparison not completed - no data returned."; done (this); progressbar1.Visible = false; }); }; treeStore.Clear (); context.Compare (); }