コード例 #1
0
        /// <summary>
        /// Scan the folder and add scaned information to dataGrid
        /// </summary>
        /// <param name="scannedGrid">DataGrid</param>
        public void ScanPathAndRefresh(ExplorerGrid scannedGrid)
        {
            if (scannedGrid == null)
            {
                throw new ArgumentNullException("scannedDataGrid", "UC try to refresh view and get invalid [null] data panel");
            }

            // Засекает время работы функции
            var stopWatchTime = Stopwatch.StartNew();

            long lFilesCount, lDirectoriesCount, lGeneralFilesLength;

            scannedGrid.ItemsSource = ScanSystem.ScanFileSystemEntries(
                scannedGrid.CurrentPath,
                out lFilesCount,
                out lDirectoriesCount,
                out lGeneralFilesLength
                );
            stopWatchTime.Stop();

            scannedGrid.Status.SetTotal(lFilesCount, lDirectoriesCount, lGeneralFilesLength,
                                        stopWatchTime.Elapsed.TotalSeconds);
            scannedGrid.Status.SelectedDirectories = 1;
            scannedGrid.Status.RefreshAll();

            var watcher = (FileSystemWatcher)scannedGrid.Tag;

            watcher.Path = scannedGrid.CurrentPath;

            UcCurrentDirectory = scannedGrid.CurrentPath;
        }
コード例 #2
0
ファイル: Extensions.cs プロジェクト: rajeshwarn/TestProject
 internal static T Explore <T>(this T o, string panelTitle)
 {
     if (o != null)
     {
         GridOptions options2 = new GridOptions {
             MembersToExclude = null,
             PanelTitle       = panelTitle
         };
         Server currentServer = Server.CurrentServer;
         if ((currentServer != null) && (currentServer.DataContextDriver != null))
         {
             currentServer.DataContextDriver.DisplayObjectInGrid(o, options2);
         }
         else
         {
             ExplorerGrid.Display(o, options2);
         }
     }
     return(o);
 }
コード例 #3
0
 public virtual void DisplayObjectInGrid(object objectToDisplay, GridOptions options)
 {
     ExplorerGrid.Display(objectToDisplay, options);
 }
コード例 #4
0
ファイル: Extensions.cs プロジェクト: rajeshwarn/TestProject
 private static T Dump <T>(this T o, string description, int?depth, bool toDataGrid, Action <ClickContext> onClick)
 {
     if (o != null)
     {
         Type type = o.GetType();
         if ((((!type.IsValueType && !type.IsPrimitive) && (type.Namespace != null)) && (type.Namespace.StartsWith("System.Threading.Tasks.Dataflow") && (type.GetInterface("System.Threading.Tasks.Dataflow.IDataflowBlock") != null))) && DataflowBridge.Dump(o, description))
         {
             return(o);
         }
     }
     if (depth < 0)
     {
         depth = null;
     }
     if (depth > 20)
     {
         depth = 20;
     }
     if (((depth.HasValue || toDataGrid) || !AppDomain.CurrentDomain.GetAssemblies().Any <Assembly>(a => a.FullName.StartsWith("PresentationCore,", StringComparison.InvariantCultureIgnoreCase))) || !WpfBridge.DumpWpfElement(o, description))
     {
         bool flag2;
         if ((!depth.HasValue && !toDataGrid) && (o is Control))
         {
             if (o is Form)
             {
                 ((Form)o).Show();
                 return(o);
             }
             PanelManager.DisplayControl((Control)o, description ?? "WinForms");
             return(o);
         }
         if ((o is XContainer) || (o is XmlDocument))
         {
             PanelManager.DisplaySyntaxColoredText(o.ToString(), SyntaxLanguageStyle.XML, description ?? "XML");
             return(o);
         }
         Server     currentServer = Server.CurrentServer;
         TextWriter writer        = (currentServer == null) ? null : currentServer.LambdaFormatter;
         Expression expr          = null;
         if (writer != null)
         {
             if (o is IQueryable)
             {
                 expr = ((IQueryable)o).Expression;
             }
             else if (o is Expression)
             {
                 expr = (Expression)o;
             }
         }
         if (expr != null)
         {
             string content = "";
             try
             {
                 ExpressionToken token = ExpressionToken.Visit(expr);
                 if (token != null)
                 {
                     content = token.ToString();
                 }
             }
             catch (Exception exception)
             {
                 Log.Write(exception, "Dump ExpressionToken Visit");
             }
             if (content.Length > 0)
             {
                 lock (writer)
                 {
                     if (!string.IsNullOrEmpty(description))
                     {
                         writer.WriteLine(new HeadingPresenter(description, content));
                     }
                     else
                     {
                         writer.WriteLine(content + "\r\n");
                     }
                 }
             }
         }
         if ((currentServer != null) && currentServer.WriteResultsToGrids)
         {
             toDataGrid = true;
         }
         if (toDataGrid && (o != null))
         {
             Type t = o.GetType();
             if (((!ExplorerGrid.IsAtomic(t) && (!t.IsArray || (t.GetArrayRank() == 1))) && (t.GetInterface("System.IObservable`1") == null)) && (t.GetCustomAttributes(typeof(MetaGraphNodeAttribute), false).Length == 0))
             {
                 return(o.Explore <T>(description));
             }
         }
         XhtmlWriter writer3 = (currentServer == null) ? null : currentServer.ResultsWriter;
         if (flag2 = o is Type)
         {
             ObjectNode.ExpandTypes = true;
         }
         try
         {
             if (!string.IsNullOrEmpty(description))
             {
                 HeadingPresenter presenter = new HeadingPresenter(description, o);
                 if (writer3 != null)
                 {
                     writer3.WriteDepth(presenter, depth, onClick);
                 }
                 else
                 {
                     Console.Write(presenter);
                 }
                 return(o);
             }
             if (writer3 != null)
             {
                 writer3.WriteLineDepth(o, depth, onClick);
             }
             else
             {
                 Console.WriteLine(o);
             }
         }
         finally
         {
             if (flag2)
             {
                 ObjectNode.ExpandTypes = false;
             }
         }
     }
     return(o);
 }