예제 #1
0
 private void BasePanel_Load(object sender, EventArgs e)
 {
     if (!WinUtils.IsComponentInDesignMode(this))
     {
         VisitOwnControls(null, null, new VisitControlFunction[] { AttachEditValueChangedEvent });
     }
 }
예제 #2
0
        private void Init()
        {
            if (Parent == null)
            {
                return;
            }
            if (WinUtils.IsComponentInDesignMode(Parent))
            {
                return;
            }
            m_View = FindTraslationTool(Parent);
            if (m_View == null)
            {
                return;
            }

            m_PopupActions = new PopupMenu {
                Manager = BaseFormManager.MainBarManager ?? new BarManager()
            };
            m_PopupActions.BeforePopup += OnBeforePopup;
            DropDownControl             = m_PopupActions;
            Click                   += ExecDefaultAction;
            m_BtnDesignMode          = AddAction("Design", SwitchToDesignMode);
            m_BtnShowTranslationTool = AddAction("Show All Form Translations", ShowTranslationTool);
            m_BtnCancel              = AddAction("Cancel Changes", CancelChanges);
            m_BtnSave                = AddAction("Save Changes", CancelChanges);
            m_BtnShowHidden          = AddAction("Show Hidden Controls", ShowHiddenControls);
            m_BtnUndo                = AddAction("Undo", Undo);
            m_TranslateButtons       = new List <BarButtonItem>();
            SetButtonsState(false);
        }
예제 #3
0
 public void DisplayLayout()
 {
     if (!m_LayoutDisplaying && !WinUtils.IsComponentInDesignMode(this) && Parent != null)
     {
         m_LayoutDisplaying = true;
         try
         {
             //if (control.Parent == panelMain)
             {
                 AnchorStyles anchor      = Anchor;
                 DockStyle    dock        = Dock;
                 Size         size        = Size;
                 Point        location    = Location;
                 Control      parentCtl   = Parent;
                 var          layoutGroup = (LayoutGroup)GetLayout();
                 var          layout      = (Control)layoutGroup;
                 parentCtl.Controls.Add(layout);
                 layout.Location = location;
                 layout.Size     = size;
                 layout.Anchor   = anchor;
                 layout.Dock     = dock;
             }
         }
         finally
         {
             m_LayoutDisplaying = false;
         }
     }
 }
예제 #4
0
        private void OnQueryDisplayText(object sender, QueryDisplayTextEventArgs e)
        {
            //if (Closing)
            //{
            //    return;
            //}
            if (WinUtils.IsComponentInDesignMode(sender as Component) || m_repositoryPopupEdit != null || PopupControl == null)
            {
                return;
            }
            e.DisplayText = PopupControl.GetDisplayText();
            var popupEdit = sender as PopupContainerEdit;

            if (m_DisplayTextInternal != e.DisplayText)
            {
                m_DisplayTextInternal = e.DisplayText;
                if (popupEdit != null)
                {
                    popupEdit.ToolTip = e.DisplayText;
                }
                //if (OnDisplayTextChangedEvent != null)
                //    OnDisplayTextChangedEvent(this, EventArgs.Empty);
            }
            if (popupEdit != null)
            {
                popupEdit.Text = e.DisplayText;
            }
        }
예제 #5
0
 private void BasePanel_VisibleChanged(object sender, EventArgs e)
 {
     if (WinUtils.IsComponentInDesignMode(this) || BaseSettings.ScanFormsMode)
     {
         return;
     }
     if (Visible && !m_ReadonlyStateUpdated)
     {
         DisplayReadOnly(false);
     }
 }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 public BasePanel()
 {
     InitializeComponent();
     if (WinUtils.IsComponentInDesignMode(this))
     {
         return;
     }
     LifeTimeState = LifeTimeState.NotInitialized;
     InitRoutines();
     SetStyle(ControlStyles.AllPaintingInWmPaint, true);
     SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
 }
예제 #7
0
 public BaseGridPanel()
 {
     InitializeComponent();
     if (WinUtils.IsComponentInDesignMode(this))
     {
         return;
     }
     BusinessObject = TypeAccessor.CreateInstanceEx <T>();
     if (Permissions != null)
     {
         m_ReadOnly = Permissions.IsReadOnlyForEdit;
     }
     Init();
 }
예제 #8
0
 /// <summary>
 /// </summary>
 /// <param name="id"></param>
 /// <param name="hAcode"></param>
 public override void LoadData(ref object id, int?hAcode = null)
 {
     if (WinUtils.IsComponentInDesignMode(this))
     {
         return;
     }
     using (DbManagerProxy manager = CreateDbManagerProxy())
     {
         IObjectSelectDetailList accessor = ObjectAccessor.SelectDetailListInterface(typeof(T));
         if (accessor != null)
         {
             LifeTimeState = LifeTimeState.DataLoading;
             SetDataSource(null, new EditableList <T>());
             DataSource.AddRange(accessor.SelectDetailList(manager, id, hAcode));
             Grid.GridControl.DataSource = DataSource;
         }
     }
 }
