Exemplo n.º 1
0
        /// <summary>The setup cross ref options. Called from Process Builder.</summary>
        /// <param name="vm">The SimpleFilterViewModel.</param>
        /// <param name="model">The model.</param>
        public void SetupCrossRefOptions(SimpleFilterViewModel vm, ProcessEdit model)
        {
            if (vm == null || model == null || vm.SelectedMember == null)
            {
                return;
            }

            var propertyDefinition = (FieldPathPropertyDefinition)vm.SelectedMember.ItemPropertyDefinition;
            if (propertyDefinition.ColumnType != ColumnTypes.Reference && propertyDefinition.ColumnType != ColumnTypes.MultiReference)
            {
                return;
            }

            IsPublished = false;

            if (propertyDefinition.PropertyName == Constants.CurrentStateGuidColumnName)
            {
                var states = new CustomInfoList();
                states.AddRange(
                    model.StateList.OrderBy(s => s.Name).Select(state => new StateInfoClass { Id = state.Id, Name = state.Name, Guid = state.Guid }));

                FilteringProcessSystemName = null;
                CrossRefDisplayFieldsList = Constants.Name;
                CrossRefItems = states;
                CrossRefProcessName = Constants.StateProcessName;
                CrossRefAllowMultiple = false;

                return;
            }

            CrossRefFieldName = propertyDefinition.SystemName;
            CrossRefDisplayFieldsList = propertyDefinition.ReferencedFieldSystemName;
            CrossRefAllowMultiple = propertyDefinition.AllowMultiple;
            CrossRefProcessName = propertyDefinition.ReferencedProcessSystemName;
        }
Exemplo n.º 2
0
        private static IEnumerable<ILayoutInfo> GetDistinctLayouts(IInfoList<ILayoutInfo> layouts)
        {
            var distinctLayouts = new List<ILayoutInfo>(layouts);

            foreach (var item in
                layouts.Where(info => info.AccountId != 0)
                       .Select(info => layouts.FirstOrDefault(x => x.AccountId == 0 && x.Name == info.Name))
                       .Where(item => item != null))
            {
                distinctLayouts.Remove(item);
            }

            return distinctLayouts;
        }
Exemplo n.º 3
0
        /// <summary>
        /// The clean up.
        /// </summary>
        public void CleanUp()
        {
            filter = null;
            IsStaticValue = true;
            this.IsUdp = false;
            IsSystemVariable = false;
            IsProcessField = false;

            UserDefinedCaption = null;
            DefaultValue = null;
            Value.ProvidedValue = DefaultValue;
            SelectedProcessField = null;
            SelectedSystemVariable = null;
            SelectedSystemParameters = null;

            CrossRefProcessName = null;
            CrossRefFieldName = null;
            CrossRefDisplayFieldsList = null;
            CrossRefAllowMultiple = false;
            CrossRefItems = null;
            RefCrossRefFieldName = null;
            IsRefCrossRef = false;

            FilteringProcessSystemName = null;

            ShowProcessFields = false;
            ShowUdPs = false;
            ShowSystemParameters = true;
        }
Exemplo n.º 4
0
        public async Task<bool> Activate()
        {
            try
            {
                await _syncer.WaitAsync();
                if (_isDisposed)
                    return false;

                //処理の最初に置くことでConnect()後はストリームの休止状態が終了している事を保証させる
                _isPause = false;
                //接続処理
                switch (Status)
                {
                    case StreamStateType.UnLoaded:
                        //読み込み
                        Status = StreamStateType.Initing;
                        _activityGetter = _circle.GetActivities();
                        var activities = await _activityGetter.TakeAsync(20);

                        //更新
                        var outerActiveActivities = _isPause ? _hiddenActivities : _activities;
                        outerActiveActivities.Clear();
                        foreach (var item in activities)
                        {
                            var post = new Activity(item);
                            outerActiveActivities.Add(post);
                            await post.Activate();
                        }

                        //受信開始
                        Status = StreamStateType.Connected;
                        _streamObj = _circle.GetStream().Subscribe(Recieved_Activity,
                            async ex =>
                            {
                                try
                                {
                                    await _syncer.WaitAsync().ConfigureAwait(false);
                                    _streamObj.Dispose();
                                    _streamObj = null;
                                    Status = StreamStateType.UnLoaded;
                                }
                                finally { _syncer.Release(); }
                            },
                            async () =>
                            {
                                try
                                {
                                    await _syncer.WaitAsync().ConfigureAwait(false);
                                    _streamObj.Dispose();
                                    _streamObj = null;
                                    Status = StreamStateType.UnLoaded;
                                }
                                finally { _syncer.Release(); }
                            });
                        break;
                    case StreamStateType.Paused:
                        Status = StreamStateType.Connected;
                        if (ChangedActivityCount > 0)
                        {
                            int hIdx, aIdx;
                            for (hIdx = 0; hIdx < _hiddenActivities.Count; hIdx++)
                                if ((aIdx = _activities.IndexOf(_hiddenActivities[hIdx])) < 0)
                                    _activities.Insert(hIdx, _hiddenActivities[hIdx]);
                                else if (aIdx != hIdx)
                                    _activities.Move(aIdx, hIdx);
                            for (aIdx = _activities.Count - 1; aIdx >= hIdx; aIdx--)
                            {
                                _activities[aIdx].Dispose();
                                _activities.RemoveAt(aIdx);
                            }
                        }
                        //一時停止が終わったらActivityのGC解放のためにも消す
                        _hiddenActivities = null;
                        break;
                }
                return true;
            }
            catch (FailToOperationException)
            {
                Status = StreamStateType.UnLoaded;
                return false;
            }
            finally { _syncer.Release(); }
        }