/// <summary> /// Load an entire LogAnalysis session /// </summary> /// <param name="path">file path</param> public void LoadLogAnalysisSession(string path) { var erase = true; if (YalvRegistry.Instance.ActualWorkspace.LogEntries.Count != 0) { MessageBoxResult result = MessageBox.Show( string.Format("You are about to overwrite the current session, do you wish to continue?"), Resources.MarkerRow_DeleteConfirmation_Caption, MessageBoxButton.YesNo, MessageBoxImage.Error); if (result == MessageBoxResult.No) { erase = false; } } if (!erase) { return; } _fileLoader = new LogFileLoader(); _fileLoader.LoadResultEvent += FileLoaderLoadResultEvent; ManageRepositoriesViewModel.IsLoading = true; _fileLoader.ExecuteAsynchronously(delegate { ManageRepositoriesViewModel.LoadFiles(new List <string> { path }, EntriesProviderType.Yalv, ManageRepositoriesViewModel); }, true); }
/// <summary> /// Load a log4net log file to display its content through this ViewModel. /// </summary> /// <param name="paths">file path</param> public void LoadFiles(List <string> paths) { if (_fileLoader != null) { if (MessageBox.Show( "A load operation is currently in progress. Would you like to cancel the current process?", "Load in progress...", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No) == MessageBoxResult.Yes) { _fileLoader.Cancel(); } } _fileLoader = new LogFileLoader(); _fileLoader.LoadResultEvent += FileLoaderLoadResultEvent; ManageRepositoriesViewModel.IsLoading = true; _fileLoader.ExecuteAsynchronously(delegate { ManageRepositoriesViewModel.LoadFiles(paths, EntriesProviderType.Xml, ManageRepositoriesViewModel); }, true); }
private void RefreshCommandsCanExecute(object sender, LogFileLoader.ResultEvent resultEvent) { _fileLoader.LoadResultEvent -= RefreshCommandsCanExecute; _fileLoader = null; ManageRepositoriesViewModel.IsLoading = false; CommandRefresh.CanExecute(null); CommandDelete.CanExecute(null); LogEntryRows.FilterYalvView.CanExecute(null); RaisePropertyChanged("HasData"); }
/// <summary> /// This is a callback method that is always called when /// the internal load process is finished /// (even when it failed to finish after initialization). /// </summary> /// <param name="loadWasSuccessful"></param> private void LoadFinishedEvent(bool loadWasSuccessful) { if (loadWasSuccessful) { _fileLoader = new LogFileLoader(); _fileLoader.LoadResultEvent += RefreshCommandsCanExecute; ManageRepositoriesViewModel.IsLoading = true; _fileLoader.ExecuteAsynchronously(delegate { LogEntryRows.SetEntries( ManageRepositoriesViewModel.Repositories.ToList()); }, true); } _logEntryRows.FilterViewModel.Analysis = YalvRegistry.Instance.ActualWorkspace.CurrentAnalysis; _manageTextMarkersViewModel.Analysis = YalvRegistry.Instance.ActualWorkspace.CurrentAnalysis; }
public static void Main(string[] args) { string filename = "gestures/track_high_kick_00.log"; Command cmd = LogFileVisualizer.Command.ViewGesture; if (args.Length > 0) { filename = args[0]; if (args.Length > 1) { cmd = (LogFileVisualizer.Command)Enum.Parse(typeof(LogFileVisualizer.Command), args[1]); } } string whichJoint; switch (cmd) { case Command.ViewGesture: using (var vw = new GestureJointVisualizer(filename)) { vw.Run(30.0); } break; case Command.PlotJoint: whichJoint = GetJointName(); var gest1 = new InputGesture(new LogFileLoader(filename)); var jp = new JointPlotter(gest1, whichJoint, true); Application.Run(jp.DisplayPlots()); break; case Command.PlotJointsFromGestures: whichJoint = GetJointName(); var plotlist = new List <JointPlotter>(); var fnames = LogFileLoader.LogFilenames(filename); Form last = null; foreach (var name in fnames) { var gest2 = new InputGesture(new LogFileLoader(name)); var jp2 = new JointPlotter(gest2, whichJoint, false); plotlist.Add(jp2); last = jp2.DisplayPlots(); } Application.Run(last); break; } }
/// <summary> /// Method is executed when the background process finishes and returns here /// because it was cancelled or is done processing. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FileLoaderLoadResultEvent(object sender, LogFileLoader.ResultEvent e) { _fileLoader.LoadResultEvent -= FileLoaderLoadResultEvent; _fileLoader = null; ManageRepositoriesViewModel.IsLoading = false; if (e.InnerException != null) { var exp = new ApplicationException(e.Message, e.InnerException) { Source = "LoadFileLoader" }; exp.Data.Add("Process cancelled?", e.Cancel.ToString()); MessageBox.Show(string.Format("Exception : {0} \n {1}", exp, e.Error), Resources.GlobalHelper_ParseLogFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); LoadFinishedEvent(false); } else { LoadFinishedEvent(true); } }
public LogFileDAO(LogFileLoader logDirectory) { directory = logDirectory; }