Beispiel #1
0
 void RestoreStates(ActionBase action, BoolList boolList, Dictionary <string, BoolList> boolLists)
 {
     if (boolLists.ContainsKey(action.Id))
     {
         BoolList enabledBoolList = boolLists[action.Id];
         if (enabledBoolList.GetKeys().FirstOrDefault() != null)
         {
             boolList.Clear();
             foreach (var key in enabledBoolList.GetKeys())
             {
                 boolList.SetItemValue(key, enabledBoolList[key]);
             }
         }
     }
 }
Beispiel #2
0
 static void StoreStatesCore(ActionBase actionBase, Dictionary <string, BoolList> boolLists, BoolList boolList)
 {
     boolLists[actionBase.Id] = new BoolList();
     foreach (var key in boolList.GetKeys())
     {
         boolLists[actionBase.Id].SetItemValue(key, boolList[key]);
     }
 }
 void CloneBoolList(string id, BoolList boolList, Dictionary <string, BoolList> boolLists)
 {
     boolLists[id] = new BoolList();
     boolLists[id].BeginUpdate();
     foreach (var key in boolList.GetKeys())
     {
         boolLists[id].SetItemValue(key, boolList[key]);
     }
     boolLists[id].EndUpdate();
 }
Beispiel #4
0
        public static BoolList Clone(this BoolList boolList)
        {
            var list = new BoolList();

            foreach (var key in boolList.GetKeys())
            {
                list.SetItemValue(key, boolList[key]);
            }

            return(list);
        }
Beispiel #5
0
        public static bool DoTheExecute(this ActionBase actionBase, bool force = false)
        {
            BoolList active = null;
            BoolList enable = null;

            if (force && (!actionBase.Active || !actionBase.Enabled))
            {
                active = actionBase.Active.Clone();
                enable = actionBase.Enabled.Clone();
                if (!actionBase.Active)
                {
                    actionBase.Active.Clear();
                }
                if (!actionBase.Enabled)
                {
                    actionBase.Enabled.Clear();
                }
            }
            if (!actionBase.Active || !actionBase.Enabled)
            {
                return(false);
            }
            var simpleAction = actionBase as SimpleAction;

            simpleAction?.DoExecute();
            var singleChoiceAction = actionBase as SingleChoiceAction;

            singleChoiceAction?.DoExecute(singleChoiceAction.SelectedItem);

            var popupWindowShowAction = actionBase as PopupWindowShowAction;

            popupWindowShowAction?.DoExecute((Window)popupWindowShowAction.Controller.Frame);

            var parametrizedAction = actionBase as ParametrizedAction;

            parametrizedAction?.DoExecute(parametrizedAction.Value);
            if (active != null)
            {
                foreach (var key in active.GetKeys())
                {
                    active.SetItemValue(key, active[key]);
                }
            }
            if (enable != null)
            {
                foreach (var key in enable.GetKeys())
                {
                    enable.SetItemValue(key, enable[key]);
                }
            }
            return(true);
        }
Beispiel #6
0
        void SyncState(ActionBase actionBase, BoolList sender, Func <ActionBase, BoolList> func, Dictionary <GridView, Dictionary <string, BoolList> > childBoolLists)
        {
            if (View == null || !IsMasterDetail)
            {
                return;
            }
            var gridControl = (View.Editor.Control as GridControl);

            if (gridControl == null)
            {
                return;
            }
            var xpandXafGridView = gridControl.MainView as XpandXafGridView;

            if (xpandXafGridView == null)
            {
                return;
            }

            Frame masterFrame = xpandXafGridView.MasterFrame;

            if (masterFrame != null)
            {
                BoolList boolList = GetBoolList(masterFrame, actionBase, func);
                if (sender.GetKeys().FirstOrDefault() != null)
                {
                    var activeChildBool = new BoolList();
                    var focusedView     = (GridView)GridListEditor.Grid.FocusedView;
                    var childBoolList   = GetChildBoolList(childBoolLists, focusedView);
                    childBoolList[actionBase.Id] = activeChildBool;
                    boolList.Clear();
                    foreach (var key in sender.GetKeys())
                    {
                        boolList.SetItemValue(key, sender[key]);
                        activeChildBool.SetItemValue(key, sender[key]);
                    }
                }
            }
        }
        public static bool DoTheExecute(this ActionBase actionBase, bool force = false)
        {
            BoolList active = null;
            BoolList enable = null;

            if (force && (!actionBase.Active || !actionBase.Enabled))
            {
                active = actionBase.Active.Clone();
                enable = actionBase.Enabled.Clone();
                if (!actionBase.Active)
                {
                    actionBase.Active.Clear();
                }
                if (!actionBase.Enabled)
                {
                    actionBase.Enabled.Clear();
                }
            }
            if (!actionBase.Active || !actionBase.Enabled)
            {
                return(false);
            }
            var simpleAction = actionBase as SimpleAction;

            simpleAction?.DoExecute();
            var singleChoiceAction = actionBase as SingleChoiceAction;

            singleChoiceAction?.DoExecute(singleChoiceAction.SelectedItem ?? singleChoiceAction.Items.FirstOrDefault());

            if (actionBase is PopupWindowShowAction popupWindowShowAction)
            {
                if (popupWindowShowAction.Application.GetPlatform() == Platform.Win)
                {
                    var helper = (IDisposable)Activator.CreateInstance(AppDomain.CurrentDomain.GetAssemblyType("DevExpress.ExpressApp.Win.PopupWindowShowActionHelper"), popupWindowShowAction);
                    var view   = actionBase.View();
                    void OnClosing(object sender, EventArgs args)
                    {
                        helper.Dispose();
                        view.Closing -= OnClosing;
                    }

                    view.Closing += OnClosing;
                    helper.CallMethod("ShowPopupWindow");
                }
                else
                {
                    popupWindowShowAction?.DoExecute((Window)popupWindowShowAction.Controller.Frame);
                }
            }

            var parametrizedAction = actionBase as ParametrizedAction;

            parametrizedAction?.DoExecute(parametrizedAction.Value);
            if (active != null)
            {
                foreach (var key in active.GetKeys())
                {
                    active.SetItemValue(key, active[key]);
                }
            }
            if (enable != null)
            {
                foreach (var key in enable.GetKeys())
                {
                    enable.SetItemValue(key, enable[key]);
                }
            }
            return(true);
        }