示例#1
0
    public IndexViewModel(DFrameControllerExecutionEngine engine, IExecutionResultHistoryProvider historyProvider, IScopedPublisher <DrawerRequest> drawerProvider, ISynchronizedView <string, string> logView, ExecuteSettings?executeSettings = null)
    {
        this.historyProvider = historyProvider;
        this.drawerProvider  = drawerProvider;
        this.logView         = logView;

        SelectedWorkloadParameters          = Array.Empty <WorkloadParameterInfoViewModel>();
        ResultHistoryCount                  = historyProvider.GetCount();
        historyProvider.NotifyCountChanged += HistoryProvider_NotifyCountChanged;

        RefreshEngineProperties(engine);

        if (executeSettings != null)
        {
            CommandMode = executeSettings.CommandMode;
            if (executeSettings.Workload != null)
            {
                SelectedWorkload = executeSettings.Workload;
            }
            Concurrency  = executeSettings.Concurrency;
            TotalRequest = executeSettings.TotalRequest;
            if (executeSettings.WorkerLimit != null)
            {
                RequestWorkerLimit = executeSettings.WorkerLimit.Value;
            }
            IncreaseTotalRequestCount = executeSettings.IncreaseTotalRequestCount;
            IncreaseWorkerCount       = executeSettings.IncreaseWorkerCount;
            RepeatCount         = executeSettings.RepeatCount;
            DurationTimeSeconds = executeSettings.DurationTimeSeconds;
        }
    }
        public void AddChunk(ISynchronizedView view, int startAt, int count)
        {
            if (view == null || view.Record != m_store.Record)
            {
                throw new ArgumentException("view");
            }

            IList<ViewKey> keys = view.Keys.CollectViewKeysNeedingDownload(startAt, count);
            m_updateChunks.Add(new UpdateChunk { View = view, Keys = keys });
            m_typeVersions.AddRange(view.GetTypeVersions());
        }
        public void AddChunk(ISynchronizedView view, int startAt, int count)
        {
            if (view == null || view.Record != m_store.Record)
            {
                throw new ArgumentException("view");
            }

            IList <ViewKey> keys = view.Keys.CollectViewKeysNeedingDownload(startAt, count);

            m_updateChunks.Add(new UpdateChunk {
                View = view, Keys = keys
            });
            m_typeVersions.AddRange(view.GetTypeVersions());
        }
示例#4
0
    protected override void OnInitialized()
    {
        subscription = subscriber.Subscribe(async x =>
        {
            kind         = x.Kind;
            title        = x.Title;
            isShow       = x.IsShow;
            parameters   = x.Parameters;
            errorMessage = x.ErrorMessage;
            logView      = x.LogView;
            results      = x.Results;

            await InvokeAsync(StateHasChanged);
        });
    }
        async Task <ItemQuery> GetSyncQuery(ISynchronizedView view)
        {
            if (!view.IsStale(m_maxAgeInSeconds))
            {
                return(null);
            }

            SynchronizedType sType = view as SynchronizedType;

            if (sType != null && await sType.HasPendingChangesAsync())
            {
                return(null);
            }

            return(view.GetSynchronizationQuery());
        }
        async Task UpdateKeys(ISynchronizedView view, ItemQueryResult queryResult)
        {
            ViewKeyCollection keys = null;

            if (queryResult != null)
            {
                keys = ViewKeyCollection.FromQueryResult(queryResult);
            }
            else
            {
                keys = new ViewKeyCollection();
            }
            view.UpdateKeys(keys);

            SynchronizedType sType = view as SynchronizedType;

            if (sType != null)
            {
                await sType.SaveAsync();
            }
        }
示例#7
0
 protected override void OnInitialized()
 {
     logView = logRouter.GetView();
 }
        async Task UpdateKeys(ISynchronizedView view, ItemQueryResult queryResult)
        {
            ViewKeyCollection keys = null;
            if (queryResult != null)
            {
                keys = ViewKeyCollection.FromQueryResult(queryResult);
            }
            else
            {
                keys = new ViewKeyCollection();
            }
            view.UpdateKeys(keys);

            SynchronizedType sType = view as SynchronizedType;
            if (sType != null)
            {
                await sType.SaveAsync();
            }
        }
        async Task<ItemQuery> GetSyncQuery(ISynchronizedView view)
        {
            if (!view.IsStale(m_maxAgeInSeconds))
            {
                return null;
            }

            SynchronizedType sType = view as SynchronizedType;
            if (sType != null && await sType.HasPendingChangesAsync())
            {
                return null;
            }

            return view.GetSynchronizationQuery();
        }
 public static void AttachFilter <T, TView>(this ISynchronizedView <T, TView> source, Func <T, TView, bool> isMatch, Action <T, TView> whenTrue, Action <T, TView> whenFalse, Action <ChangedKind, T, TView> onCollectionChanged)
 {
     source.AttachFilter(new SynchronizedViewFilter <T, TView>(isMatch, whenTrue, whenFalse, onCollectionChanged));
 }
 public static void AttachFilter <T, TView>(this ISynchronizedView <T, TView> source, Func <T, TView, bool> isMatch, Action <T, TView> whenTrue, Action <T, TView> whenFalse)
 {
     source.AttachFilter(new SynchronizedViewFilter <T, TView>(isMatch, whenTrue, whenFalse, null));
 }
 public static void AttachFilter <T, TView>(this ISynchronizedView <T, TView> source, Func <T, TView, bool> filter)
 {
     source.AttachFilter(new SynchronizedViewFilter <T, TView>(filter, null, null, null));
 }
示例#13
0
 public NotifyCollectionChangedSynchronizedView(ISynchronizedView <T, TView> parent)
 {
     this.parent = parent;
     this.parent.RoutingCollectionChanged += Parent_RoutingCollectionChanged;
 }