Exemple #1
0
        protected override void OnAssetDataLoaded(CommeillFautAsset asset)
        {
            this._socialExchangeList       = new BindingListView <SocialExchangeDTO>((IList)null);
            gridSocialExchanges.DataSource = this._socialExchangeList;

            conditions = new ConditionSetView();
            conditionSetEditorControl.View = conditions;
            conditions.OnDataChanged      += ConditionSetView_OnDataChanged;


            this._socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();

            EditorTools.HideColumns(gridSocialExchanges, new[] {
                PropertyUtil.GetPropertyName <SocialExchangeDTO>(dto => dto.Id),
                PropertyUtil.GetPropertyName <SocialExchangeDTO>(dto => dto.StartingConditions)
            });



            if (this._socialExchangeList.Any())
            {
                var ra = LoadedAsset.GetSocialExchange(this._socialExchangeList.First().Id);
                UpdateConditions(ra);
            }
        }
Exemple #2
0
        private void influenceRules_Click(object sender, EventArgs e)
        {
            var selectedRule = EditorTools.GetSelectedDtoFromTable <SocialExchangeDTO>(gridSocialExchanges);
            var newSE        = new SocialExchange(selectedRule);
            var diag         = new InfluenceRuleInspector(LoadedAsset, newSE);

            diag.ShowDialog(this);
            LoadedAsset.UpdateSocialExchange(newSE.ToDTO);
            _socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();
            SetModified();
        }
Exemple #3
0
        private void buttonDuplicateSE_Click(object sender, EventArgs e)
        {
            var r = EditorTools.GetSelectedDtoFromTable <SocialExchangeDTO>(
                this.gridSocialExchanges);

            if (r != null)
            {
                r.Id = Guid.Empty;
                var newRuleId = LoadedAsset.AddOrUpdateExchange(r);
                _socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();
                EditorTools.HighlightItemInGrid <SocialExchangeDTO>(gridSocialExchanges, newRuleId);
            }
        }
Exemple #4
0
        private void buttonRemoveSE_Click(object sender, EventArgs e)
        {
            var selRows = gridSocialExchanges.SelectedRows;

            if (selRows.Count == 0)
            {
                return;
            }
            foreach (var r in selRows.Cast <DataGridViewRow>())
            {
                var dto = ((ObjectView <SocialExchangeDTO>)r.DataBoundItem).Object;
                LoadedAsset.RemoveSocialExchange(dto.Id);
            }
            _socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();
            EditorTools.HighlightItemInGrid <SocialExchangeDTO>(gridSocialExchanges, Guid.Empty);
            SetModified();
        }
Exemple #5
0
        private void auxAddOrUpdateItem(SocialExchangeDTO item)
        {
            var diag = new AddSocialExchange(LoadedAsset, item);

            diag.ShowDialog(this);
            if (diag.UpdatedGuid != Guid.Empty)
            {
                //  _socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();

                this._socialExchangeList.DataSource = LoadedAsset.GetAllSocialExchanges().ToList();



                EditorTools.HighlightItemInGrid <SocialExchangeDTO>
                    (gridSocialExchanges, diag.UpdatedGuid);
            }

            SetModified();
        }