예제 #1
0
        protected virtual void AddNewObject(LookUpEditEx lookup)
        {
            ShowViewParameters svp = new ShowViewParameters();
            IObjectSpace       newObjectViewObjectSpace = lookup.Properties.Helper.Application.CreateObjectSpace(lookup.Properties.Helper.LookupObjectTypeInfo.Type);
            object             newObject = newObjectViewObjectSpace.CreateObject(lookup.Properties.Helper.LookupObjectTypeInfo.Type);

            lookupObjectView = lookup.Properties.Helper.Application.CreateDetailView(newObjectViewObjectSpace, newObject, true);
            svp.CreatedView  = lookupObjectView;
            EventHandler committedEventHandler = (s, e) => {
                lookup.EditValue = lookup.Properties.Helper.ObjectSpace.GetObject(lookupObjectView.CurrentObject);
                if (lookup.Properties.DataSource != null)
                {
                    ((IList)lookup.Properties.DataSource).Add(lookup.EditValue);
                }
            };
            EventHandler disposedEventHandler = null;

            disposedEventHandler = (s, e) => {
                IObjectSpace os = (IObjectSpace)s;
                os.Disposed  -= disposedEventHandler;
                os.Committed -= committedEventHandler;
            };
            newObjectViewObjectSpace.Committed += committedEventHandler;
            newObjectViewObjectSpace.Disposed  += disposedEventHandler;
            lookup.Properties.Helper.Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
        }
예제 #2
0
        private void properties_Enter(object sender, EventArgs e)
        {
            LookUpEditEx lookup = (LookUpEditEx)sender;

            InitializeDataSource(lookup);
            UpdateButtons(lookup);
        }
예제 #3
0
 protected virtual void InitializeDataSource(LookUpEditEx lookup)
 {
     if (lookup != null && lookup.Properties != null && lookup.Properties.Helper != null)
     {
         lookup.InitializeDataSource();
     }
 }
        private void UpdateButtons(LookUpEditEx lookup)
        {
            bool enabled = (lookup.EditValue != null) && (lookup.EditValue != DBNull.Value);

            lookup.Properties.Buttons[1].Enabled = enabled;
            lookup.Properties.Buttons[3].Enabled = enabled;
        }
예제 #5
0
        protected virtual void OpenCurrentObject(LookUpEditEx lookup)
        {
            ShowViewParameters svp = new ShowViewParameters();
            IObjectSpace       openObjectViewObjectSpace = lookup.Properties.Helper.Application.CreateObjectSpace();
            object             targetObject = openObjectViewObjectSpace.GetObject(lookup.EditValue);

            if (targetObject != null)
            {
                EventHandler committedEventHandler = (s, e) => {
                    if (lookupObjectView != null)
                    {
                        lookup.EditValue = lookup.Properties.Helper.ObjectSpace.GetObject(lookupObjectView.CurrentObject);
                    }
                };
                EventHandler disposedEventHandler = null;
                disposedEventHandler = (s, e) => {
                    IObjectSpace os = (IObjectSpace)s;
                    os.Disposed  -= disposedEventHandler;
                    os.Committed -= committedEventHandler;
                };
                openObjectViewObjectSpace.Committed += committedEventHandler;
                openObjectViewObjectSpace.Disposed  += disposedEventHandler;
                lookupObjectView = lookup.Properties.Helper.Application.CreateDetailView(openObjectViewObjectSpace, targetObject, true);
                svp.CreatedView  = lookupObjectView;
                lookup.Properties.Helper.Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null));
            }
        }
예제 #6
0
 private void RefreshCore(LookUpEditEx lookup)
 {
     if (lookup != null)
     {
         UpdateButtons(lookup);
         lookup.RefreshEditValue();
         lookup.UpdateDisplayText();
         lookup.Refresh();
     }
 }
예제 #7
0
        private void properties_ButtonClick(object sender, ButtonPressedEventArgs e)
        {
            LookUpEditEx lookup = (LookUpEditEx)sender;
            string       tag    = Convert.ToString(e.Button.Tag);

            if (tag == OpenButtonTag)
            {
                OpenCurrentObject(lookup);
            }
            if (tag == MinusButtonTag)
            {
                ClearCurrentObject(lookup);
            }
            if (tag == AddButtonTag)
            {
                AddNewObject(lookup);
            }
        }
예제 #8
0
 protected virtual void ClearCurrentObject(LookUpEditEx lookup)
 {
     lookup.EditValue = null;
     DevExpress.ExpressApp.Win.Core.BindingHelper.EndCurrentEdit(lookup);
 }
예제 #9
0
        private void properties_Closed(object sender, ClosedEventArgs e)
        {
            LookUpEditEx lookup = (LookUpEditEx)sender;

            UpdateButtons(lookup);
        }
예제 #10
0
        private void properties_EditValueChanged(object sender, EventArgs e)
        {
            LookUpEditEx lookup = (LookUpEditEx)sender;

            UpdateButtons(lookup);
        }