bool IsActive(ChoiceActionItem choiceActionItem) { var xpoStateMachine = (choiceActionItem.Data as IStateMachine); if (xpoStateMachine != null) { var boolList = new BoolList(true, BoolListOperatorType.Or); boolList.BeginUpdate(); foreach (var item in choiceActionItem.Items) { var xpoTransition = ((XpoTransition)item.Data); var choiceActionItemArgs = new ChoiceActionItemArgs(xpoTransition, item.Active); OnRequestActiveState(choiceActionItemArgs); boolList.SetItemValue(xpoTransition.Oid.ToString(), item.Active.ResultValue); } boolList.EndUpdate(); return(boolList.ResultValue); } var transition = choiceActionItem.Data as XpoTransition; if (transition != null) { var choiceActionItemArgs = new ChoiceActionItemArgs(transition, choiceActionItem.Active); OnRequestActiveState(choiceActionItemArgs); return(choiceActionItem.Active); } throw new NotImplementedException(); }
public static BoolList Clone(this BoolList boolList) { var list = new BoolList(); foreach (var key in boolList.GetKeys()) { list.SetItemValue(key, boolList[key]); } return(list); }
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); }
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]); } } } }
void SyncStates(string id, BoolList boolList, Dictionary <string, BoolList> boolLists) { if (boolLists.ContainsKey(id)) { var list = boolLists[id]; boolList.BeginUpdate(); if (list.GetKeys().FirstOrDefault() != null) { boolList.Clear(); foreach (var key in list.GetKeys()) { boolList.SetItemValue(key, list[key]); } } boolList.EndUpdate(); } }
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); }