public RootPlusDynamicIdItemPagesNavigator(NonNullList <NonBlankTrimmedString> parentSegments, IDispatcher dispatcher) : base(parentSegments, dispatcher) { if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } _getRoot = AddRelativeRoute( segments: NonNullList <string> .Empty, routeAction: new NavigateToRoot <T>(), urlGenerator: () => GetPath() ); _getItem = AddRelativeRoute( routeDetails: RouteBuilder.Empty.Fixed("item").String(), routeActionGenerator: matchedValue => new NavigateToItem <T>(matchedValue), urlGenerator: matchedValue => GetPath("item", matchedValue) ); _getItemSomething = AddRelativeRoute( routeDetails: RouteBuilder.Empty.Fixed("item").String().Int(), routeActionGenerator: (name, index) => new NavigateToItem <T>(name), urlGenerator: (name, index) => GetPath("item", name, index) ); }
public NavigatorTestingDetails(TNavigator navigator, IInteractWithBrowserRouting historyHandler, IDispatcher dispatcher, Assert assert) { if (navigator == null) { throw new ArgumentNullException("navigator"); } if (historyHandler == null) { throw new ArgumentNullException("historyHandler"); } if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } if (assert == null) { throw new ArgumentNullException("assert"); } _receivedNavigationActions = NonNullList <INavigationDispatcherAction> .Empty; dispatcher.Receive(action => { var navigationDispatcherAction = action as INavigationDispatcherAction; if (navigationDispatcherAction != null) { _receivedNavigationActions = _receivedNavigationActions.Add(navigationDispatcherAction); } }); _historyHandler = historyHandler; _assert = assert; _actionsConfirmedSoFar = 0; Navigator = navigator; }
public RootPlusHotelAndRestaurantSectionsNavigator(IDispatcher dispatcher) : base(NonNullList <NonBlankTrimmedString> .Empty, dispatcher) { if (dispatcher == null) { throw new ArgumentNullException("dispatcher"); } // This is the only route that this class directly creates.. _getRoot = AddRelativeRoute( segments: NonNullList <string> .Empty, routeAction: new NavigateToRoot(), urlGenerator: () => GetPath() ); // .. however it does also create some other navigators that will declare routes under the "hotel" section and the "restaurant" section // (and we'll need to add the routes that these navigators declare to this instance's total set of known routes() PullInRoutesFrom(Hotels = new RootPlusDynamicIdItemPagesNavigator <Hotel>( parentSegments: NonNullList.Of(new NonBlankTrimmedString("hotel")), dispatcher: dispatcher )); PullInRoutesFrom(Restaurants = new RootPlusDynamicIdItemPagesNavigator <Restaurant>( parentSegments: NonNullList.Of(new NonBlankTrimmedString("restaurant")), dispatcher: dispatcher )); }
private Html5HistoryRouter() { _navigatedCallbacks = NonNullList <Action <UrlDetails> > .Empty; LastNavigatedToUrl = null; Window.AddEventListener(EventType.PopState, e => RaiseNavigateToForCurrentLocation()); }
public ActionsRaisers(Resolution resolution, Layers layers, NonNullList <IActionConfigurationMouse> actionConfigurations) { if (resolution == null) { throw new ArgumentNullException(nameof(resolution)); } if (layers == null) { throw new ArgumentNullException(nameof(layers)); } if (actionConfigurations == null) { throw new ArgumentNullException(nameof(actionConfigurations)); } var controls = layers.Controls.CanvasElement; var actionsEvents = new Dictionary <int, IEvents>(); foreach (var action in actionConfigurations) { actionsEvents.Add(action.Id, new Events(resolution, action, controls, layers.Wrapper)); } Events = actionsEvents; controls.OnMouseDown = (e) => InputMouseDown(e); controls.OnMouseUp = (e) => InputMouseUp(e); controls.OnMouseMove = (e) => InputMouseMove(e); }
public Props(string className, NonNullList <SavedMessageDetails> messages ) { this.CtorSet(_ => _.ClassName, className); this.CtorSet(_ => _.Messages, messages); }
public ActionsRaisers(NonNullList <IActionConfiguration> actionConfigurations, NonNullList <IActionsRaisers> actionsRaisers) { if (actionConfigurations == null) { throw new ArgumentNullException(nameof(actionConfigurations)); } if (actionsRaisers == null) { throw new ArgumentNullException(nameof(actionsRaisers)); } var actionsEvents = new Dictionary <int, IEvents>(); foreach (var action in actionConfigurations) { actionsEvents.Add( action.Id, new Events( NonNullList.Of( actionsRaisers .SelectMany(actionsRaiser => actionsRaiser.Events) .Where(eventsDictionary => eventsDictionary.Key == action.Id) .Select(eventsDictionary => eventsDictionary.Value) .ToArray() ) ) ); } Events = actionsEvents; }
public void RegisterForNavigatedCallback(Action <UrlDetails> callback) { if (callback == null) { throw new ArgumentNullException("callback"); } _navigatedCallbacks = _navigatedCallbacks.Add(callback); }
public QueryString(NonNullList <Segment> segments) { if (segments == null) { throw new ArgumentNullException("segments"); } _segments = segments; }
private RouteBuilder(NonNullList <NonBlankTrimmedString> segments) { if (segments == null) { throw new ArgumentNullException("segments"); } _segments = segments; }
public Events(NonNullList <IEvents> eventsReaders) { if (eventsReaders == null) { throw new ArgumentNullException(nameof(eventsReaders)); } _eventsReaders = eventsReaders; }
private NavigateActionMatcher(NonNullList <Matcher> navigateActionMatchers) { if (navigateActionMatchers == null) { throw new ArgumentNullException("navigateActionMatchers"); } _navigateActionMatchers = navigateActionMatchers; }
internal DataPackagePropertySet() { _fileTypes = new Lazy <IList <string> >(() => { var fileTypes = new NonNullList <string>(); SetValue(fileTypes, false, nameof(FileTypes)); return(fileTypes); }); }
public ActionRaisers(NonNullList <IActionRaisers> actionsRaisers) { if (actionsRaisers == null) { throw new ArgumentNullException(nameof(actionsRaisers)); } _actionsRaisers = actionsRaisers; }
public MessageHistory( NonNullList <SavedMessageDetails> messages, string className ) : base(new Props( className, messages )) { }
public static Action GetAction(this NonNullList <Action> actions, int actionId) { var action = actions.Where(_ => _.Id == actionId).FirstOrDefault(); if (action == null) { throw new ArgumentNullException(nameof(action)); } return(action); }
private BuilderWithExtractedValues(NonNullList <IMatchSegments> segmentMatchers, Optional <Func <NonNullList <object>, TValues> > extractedValueBuilder) { if (segmentMatchers == null) { throw new ArgumentNullException("segmentMatchers"); } _segmentMatchers = segmentMatchers; _extractedValueBuilder = extractedValueBuilder; }
private Actions(Resolution resolution, Layers layers, NonNullList <IActionTouch> actionConfigurations) { var controls = layers.Controls.CanvasElement; controls.OnTouchEnd = OnTouchEndLeaveAndCancel; controls.OnTouchLeave = OnTouchEndLeaveAndCancel; controls.OnTouchCancel = OnTouchEndLeaveAndCancel; controls.OnTouchStart = (e) => { e.PreventDefault(); var touches = e.ChangedTouches; foreach (var touch in touches) { if (_currentTouches.ContainsKey(touch.Identifier)) { continue; } _currentTouches.Add( touch.Identifier, new DynamicPoint( resolution.GetEventX(layers.Wrapper, touch), resolution.GetEventY(layers.Wrapper, touch), resolution.RenderAmount(1) ) ); InputTouchDown(touch); } }; controls.OnTouchMove = (e) => { var touches = e.ChangedTouches; foreach (var touch in touches) { if (!_currentTouches.ContainsKey(touch.Identifier)) { continue; } _currentTouches.Get(touch.Identifier) .Reset( resolution.GetEventX(layers.Wrapper, touch), resolution.GetEventY(layers.Wrapper, touch) ); InputTouchMove(touch); } }; }
protected override State GetInitialState() { return(new State( inputValue: "", todos: NonNullList.Of( new TaskDetails(_nextAvailableId++, "Learn C#", done: true), new TaskDetails(_nextAvailableId++, "Learn React", done: false), new TaskDetails(_nextAvailableId++, "Build an awesome app with C# and React", done: false) ) )); }
public MockHistoryHandler(UrlDetails initialUrl) { if (initialUrl == null) { throw new ArgumentNullException("initialUrl"); } _navigatedCallbacks = NonNullList <Action <UrlDetails> > .Empty; CurrentLocation = initialUrl; LastNavigatedToUrl = null; }
public One(ICore core) { if (core == null) { throw new ArgumentNullException(nameof(core)); } _core = core; _core.Layers.Reset(NonNullList.Of(0)); _core.Layers.Controls.Clear(); }
public Level(ICore core) { if (core == null) { throw new ArgumentNullException(nameof(core)); } _core = core; _core.Layers.Reset(NonNullList.Of(0)); _core.ActivateActions(); _resourcePool = new ResourcePool(); }
public StaticRouteDetails(NonNullList <NonBlankTrimmedString> segments, Action <Optional <QueryString> > ifMatched) { if (segments == null) { throw new ArgumentNullException("segments"); } if (ifMatched == null) { throw new ArgumentNullException("ifMatched"); } _segments = segments; _ifMatched = ifMatched; }
public Touch(ICore core) { if (core == null) { throw new ArgumentNullException(nameof(core)); } _core = core; _core.Layers.Reset(NonNullList.Of(0)); _core.Layers.Controls.Clear(); _textBox = new TextBox("Touch", _core.Resolution.MultiplyClamp(10), _core.Resolution); _textBox.UpdatePosition(_core.Resolution.MultiplyClamp(4), _core.Resolution.MultiplyClamp(4)); }
public VariableRouteDetails(NonNullList <IMatchSegments> segmentMatchers, Optional <Func <NonNullList <object>, TValues> > extractedValueBuilder, Action <TValues, Optional <QueryString> > ifMatched) { if (segmentMatchers == null) { throw new ArgumentNullException("segmentMatchers"); } if (ifMatched == null) { throw new ArgumentNullException("ifMatched"); } _segmentMatchers = segmentMatchers; _extractedValueBuilder = extractedValueBuilder; _ifMatched = ifMatched; }
public RouteBuilder Fixed(NonNullList <NonBlankTrimmedString> segments) { if (segments == null) { throw new ArgumentNullException("segments"); } var newRouteBuilder = this; foreach (var segment in segments) { newRouteBuilder = newRouteBuilder.Fixed(segment); } return(newRouteBuilder); }
protected ArraySegmentation <Elements, BoxedVariable <Variable>, BoxedExpression> MaterializeArray <Elements>( APC postPC, ArraySegmentationEnvironment <Elements, BoxedVariable <Variable>, BoxedExpression> preState, Func <BoxedExpression, FlatAbstractDomain <bool> > CheckIfNonZero, Variable arrayValue, Elements initialValue, Elements bottom) where Elements : class, IAbstractDomainForArraySegmentationAbstraction <Elements, BoxedVariable <Variable> > { Contract.Requires(preState != null); Contract.Requires(initialValue != null); var boxSym = new BoxedVariable <Variable>(arrayValue); ArraySegmentation <Elements, BoxedVariable <Variable>, BoxedExpression> arraySegment; if (preState.TryGetValue(boxSym, out arraySegment)) { return(arraySegment); // already materialized } Variable array_Length; if (this.Context.ValueContext.TryGetArrayLength(postPC, arrayValue, out array_Length)) { var isNonEmpty = CheckIfNonZero(this.ToBoxedExpression(postPC, array_Length)).IsTrue(); var limits = new NonNullList <SegmentLimit <BoxedVariable <Variable> > >() { new SegmentLimit <BoxedVariable <Variable> >(NormalizedExpression <BoxedVariable <Variable> > .For(0), false), // { 0 } new SegmentLimit <BoxedVariable <Variable> >(NormalizedExpression <BoxedVariable <Variable> > .For(new BoxedVariable <Variable>(array_Length)), !isNonEmpty) // { symb.Length } }; var elements = new NonNullList <Elements>() { initialValue }; var newSegment = new ArraySegmentation <Elements, BoxedVariable <Variable>, BoxedExpression>( limits, elements, bottom, this.ExpressionManager); preState.AddElement(new BoxedVariable <Variable>(arrayValue), newSegment); return(newSegment); } return(null); }
public void Reset(NonNullList <int> ids) { if (ids == null) { throw new ArgumentNullException(nameof(ids)); } _stageLayers = NonNullList.Of(ids.Select(id => new Layer(_resolution, Wrapper, id)).ToArray()); // Build up new layers. _stageWrapper.InnerHTML = ""; // reset HTML (there is no event listeners on the children, so this should be fine. foreach (var layer in _stageLayers) { _stageWrapper.AppendChild(layer.CanvasElement); } Resize(true); // There is a chance that the window dimensions have not changed, so force the resize, otherwise it would exit early. }
public static void NoOptDeserializationWorks() { var items = new NonNullList <KeyValuePairDataModelBase>(new KeyValuePairDataModelBase[] { new KeyValuePairDataModel(), new AlternativeKeyValuePairDataModel() }); var settings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.Objects }; var json = JsonConvert.SerializeObject(items, settings); var cloneAsArray = JsonConvert.DeserializeObject <NonNullList <KeyValuePairDataModelBase> >(json, settings).ToArray(); Assert.AreEqual(2, cloneAsArray.Length, "Non-optimized deserialization length"); Assert.AreEqual(typeof(KeyValuePairDataModel), cloneAsArray[0].GetType(), "Non-optimized deserialization index 0 data type"); Assert.AreEqual(typeof(AlternativeKeyValuePairDataModel), cloneAsArray[1].GetType(), "Non-optimized deserialization index 1 data type"); }
public Zoom(ICore core) { if (core == null) { throw new ArgumentNullException(nameof(core)); } _core = core; _core.Layers.Reset(NonNullList.Of(0)); _core.DeactivateActions(); _core.ActivateActions(NonNullList.Of( DefaultActions.Up, DefaultActions.Left, DefaultActions.Down, DefaultActions.Button1 )); _resourcePool = new ResourcePool(); }
private Program([NotNull] Program program, [NotNull] ProgramFragment new_data) { _declarations = program._declarations.Concat(new_data.declarations) .ToNonNullList(); }
public FeatureSpecification([NotNull] string feature, [NotNull] IEnumerable<Node> body) { _body = body.without_nulls() .ToNonNullList(); this.feature = feature; }
public void init() { _orcs = new NonNullList<OrcishRaidProgress>(); _all_orcs_are_sent = new ManualResetEventSlim(false); _target_number_of_orcs = 0; }
private Program() { _declarations = new NonNullList<Declaration>(); }