public static void UpdateValue(this UIStepper nativeStepper, IStepper stepper) { if (nativeStepper.Value != stepper.Value) { nativeStepper.Value = stepper.Value; } }
public override void OnApplyTemplate() { // read the Orientation of the Stepper and set it as the Mode // - changing the Layout throws the UI of the Stepper and builds a new one // - therefore this method will be called for a new instance and the changes of the Layout will be applied to Mode IStepper stepper = FindStepper(); if (stepper != null) { if (stepper is TabControlStepper) { BackCommand = TabControlStepper.BackCommand; CancelCommand = TabControlStepper.CancelCommand; ContinueCommand = TabControlStepper.ContinueCommand; } else { BackCommand = Stepper.BackCommand; CancelCommand = Stepper.CancelCommand; ContinueCommand = Stepper.ContinueCommand; } } base.OnApplyTemplate(); }
public static void UpdateValue(this UIStepper platformStepper, IStepper stepper) { if (platformStepper.Value != stepper.Value) { platformStepper.Value = stepper.Value; } }
LazyTransformer(IPersistentMap meta, object first, LazyTransformer rest) : base(meta) { _stepper = null; _first = first; _rest = rest; }
Task ValidateHasColor(IStepper stepper, Color color, Action action = null) { return(InvokeOnMainThreadAsync(() => { var nativeStepper = GetNativeStepper(CreateHandler(stepper)); action?.Invoke(); nativeStepper.AssertContainsColor(color); })); }
public static void UpdateIncrement(this UIStepper nativeStepper, IStepper stepper) { var increment = stepper.Step; if (increment > 0) { nativeStepper.StepValue = stepper.Step; } }
public static void UpdateIncrement(this UIStepper platformStepper, IStepper stepper) { var increment = stepper.Interval; if (increment > 0) { platformStepper.StepValue = stepper.Interval; } }
public static void UpdateIncrement(this Spinner nativeStepper, IStepper stepper) { var increment = stepper.Interval; if (increment > 0) { nativeStepper.LabelFormat = string.Format("%.{0}f", GetRequiredPrecision(increment)); nativeStepper.Step = stepper.Interval; } }
public static void UpdateBackground(this MauiStepper nativeStepper, IStepper stepper) { var background = stepper?.Background; if (background == null) { return; } nativeStepper.ButtonBackground = background.ToNative(); }
public static void UpdateBackground(this MauiStepper platformStepper, IStepper stepper) { var background = stepper?.Background; if (background == null) { return; } platformStepper.ButtonBackground = background.ToPlatform(); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null) { throw new ArgumentNullException(nameof(values)); } IStepper stepper = values[0] as IStepper; FrameworkElement element = values[1] as FrameworkElement; StepperStepViewModel stepViewModel = values[2] as StepperStepViewModel; return(_iconTemplateSelector.SelectTemplate(stepper, element, stepViewModel)); }
public static void UpdateButtons <TButton>(IStepper stepper, TButton?downButton, TButton?upButton, PropertyChangedEventArgs?e = null) where TButton : AButton { // NOTE: a value of `null` means that we are forcing an update if (downButton != null) { downButton.Enabled = stepper.IsEnabled && stepper.Value > stepper.Minimum; } if (upButton != null) { upButton.Enabled = stepper.IsEnabled && stepper.Value < stepper.Maximum; } }
public StepperDrawable(IStepper view) { _minusRippleEffect = new RippleEffectDrawable { RippleColor = GColor.FromArgb(Material.Color.Gray6) }; _plusRippleEffect = new RippleEffectDrawable { RippleColor = GColor.FromArgb(Material.Color.Gray6) }; _minusRippleEffect.Invalidated += (s, e) => SendInvalidated(); _plusRippleEffect.Invalidated += (s, e) => SendInvalidated(); View = view; }
/// <summary> /// Creates an instance of the conformance tester for an IUT stepper. /// </summary> /// <param name="model">given model stepper</param> /// <param name="impl">given implementation stepper</param> public ConformanceTester(IStrategy model, IStepper impl) { this.model = model; this.impl = impl; //set the callback in the implementation //if the implementation implements IAsyncStepper IAsyncStepper implWithObs = impl as IAsyncStepper; if (implWithObs != null) { TimedQueue<Action> obs = new TimedQueue<Action>(); this.observations = obs; implWithObs.SetObserver(obs.Enqueue); } this.testResultNotifier = this.DefaultTestResultNotifier; this.testerActionTimeout = delegate(IState state, CompoundTerm action) { return defaultTimeSpan; }; this.testerActionSymbols = model.ActionSymbols; this.cleanupActionSymbols = Set<Symbol>.EmptySet; this.internalActionSymbols = Set<Symbol>.EmptySet; this.RandomSeed = new Random().Next(); this.worker = new TimedWorker(); }
public CpuPinStates( IClock clock, IStepper stepper, IByte instruction, Caez caez, IAnd and, IOr or, INot not, IDecoder decoder, IByteFactory byteFactory) { _clock = clock; _stepper = stepper; _instruction = instruction; _caez = caez; _and = and; _or = or; _not = not; _decoder = decoder; _byteFactory = byteFactory; }
internal static void UpdateButtons(this LinearLayout linearLayout, IStepper stepper) { AButton?downButton = null; AButton?upButton = null; for (int i = 0; i < linearLayout?.ChildCount; i++) { var childButton = linearLayout.GetChildAt(i) as AButton; if (childButton?.Text == "-") { downButton = childButton; } if (childButton?.Text == "+") { upButton = childButton; } } StepperHandlerManager.UpdateButtons(stepper, downButton, upButton); }
/// <summary> /// Creates an instance of the conformance tester for an IUT stepper. /// </summary> /// <param name="model">given model stepper</param> /// <param name="impl">given implementation stepper</param> public ConformanceTester(IStrategy model, IStepper impl) { this.model = model; this.impl = impl; //set the callback in the implementation //if the implementation implements IAsyncStepper IAsyncStepper implWithObs = impl as IAsyncStepper; if (implWithObs != null) { TimedQueue <Action> obs = new TimedQueue <Action>(); this.observations = obs; implWithObs.SetObserver(obs.Enqueue); } this.testResultNotifier = this.DefaultTestResultNotifier; this.testerActionTimeout = delegate(IState state, CompoundTerm action) { return(defaultTimeSpan); }; this.testerActionSymbols = model.ActionSymbols; this.cleanupActionSymbols = Set <Symbol> .EmptySet; this.internalActionSymbols = Set <Symbol> .EmptySet; this.RandomSeed = new Random().Next(); this.worker = new TimedWorker(); }
public static void RunWithCommandLineArguments(string[] args) { //System.Diagnostics.Debugger.Break(); ConformanceTester confTester = null; try { ConfTesterCommandLineSettings settings = new ConfTesterCommandLineSettings(); if (!Parser.ParseArgumentsWithUsage(args, settings)) { //Console.ReadLine(); return; } #region load the libraries List <Assembly> libs = new List <Assembly>(); try { if (settings.reference != null) { foreach (string l in settings.reference) { libs.Add(System.Reflection.Assembly.LoadFrom(l)); } } } catch (Exception e) { throw new ModelProgramUserException(e.Message); } #endregion #region create the implementation stepper using the factory method string implStepperMethodName; string implStepperClassName; ReflectionHelper.SplitFullMethodName(settings.iut, out implStepperClassName, out implStepperMethodName); Type implStepperType = ReflectionHelper.FindType(libs, implStepperClassName); MethodInfo implStepperMethod = ReflectionHelper.FindMethod(implStepperType, implStepperMethodName, Type.EmptyTypes, typeof(IStepper)); IStepper implStepper = null; try { implStepper = (IStepper)implStepperMethod.Invoke(null, null); } catch (Exception e) { throw new ModelProgramUserException("Invocation of '" + settings.iut + "' failed: " + e.ToString()); } #endregion #region create a model program for each model using the factory method and compose into product string mpMethodName; string mpClassName; ModelProgram mp = null; if (settings.model != null && settings.model.Length > 0) { ReflectionHelper.SplitFullMethodName(settings.model[0], out mpClassName, out mpMethodName); Type mpType = ReflectionHelper.FindType(libs, mpClassName); MethodInfo mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram)); try { mp = (ModelProgram)mpMethod.Invoke(null, null); } catch (Exception e) { throw new ModelProgramUserException("Invocation of '" + settings.model[0] + "' failed: " + e.ToString()); } for (int i = 1; i < settings.model.Length; i++) { ReflectionHelper.SplitFullMethodName(settings.model[i], out mpClassName, out mpMethodName); mpType = ReflectionHelper.FindType(libs, mpClassName); mpMethod = ReflectionHelper.FindMethod(mpType, mpMethodName, Type.EmptyTypes, typeof(ModelProgram)); ModelProgram mp2 = null; try { mp2 = (ModelProgram)mpMethod.Invoke(null, null); } catch (Exception e) { throw new ModelProgramUserException("Invocation of '" + settings.model[i] + "' failed: " + e.ToString()); } mp = new ProductModelProgram(mp, mp2); } } #endregion #region load the test cases if any Sequence <Sequence <CompoundTerm> > testcases = Sequence <Sequence <CompoundTerm> > .EmptySequence; if (!String.IsNullOrEmpty(settings.testSuite)) { try { System.IO.StreamReader testSuiteReader = new System.IO.StreamReader(settings.testSuite); string testSuiteAsString = testSuiteReader.ReadToEnd(); testSuiteReader.Close(); CompoundTerm testSuite = (CompoundTerm)Term.Parse(testSuiteAsString); foreach (CompoundTerm testCaseTerm in testSuite.Arguments) { Sequence <CompoundTerm> testCase = testCaseTerm.Arguments.Convert <CompoundTerm>(delegate(Term t) { return((CompoundTerm)t); }); testcases = testcases.AddLast(testCase); } } catch (Exception e) { throw new ModelProgramUserException("Cannot create test suite: " + e.Message); } } #endregion #region load the fsms if any Dictionary <string, FSM> fsms = new Dictionary <string, FSM>(); if (settings.fsm != null && settings.fsm.Length > 0) { try { foreach (string fsmFile in settings.fsm) { System.IO.StreamReader fsmReader = new System.IO.StreamReader(fsmFile); string fsmAsString = fsmReader.ReadToEnd(); fsmReader.Close(); fsms[fsmFile] = FSM.FromTerm(CompoundTerm.Parse(fsmAsString)); } } catch (Exception e) { throw new ModelProgramUserException("Cannot create fsm: " + e.Message); } } #endregion if (mp == null && testcases.IsEmpty && fsms.Count == 0) { throw new ModelProgramUserException("No model, fsm, or test suite was given."); } if (fsms.Count > 0) { foreach (string fsmName in fsms.Keys) { ModelProgram fsmmp = new FsmModelProgram(fsms[fsmName], fsmName); if (mp == null) { mp = fsmmp; } else { mp = new ProductModelProgram(mp, fsmmp); } } } #region create the model stepper IStrategy ms; if (!testcases.IsEmpty) { ms = new TestSuiteStepper(settings.startTestAction, testcases, mp); } else { ms = CreateModelStepper(libs, mp, settings.modelStepper, settings.coverage); } #endregion confTester = new ConformanceTester(ms, implStepper); #region configure conformance tester settings confTester.ContinueOnFailure = settings.continueOnFailure; confTester.StepsCnt = (testcases.IsEmpty ? settings.steps : 0); confTester.MaxStepsCnt = (testcases.IsEmpty ? settings.maxSteps : 0); confTester.RunsCnt = (testcases.IsEmpty ? settings.runs : testcases.Count); confTester.WaitAction = settings.waitAction; confTester.TimeoutAction = settings.timeoutAction; Symbol waitActionSymbol = confTester.waitActionSet.Choose(); Symbol timeoutActionSymbol = confTester.timeoutAction.FunctionSymbol1; Set <Symbol> obs = new Set <string>(settings.observableAction).Convert <Symbol>(delegate(string s) { return(Symbol.Parse(s)); }); confTester.ObservableActionSymbols = obs; Set <Symbol> cleanup = new Set <string>(settings.cleanupAction).Convert <Symbol>(delegate(string s) { return(Symbol.Parse(s)); }); confTester.CleanupActionSymbols = cleanup; if (confTester.IsAsync) { //remove the wait and timeout action symbol from tester action symbols if (confTester.testerActionSymbols.Contains(waitActionSymbol) || confTester.testerActionSymbols.Contains(timeoutActionSymbol)) { confTester.testerActionSymbols = confTester.testerActionSymbols.Remove(waitActionSymbol).Remove(timeoutActionSymbol); } } Set <Symbol> internals = new Set <string>(settings.internalAction).Convert <Symbol>(delegate(string s) { return(Symbol.Parse(s)); }); confTester.InternalActionSymbols = (testcases.IsEmpty || settings.startTestAction != "Test" ? internals : internals.Add(Symbol.Parse("Test"))); TimeSpan timeout = new TimeSpan(0, 0, 0, 0, settings.timeout); confTester.TesterActionTimeout = delegate(IState s, CompoundTerm a) { return(timeout); }; confTester.Logfile = settings.logfile; confTester.OverwriteLog = settings.overwriteLog; if (settings.randomSeed != 0) { confTester.RandomSeed = settings.randomSeed; } #endregion //finally, run the application confTester.Run(); } catch (ModelProgramUserException) { throw; } catch (ConformanceTesterException e) { throw new ModelProgramUserException(e.Message); } finally { if (confTester != null) { confTester.Dispose(); } } }
public static void UpdateMinimum(this UIStepper nativeStepper, IStepper stepper) { nativeStepper.MinimumValue = stepper.Minimum; }
public CompositeParser(IStepper <TStep> stepper, Func <TStep, IStringParser <TInnerResult> > stepToParserFunc) { _stepper = stepper; _stepToParserFunc = stepToParserFunc; }
public static void RemoveStepper(IStepper stepper) => _steppers.Remove(stepper);
public static void UpdateMinimum(this UIStepper platformStepper, IStepper stepper) { platformStepper.MinimumValue = stepper.Minimum; }
static List <Step> CreateStepsForOneColorTranslation(IStepper s, bool isStroke) => (isStroke ? s.CalculateOutlineSteps() : s.CalculateFillSteps()) .Select(p => new Step(p.Type, new Point(p.Point.X, p.Point.Y))) .ToList();
public void Remove(IStepper stepper) => _steppers.Remove(stepper);
public static void UpdateIncrement(this LinearLayout linearLayout, IStepper stepper) { UpdateButtons(linearLayout, stepper); }
public LazyTransformer(IStepper stepper) { _stepper = stepper; }
public static void UpdateMinimum(this LinearLayout linearLayout, IStepper stepper) { UpdateButtons(linearLayout, stepper); }
private static CompositeParser <int, string> CreateSut( IStepper <string> stepper, Func <string, IStringParser <int> > stepToParserFunc) { return(new CompositeParser <int, string>(stepper, stepToParserFunc)); }
async Task ValidateNativeBackgroundColor(IStepper stepper, Color color) { var expected = await GetValueAsync(stepper, handler => GetNativeStepper(handler).BackgroundColor.ToColor()); Assert.Equal(expected, color); }
private static CompositeParser <string, string> CreateSut( IStepper <string> stepper, Func <string, IStringParser <string> >?stepToParserFunc) { return(new CompositeParser <string, string>(stepper, stepToParserFunc ?? (_ => Mock.Of <IStringParser <string> >()))); }
public static void UpdateIsEnabled(this LinearLayout linearLayout, IStepper stepper) { UpdateButtons(linearLayout, stepper); }