Esempio n. 1
0
        private TreeNode BuildTreeNode(IExecutionItem executionItem)
        {
            TreeNode node = new TreeNode(executionItem.ToString());

            node.Tag = executionItem;
            return(node);
        }
Esempio n. 2
0
        private void FireQueryModel(IExecutionItem executionItem)
        {
            if (executionItem == null)
            {
                return;
            }

            Cursor current = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            tbConsole.Clear();
            tbConsole.Refresh();
            Console.Clear();

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            IList data = executionItem.Execute();

            stopWatch.Stop();

            dgResult.Text            = executionItem.ToString();
            dgResult.DataSource      = data;
            dgResult.CellFormatting += DgResultOnCellFormatting;

            int    count          = data.Count;
            double totalSeconds   = stopWatch.Elapsed.TotalSeconds;
            int    countPerSecond = (int)(count / totalSeconds);

            this.Text = string.Format("Count: {0}, Time: {1}, CountPerSecond: {2}", count, totalSeconds, countPerSecond);

            Cursor.Current = current;
        }
Esempio n. 3
0
        private void FireQueryModel(IExecutionItem executionItem)
        {
            if (executionItem == null)
                return;

            Cursor current = Cursor.Current;
            Cursor.Current = Cursors.WaitCursor;

            tbConsole.Clear();
            tbConsole.Refresh();
            Console.Clear();

            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            IList data = executionItem.Execute();
            stopWatch.Stop();

            dgResult.Text = executionItem.ToString();
            dgResult.DataSource = data;
            dgResult.CellFormatting += DgResultOnCellFormatting;

            int count = data.Count;
            double totalSeconds = stopWatch.Elapsed.TotalSeconds;
            int countPerSecond = (int)(count / totalSeconds);
            this.Text = string.Format("Count: {0}, Time: {1}, CountPerSecond: {2}", count, totalSeconds, countPerSecond);

            Cursor.Current = current;
        }
Esempio n. 4
0
        private void tvExecutionList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode       treeNode      = e.Node;
            IExecutionItem executionItem = (IExecutionItem)treeNode.Tag;

            FireQueryModel(executionItem);
        }
 private void StartSynchronous(IExecutionItem[] items, IRuntimeManager manager)
 {
     using (var mre = new AutoResetEvent(false)) {
         foreach (IExecutionItem item in items) {
             if (m_abortRequested) break;
             if (item.State == ProjectExecutionState.Pending) {
                 item.IsSelected = true;
                 item.BeginExecute(manager, i => mre.Set());
                 mre.WaitOne();
             }
         }
     }
 }
 private void StartAsynchronous(IExecutionItem[] items, IRuntimeManager manager)
 {
     IExecutionItem[] executableItems = items.Where(i => i.State == ProjectExecutionState.Pending).ToArray();
     int count = executableItems.Length;
     if (count > 0) {
         executableItems.First().IsSelected = true;
     }
     using (var mre = new ManualResetEvent(false)) {
         foreach (IExecutionItem item in executableItems) {
             if (m_abortRequested) break;
             item.BeginExecute(manager, i => {
                 if (--count == 0) {
                     mre.Set();
                 }
             });
         }
         mre.WaitOne();
     }
 }
 private void Start(ExecutionMode mode, IExecutionItem[] items, IRuntimeManager manager)
 {
     try {
         if (mode == ExecutionMode.Synchronous) {
             StartSynchronous(items, manager);
         }
         else {
             StartAsynchronous(items, manager);
         }
     }
     finally {
         IsExecuting = false;
     }
 }
 private static void PerformItemAction(IExecutionItem item, Action<IExecutionItem> action)
 {
     if (item != null) {
         action(item);
     }
 }
 internal void StartWhenFullyLoaded(ExecutionMode mode, IExecutionItem[] items, IRuntimeManager manager)
 {
     IsExecuting = true;
     m_manager = manager;
     Items = items;
     Action a = () => SelfDisposingBackgroundWorker.RunWorkerAsync((s,e) => Start(mode, items, manager));
     if (IsLoaded) {
         Dispatcher.BeginInvoke(a, DispatcherPriority.ContextIdle, null);
     }
     else {
         RoutedEventHandler handler = null;
         handler = (s, e) => {
             Loaded -= handler;
             Dispatcher.BeginInvoke(a, DispatcherPriority.ContextIdle, null);
         };
         Loaded += handler;
     }
 }
 /// <summary>
 /// Begins execution of the supplied items and waits for them to complete before returning.
 /// </summary>
 /// <param name="mode">Indicates whether items are to be executed synchronously or asynchronously.</param>
 /// <param name="items">An array of IExecutionItem instances to be executed.</param>
 /// <param name="manager">The IRuntimeManager with which to perform the underlying Absyntax
 /// project-loading and invocation activities.</param>
 public void Start(ExecutionMode mode, IExecutionItem[] items, IRuntimeManager manager)
 {
     Content.StartWhenFullyLoaded(mode, items, manager);
     ShowDialog();
 }
Esempio n. 11
0
 private TreeNode BuildTreeNode(IExecutionItem executionItem)
 {
     TreeNode node = new TreeNode(executionItem.ToString());
     node.Tag = executionItem;
     return node;
 }