예제 #9
0
        public BaseListPanel()
        {
            InitializeComponent();
            if (WinUtils.IsComponentInDesignMode(this))
            {
                return;
            }
            DataSource = new List <T>();
            Grid.GridView.OptionsMenu.EnableColumnMenu      = true;
            Grid.GridView.OptionsMenu.EnableGroupPanelMenu  = false;
            Grid.GridView.OptionsMenu.EnableFooterMenu      = false;
            Grid.GridView.OptionsMenu.ShowAutoFilterRowItem = false;
            var bvGridControl = Grid.GridControl as BvGridControl;

            if (bvGridControl != null)
            {
                bvGridControl.AllowCustomization = true;
            }
            ParentChanged += BaseListPanel_ParentChanged;
            //LoadGridLayout();
            //Grid.GridView.PopupMenuShowing += OnGridViewPopupMenuShowing;
            //Grid.GridView.ShowCustomizationForm += OnShowCustomizationForm;
            //Grid.GridView.DragObjectOver += OnDragObjectOver;
        }
예제 #10
0
        public override void Refresh()
        {
            if (WinUtils.IsComponentInDesignMode(this))
            {
                return;
            }

            try
            {
                using (new WaitDialog(WaitDialogType.FormLoading))
                {
                    using (var manager = CreateDbManagerProxy())
                    {
                        var          accessor = ObjectAccessor.SelectListInterface(typeof(T));
                        FilterParams filter;
                        if (SearchPanel == null || !SearchPanelVisible)
                        {
                            filter = StaticFilter;
                        }
                        else
                        {
                            var pars = SearchPanel.Parameters;
                            filter = pars == null
                                         ? StaticFilter
                                         : pars.Merge(StaticFilter);
                        }

                        var selectedList = accessor.SelectList(manager, filter);
                        DataSource = selectedList.Cast <T>().ToList();
                        HidePersonalData(DataSource);

                        var oldObj       = m_ListGridControl.GridView.GetFocusedRow() as IObject;
                        var oldRowHandle = m_ListGridControl.GridView.FocusedRowHandle;

                        m_ListGridControl.GridView.BeginSelection();

                        Grid.GridControl.DataSource = DataSource;
                        //var bs = new BindingSource();
                        //bs.DataSource = DataSource;
                        //Grid.GridControl.DataSource = bs;

                        var newRowHandle = m_ListGridControl.GridView.FocusedRowHandle;

                        if ((oldObj != null) && (oldRowHandle >= 0))
                        {
                            var fo    = selectedList.FirstOrDefault(m => (long)m.Key == (long)oldObj.Key);
                            var index = selectedList.IndexOf(fo);
                            if (index >= 0)
                            {
                                var oh = m_ListGridControl.GridView.GetRowHandle(index);
                                m_ListGridControl.GridView.FocusedRowHandle = oh;
                                m_ListGridControl.GridView.ClearSelection();
                                m_ListGridControl.GridView.SelectRow(oh);
                            }
                        }

                        m_ListGridControl.GridView.EndSelection();

                        if (oldRowHandle == newRowHandle)
                        {
                            // call handler manually because FocusedRowChanged not fired when when oldRowHandle == newRowHandle
                            GridView_FocusedRowChanged(this, new FocusedRowChangedEventArgs(oldRowHandle, newRowHandle));
                        }
                        if ((!BaseSettings.IgnoreTopMaxCount) && (DataSource.Count == BaseSettings.SelectTopMaxCount))
                        {
                            ErrorForm.ShowWarning("msgTooBigRecordsCount",
                                                  "Number of returned records is too big. Not all records are shown on the form. Please change search criteria and try again");
                        }
                        // NOTE: uncommented in 5-th version because of new requirenemt
                        //"https://repos.btrp.net/BTRP/Project_Documents/10x-Business Analysis/01 Human module/01.006 The Number of Records on Human Cases and Vet Cases List forms.doc"
                        long?totalCount = accessor.SelectCount(manager);
                        m_ListGridControl.ShowTotal(DataSource.Count, totalCount);
                    }
                }
            }
            catch (DbModelTimeoutException)
            {
                ErrorForm.ShowWarning("msgTimeoutList",
                                      "Cannot retrieve records from database because of the timeout. Please change search criteria and try again");
            }
            catch (DbModelException ex1)
            {
                if (string.IsNullOrEmpty(ex1.MessageId))
                {
                    ErrorForm.ShowError(ex1.Message, ex1);
                }
                else
                {
                    ErrorForm.ShowError(ex1.MessageId, ex1.Message, ex1);
                }
            }
            catch (Exception ex)
            {
                ErrorForm.ShowError(ex.Message, ex);
            }
        }