public void Visit(ICustomAction customAction) { if (customAction.ActionId == null) { throw new ContextConfigurationException("ICustomAction without definition of 'ActionId' found"); } }
public OptionalAction(string resourceKey, IBatchAlterModel model, ICustomAction[] options) { ResourceKey = resourceKey; AlterType = model.Category; Model = model; Options = options; SelectedItem = Options.FirstOrDefault(); }
public TaskState(bool isSingle, ICustomAction action, State initialState = default(State)) { _stateMachine = new StateMachine <State, Trigger>(initialState); _stateMachine.PickingAddConfiguration(isSingle, action); _stateMachine.SortingAddConfiguration(isSingle); _stateMachine.Configure(State.Packing) .Permit(Trigger.Move, State.Loading); _stateMachine.Configure(State.Loading) .Ignore(Trigger.Move); }
public CustomActionDispatcher(IErrorProcessor?errorProcessor, ICustomAction customAction, IFactoryContext factoryContext) { _errorProcessor = errorProcessor; _customAction = customAction; _factoryContext = factoryContext; Infra.NotNull(customAction.XmlNamespace); Infra.NotNull(customAction.XmlName); Infra.NotNull(customAction.Xml); }
public static Result<ICustomAction> CloneAction(ICustomAction action) { var res = new Result<ICustomAction>(); try { res.Value = (ICustomAction)HierarchicalObjectCrutch.CloneObject(action); } catch (Exception e) { res.AddWarning(new Warning(e.Message), true); } return res; }
private void CreateButtonAndAddToPanel(ICustomAction customAction) { var button = new Button { Text = customAction.Name, AutoSizeMode = AutoSizeMode.GrowAndShrink, AutoSize = true }; button.Click += new EventHandler(customAction.Execute); panelCustomActions.Controls.Add(button); }
public static Result<string> SafeExecute(ICustomAction action) { var result = new Result<string>(); try { result.Value = action.Do(action.State); } catch (Exception e) { result.AddException(e); } return result; }
public DefaultCustomActionEvaluator(ICustomAction customAction) { _customAction = customAction; var customActionDispatcher = customAction.As <ICustomActionDispatcher>(); Infra.NotNull(customActionDispatcher, Resources.Assertion_CustomActionDoesNotConfigured); var locations = customAction.Locations.AsArrayOf <ILocationExpression, ILocationEvaluator>(true); var values = customAction.Values.AsArrayOf <IValueExpression, IValueEvaluator>(true); customActionDispatcher.SetEvaluators(locations, values); _customActionDispatcher = customActionDispatcher; }
public EcmaScriptCustomActionEvaluator(ICustomAction customAction) : base(customAction) { }
public void Visit(ICustomAction customAction) { }
private void HandleOtherTouchOption(object?sender, TouchOptions e) { ICustomAction action = e == TouchOptions.OtherL ? SettingsProvider.Instance.CustomActionLeft : SettingsProvider.Instance.CustomActionRight; switch (action.Action) { case CustomAction.Actions.Event: EventDispatcher.Instance.Dispatch(Enum.Parse <EventDispatcher.Event>(action.Parameter), true); break; case CustomAction.Actions.RunExternalProgram: try { var psi = new ProcessStartInfo { FileName = action.Parameter, UseShellExecute = true }; Process.Start(psi); } catch (FileNotFoundException ex) { new MessageBox() { Title = "Custom long-press action failed", Description = $"Unable to launch external application.\n" + $"File not found: '{ex.FileName}'" }.Show(this); } catch (Win32Exception ex) { if (ex.NativeErrorCode == 13 && PlatformUtils.IsLinux) { new MessageBox() { Title = "Custom long-press action failed", Description = $"Unable to launch external application.\n\n" + $"Insufficient permissions. Please add execute permissions for your user/group to this file.\n\n" + $"Run this command in a terminal: chmod +x \"{action.Parameter}\"" }.Show(this); } else { new MessageBox() { Title = "Custom long-press action failed", Description = $"Unable to launch external application.\n\n" + $"Detailed information:\n\n" + $"{ex.Message}" }.Show(this); } } break; case CustomAction.Actions.TriggerHotkey: var keys = new List <Key>(); try { keys.AddRange(action.Parameter.Split(',').Select(Enum.Parse <Key>)); } catch (Exception ex) { Log.Error("CustomAction.HotkeyBroadcast: Cannot parse saved key-combo: " + ex.Message); Log.Error("CustomAction.HotkeyBroadcast: Caused by combo: " + action.Parameter); return; } HotkeyBroadcastImpl.Instance.SendKeys(keys); break; } }
public CustomActionNode(DocumentIdNode documentIdNode, ICustomAction customAction) : base(documentIdNode, customAction) { Infra.NotNull(customAction.Xml); _customAction = customAction; }
public static Stateless.StateMachine <State, Trigger> .StateConfiguration SortingAddConfiguration(this StateMachine <State, Trigger> pickingConfiguration, bool isSingle, ICustomAction action) { var t = pickingConfiguration.Configure(State.Sorting) .Permit(Trigger.Move, State.Packing) .OnExit(x => action.OnExit("exit 2")) .OnEntry(x => action.OnEntry("message 2")); return(t); }
public static Stateless.StateMachine <State, Trigger> .StateConfiguration PickingAddConfiguration(this StateMachine <State, Trigger> pickingConfiguration, bool isSingle, ICustomAction action) { var customAction = new CustomAction(); Console.WriteLine(DateTime.Now); var t = pickingConfiguration.Configure(State.Picking) .PermitIf(Trigger.Move, State.Sorting, () => !isSingle) .PermitIf(Trigger.Move, State.Packing, () => isSingle) .OnExit(x => action.OnExit("exit 1")) .OnEntry(x => action.OnEntry("message 1")); return(t); }