示例#1
0
        /// <summary>
        /// Load a log4net file and return the corresponding viewmodel representation for it.
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        private static Log4NetViewModel LoadFile(string filePath)
        {
            bool IsFilePathReal = false;

            try
            {
                IsFilePathReal = File.Exists(filePath);
            }
            catch
            {
            }

            if (IsFilePathReal == false)
            {
                return(null);
            }

            Log4NetViewModel vm = new Log4NetViewModel();

            if (vm.OpenFile(filePath) == true)
            {
                return(vm);
            }

            return(null);
        }
示例#2
0
 /// <summary>
 /// Executes event based when the active (AvalonDock) document changes.
 /// Determine whether tool window can show corresponding state or not
 /// and update viewmodel reference accordingly.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnActiveDocumentChanged(object sender, DocumentChangedEventArgs e)
 {
     if (e != null)
     {
         if (e.ActiveDocument != null)
         {
             if (e.ActiveDocument is Log4NetViewModel)
             {
                 Log4NetViewModel log4NetVM = e.ActiveDocument as Log4NetViewModel;
                 this.Log4NetVM = log4NetVM;  // There is an active Log4Net document -> display corresponding content
             }
             else
             {
                 this.Log4NetVM = null;
             }
         }
     }
     else             // There is no active document hence we do not have corresponding content to display
     {
         this.Log4NetVM = null;
     }
 }
示例#3
0
 public static Log4NetViewModel LoadFile(IDocumentModel dm, object o)
 {
     return(Log4NetViewModel.LoadFile(dm.FileNamePath));
 }
示例#4
0
 public static Log4NetViewModel LoadFile(IDocumentModel dm,
                                         object o,
                                         IMessageBoxService msgBox)
 {
     return(Log4NetViewModel.LoadFile(dm.FileNamePath, msgBox));
 }