internal static Exception DataConstantNotFound(DataConstant dataConstant) { return (new InvalidOperationException( string.Format("The DataContext doesn't contain the DataConstant with id '{0}', type '{1}'", dataConstant.Id, dataConstant.Type))); }
public void ProviderShouldRestoreViewModelState() { DataConstant <string> key = "key"; const string value = "value"; var loadViewModel = new ViewModel(); var childIoc = new IocContainerMock(); var iocContainer = new IocContainerMock { GetFunc = (type, s, arg3) => { typeof(ViewModel).ShouldEqual(type); return(loadViewModel); }, CreateChild = mock => childIoc }; childIoc.GetFunc = iocContainer.GetFunc; var viewModel = new ViewModel(); viewModel.Settings.State.Add(key, value); ViewModelProvider provider = GetViewModelProvider(iocContainer); var state = provider.PreserveViewModel(viewModel, DataContext.Empty); var restoreViewModel = provider.RestoreViewModel(state, DataContext.Empty, true); restoreViewModel.IocContainer.ShouldEqual(childIoc); restoreViewModel.ShouldEqual(loadViewModel); restoreViewModel.Settings.State.GetData(key).ShouldEqual(value); }
static NavigationProvider() { var type = typeof(NavigationProvider); ViewModelTypeConstant = DataConstant.Create <Type>(type, nameof(ViewModelTypeConstant), true); IsNavigatedConstant = DataConstant.Create <object>(type, nameof(IsNavigatedConstant), false); }
static BindingBuilderConstants() { var type = typeof(BindingBuilderConstants); RawSources = DataConstant.Create <IList <object> >(type, nameof(RawSources), true); Source = DataConstant.Create <object>(type, nameof(Source), true); BuildDelegate = DataConstant.Create <Func <IDataContext, IDataBinding> >(type, nameof(BuildDelegate), true); Target = DataConstant.Create <object>(type, nameof(Target), true); TargetSource = DataConstant.Create <ISourceValue>(type, nameof(TargetSource), true); TargetPath = DataConstant.Create <IBindingPath>(type, nameof(TargetPath), true); Sources = DataConstant.Create <IList <Func <IDataContext, IObserver> > >(type, nameof(Sources), true); MultiExpression = DataConstant.Create <Func <IDataContext, IList <object>, object> >(type, nameof(MultiExpression), true); Behaviors = DataConstant.Create <List <IBindingBehavior> >(type, nameof(Behaviors), true); Converter = DataConstant.Create <Func <IDataContext, IBindingValueConverter> >(type, nameof(Converter), true); ConverterParameter = DataConstant.Create <Func <IDataContext, object> >(type, nameof(ConverterParameter), true); ConverterCulture = DataConstant.Create <Func <IDataContext, CultureInfo> >(type, nameof(ConverterCulture), true); CommandParameter = DataConstant.Create <Func <IDataContext, object> >(type, nameof(CommandParameter), true); ToggleEnabledState = DataConstant.Create <bool>(type, nameof(ToggleEnabledState)); Fallback = DataConstant.Create <Func <IDataContext, object> >(type, nameof(Fallback), true); TargetNullValue = DataConstant.Create <object>(type, nameof(TargetNullValue), false); HasStablePath = DataConstant.Create <bool>(type, nameof(HasStablePath)); Observable = DataConstant.Create <bool>(type, nameof(Observable)); Optional = DataConstant.Create <bool>(type, nameof(Optional)); NoCache = DataConstant.Create(type, nameof(NoCache)); DebugTag = DataConstant.Create <string>(type, nameof(DebugTag), true); }
private static IBindingInfoBehaviorSyntax <TSource> WithParameter <TSource, TValue>( this IBindingInfoSyntax <TSource> syntax, DataConstant <TValue> constant, TValue value) { Should.NotBeNull(syntax, "syntax"); syntax.Builder.Add(constant, value); return(syntax.GetOrAddSyntaxBuilder <IBindingInfoBehaviorSyntax <TSource>, object, TSource>()); }
static NavigationProvider() { NavigationArgsConstant = DataConstant.Create(() => NavigationArgsConstant, true); NavigatingCancelArgsConstant = DataConstant.Create(() => NavigatingCancelArgsConstant, true); ViewModelType = DataConstant.Create(() => ViewModelType, true); VmTypeConstant = DataConstant.Create(() => VmTypeConstant, true); }
public void AddNotNullValueShouldThrowException() { var dataConstant = new DataConstant <object>("id", true); var dataContext = Create(); ShouldThrow(() => dataContext.Add(dataConstant, null)); }
static AndroidToolkitExtensions() { IsApiGreaterThan10 = Build.VERSION.SdkInt > BuildVersionCodes.GingerbreadMr1; IsApiLessThanOrEqualTo10 = !IsApiGreaterThan10; IsApiGreaterThanOrEqualTo14 = Build.VERSION.SdkInt >= BuildVersionCodes.IceCreamSandwich; IsApiGreaterThanOrEqualTo17 = Build.VERSION.SdkInt >= BuildVersionCodes.JellyBeanMr1; IsApiGreaterThanOrEqualTo19 = Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat; IsApiGreaterThanOrEqualTo21 = Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop; FragmentConstant = DataConstant.Create <object>(typeof(AndroidToolkitExtensions), nameof(FragmentConstant), false); ContentViewManagerField = new ContentViewManager(); _setContentViewDelegete = ContentViewManagerField.SetContent; _isFragment = o => false; _isActionBar = _isFragment; _activityRef = Empty.WeakReference; ViewToContextConstructor = new ConcurrentDictionary <Type, Func <object[], object> >(); ViewToContextWithAttrsConstructor = new ConcurrentDictionary <Type, Func <object[], object> >(); ObjectToDefaultJavaConstructor = new ConcurrentDictionary <Type, bool>(); ViewContextArgs = new[] { typeof(Context) }; ViewContextWithAttrsArgs = new[] { typeof(Context), typeof(IAttributeSet) }; DefaultJavaConstructorArgs = new[] { typeof(IntPtr), typeof(JniHandleOwnership) }; WeakReferencesHolder = new List <object>(1000); CurrentActivityLocker = new object(); EnableFastTextViewTextProperty = true; BackgroundNotificationDelay = 200; // ReSharper disable once ObjectCreationAsStatement new WeakReferenceCollector(); }
private static IBindingInfoBehaviorSyntax<TSource> WithParameter<TSource, TValue>(this IBuilderSyntax syntax, DataConstant<Func<IDataContext, TValue>> constant, Func<LambdaExpression> expression) { Should.NotBeNull(syntax, nameof(syntax)); BindingServiceProvider.BindingProvider.BuildParameterFromLambdaExpression(syntax.Builder, expression, constant); return syntax.GetOrAddSyntaxBuilder<IBindingInfoBehaviorSyntax<TSource>, object, TSource>(); }
static BindingConstants() { DoNothing = DataConstant.Create(() => DoNothing); UnsetValue = DataConstant.Create(() => UnsetValue); InvalidValue = DataConstant.Create(() => InvalidValue); Binding = DataConstant.Create(() => Binding, true); CurrentEventArgs = DataConstant.Create(() => CurrentEventArgs, false); }
/*-------------------- Constructors ---------------------------------*/ internal FieldRVA(FieldDef field, DataConstant data) { Contract.Requires(field != null); Contract.Requires(data != null); this.field = field; this.data = data; tabIx = MDTable.FieldRVA; }
static NavigationProvider() { NavigationArgsConstant = DataConstant.Create(() => NavigationArgsConstant, true); NavigatingCancelArgsConstant = DataConstant.Create(() => NavigatingCancelArgsConstant, true); ViewModelTypeConstant = DataConstant.Create(() => ViewModelTypeConstant, true); ClearNavigationCache = DataConstant.Create(() => ClearNavigationCache); OperationIdConstant = DataConstant.Create(() => OperationIdConstant, false); }
public void BuildParameterFromLambdaExpression <TValue>(IBindingBuilder builder, Func <LambdaExpression> expression, DataConstant <Func <IDataContext, TValue> > parameterConstant) { Should.NotBeNull(builder, nameof(builder)); Should.NotBeNull(expression, nameof(expression)); Should.NotBeNull(parameterConstant, nameof(parameterConstant)); BuildParameterFromLambdaExpressionInternal(builder, expression, parameterConstant); }
/// <summary> /// Determines whether the <see cref="IDataContext" /> contains the specified key. /// </summary> bool IDataContext.Contains(DataConstant dataConstant) { if (_lazyContext == null) { return(BindingConstants.Binding.Constant.Equals(dataConstant)); } return(_lazyContext.Contains(dataConstant)); }
/// <summary> /// Removes the data constant value. /// </summary> bool IDataContext.Remove(DataConstant dataConstant) { if (_lazyContext == null) { return(false); } return(_lazyContext.Remove(dataConstant)); }
static DynamicViewModelWindowPresenter() { var type = typeof(DynamicViewModelWindowPresenter); WindowViewMediatorConstant = DataConstant.Create <IWindowViewMediator>(type, nameof(WindowViewMediatorConstant), true); RestoredViewConstant = DataConstant.Create <object>(type, nameof(RestoredViewConstant), true); IsOpenViewConstant = DataConstant.Create <bool>(type, nameof(IsOpenViewConstant)); }
static BindingProvider() { CreateInvalidaDataBindingDelegate = CreateInvalidaDataBinding; FormatMembersExpressionDelegate = FormatMembersExpression; ProviderConstant = DataConstant.Create(() => ProviderConstant, true); ExceptionConstant = DataConstant.Create(() => ExceptionConstant, true); BehaviorComparer = new DelegateComparer<IBindingBehavior>((behavior, bindingBehavior) => bindingBehavior.Priority.CompareTo(behavior.Priority)); }
static WindowPresenterConstants() { var type = typeof(WindowPresenterConstants); WindowViewMediator = DataConstant.Create <IWindowViewMediator>(type, nameof(WindowViewMediator), true); RestoredView = DataConstant.Create <object>(type, nameof(RestoredView), true); IsViewOpened = DataConstant.Create <bool>(type, nameof(IsViewOpened)); }
/// <summary> /// Initializes a new instance of the <see cref="BindingProvider" /> class. /// </summary> static BindingProvider() { CreateInvalidaDataBindingDelegate = CreateInvalidaDataBinding; FormatMembersExpressionDelegate = FormatMembersExpression; ProviderConstant = DataConstant.Create(() => ProviderConstant, true); ExceptionConstant = DataConstant.Create(() => ExceptionConstant, true); BehaviorComparer = new DelegateComparer <IBindingBehavior>((behavior, bindingBehavior) => bindingBehavior.Priority.CompareTo(behavior.Priority)); }
static ViewModelProvider() { RestoredViewModels = new Dictionary <Guid, RestoredViewModel>(); ViewModelTypeNameConstant = DataConstant.Create(() => ViewModelTypeNameConstant, true); IdViewModelConstant = DataConstant.Create(() => IdViewModelConstant); IdParentViewModelConstant = DataConstant.Create(() => IdParentViewModelConstant); Tracer.TraceViewModelHandler += OnTraceViewModel; }
static BindingConstants() { Source = DataConstant.Create(() => Source, true); DoNothing = DataConstant.Create(() => DoNothing); UnsetValue = DataConstant.Create(() => UnsetValue); InvalidValue = DataConstant.Create(() => InvalidValue); Binding = DataConstant.Create(() => Binding, true); CurrentEventArgs = DataConstant.Create(() => CurrentEventArgs, false); }
static BindingBuilderExtensions() { if (ServiceProvider.IsDesignMode) { BindingServiceProvider.InitializeFromDesignContext(); } SyntaxBuilderConstant = DataConstant.Create <object>(typeof(BindingBuilderExtensions), nameof(SyntaxBuilderConstant), true); DefaultBindingMemberDescriptor = new BindingMemberDescriptor <object, string>("DefaultBindingMember"); }
static BindingProvider() { CreateInvalidaDataBindingDelegate = CreateInvalidaDataBinding; FormatMembersExpressionDelegate = FormatMembersExpression; var type = typeof(BindingProvider); ProviderConstant = DataConstant.Create <BindingProvider>(type, nameof(ProviderConstant), true); ExceptionConstant = DataConstant.Create <Exception>(type, nameof(ExceptionConstant), true); BehaviorComparer = new DelegateComparer <IBindingBehavior>((behavior, bindingBehavior) => bindingBehavior.Priority.CompareTo(behavior.Priority)); }
static NavigationConstants() { SuppressPageNavigation = DataConstant.Create(() => SuppressPageNavigation); SuppressWindowNavigation = DataConstant.Create(() => SuppressWindowNavigation); SuppressTabNavigation = DataConstant.Create(() => SuppressTabNavigation); ViewModel = DataConstant.Create(() => ViewModel, true); ViewName = DataConstant.Create(() => ViewName, false); Parameters = DataConstant.Create(() => Parameters, true); IsDialog = DataConstant.Create(() => IsDialog); }
public static T GetDataTest <T>(this IDataContext context, DataConstant <T> constant) { T data; if (context.TryGetData(constant, out data)) { return(data); } return(default(T)); }
/// <summary> /// Initializes a new instance of the <see cref="XamarinFormsBootstrapperBase" /> class. /// </summary> static XamarinFormsBootstrapperBase() { WrapToNavigationPageConstant = DataConstant.Create(() => WrapToNavigationPageConstant); if (Device.OS != TargetPlatform.WinPhone) { LinkerInclude.Initialize(); } DynamicMultiViewModelPresenter.CanShowViewModelDefault = CanShowViewModelTabPresenter; DynamicViewModelNavigationPresenter.CanShowViewModelDefault = CanShowViewModelNavigationPresenter; }
static NavigationProviderConstants() { var type = typeof(NavigationProviderConstants); NavigationArgs = DataConstant.Create <NavigationEventArgsBase>(type, nameof(NavigationArgs), true); NavigatingCancelArgs = DataConstant.Create <NavigatingCancelEventArgsBase>(type, nameof(NavigatingCancelArgs), true); OperationId = DataConstant.Create <string>(type, nameof(OperationId), false); BringToFront = DataConstant.Create <bool>(type, nameof(BringToFront)); InvalidateCache = DataConstant.Create <bool>(type, nameof(InvalidateCache)); InvalidateAllCache = DataConstant.Create <bool>(type, nameof(InvalidateAllCache)); }
static ViewFactoryConstants() { Bindings = DataConstant.Create(() => Bindings, false); ItemTemplateId = DataConstant.Create(() => ItemTemplateId); DropDownItemTemplateId = DataConstant.Create(() => DropDownItemTemplateId); ContentTemplateId = DataConstant.Create(() => ContentTemplateId); MenuTemplateId = DataConstant.Create(() => MenuTemplateId); PopupMenuTemplateId = DataConstant.Create(() => PopupMenuTemplateId); PopupMenuEvent = DataConstant.Create(() => PopupMenuEvent, true); PlacementTargetPath = DataConstant.Create(() => PlacementTargetPath, true); }
static ViewModelConstants() { View = DataConstant.Create(() => View, true); ViewModelTypeName = DataConstant.Create(() => ViewModelTypeName, true); ViewModelState = DataConstant.Create(() => ViewModelState, true); StateManager = DataConstant.Create(() => StateManager, true); ViewModel = DataConstant.Create(() => ViewModel, true); ParentViewModel = DataConstant.Create(() => ParentViewModel, true); StateNotNeeded = DataConstant.Create(() => StateNotNeeded); StateRestored = DataConstant.Create(() => StateRestored); }
static NavigationConstants() { SuppressPageNavigation = DataConstant.Create(() => SuppressPageNavigation); SuppressWindowNavigation = DataConstant.Create(() => SuppressWindowNavigation); SuppressTabNavigation = DataConstant.Create(() => SuppressTabNavigation); ViewModel = DataConstant.Create(() => ViewModel, true); ViewName = DataConstant.Create(() => ViewName, false); IsDialog = DataConstant.Create(() => IsDialog); ClearBackStack = DataConstant.Create(() => ClearBackStack); UseAnimations = DataConstant.Create(() => UseAnimations); }
static BindingConstants() { var type = typeof(BindingConstants); Source = DataConstant.Create<WeakReference>(type, nameof(Source), true); DoNothing = DataConstant.Create(type, nameof(DoNothing)); UnsetValue = DataConstant.Create(type, nameof(UnsetValue)); InvalidValue = DataConstant.Create(type, nameof(InvalidValue)); Binding = DataConstant.Create<IDataBinding>(type, nameof(Binding), true); CurrentEventArgs = DataConstant.Create<object>(type, nameof(CurrentEventArgs), false); ClearErrors = DataConstant.Create<bool>(type, nameof(ClearErrors)); }
/// <summary> /// Adds the data constant value. /// </summary> public void Add <T>(DataConstant <T> data, T value) { try { _internalContext.Add(data, value); } catch (ArgumentException) { throw BindingExceptionManager.DuplicateDataConstant(data); } }
public static T GetOrAddValue <T>(IDataBinding binding, DataConstant <object> constant, Func <T> getValue) { object data; if (!binding.Context.TryGetData(constant, out data)) { data = getValue(); binding.Context.AddOrUpdate(constant, data); } return((T)data); }
static NavigationProvider() { var type = typeof(NavigationProvider); ViewModelTypeConstant = DataConstant.Create <Type>(type, nameof(ViewModelTypeConstant), true); IsNavigatedConstant = DataConstant.Create <object>(type, nameof(IsNavigatedConstant), false); IgnoreNavigatingConstant = DataConstant.Create <object>(type, nameof(IgnoreNavigatingConstant), false); NavigatedTaskConstant = DataConstant.Create <TaskCompletionSource <bool> >(type, nameof(NavigatedTaskConstant), false); CloseContextConstant = DataConstant.Create <IDataContext>(type, nameof(CloseContextConstant), true); BringToFront = DataConstant.Create <bool>(type, nameof(BringToFront)); }
/// <summary> /// Initializes a new instance of the <see cref="XamarinFormsBootstrapperBase" /> class. /// </summary> static XamarinFormsBootstrapperBase() { WrapToNavigationPageConstant = DataConstant.Create(() => WrapToNavigationPageConstant); if (Device.OS != TargetPlatform.WinPhone) LinkerInclude.Initialize(); DynamicMultiViewModelPresenter.CanShowViewModelDefault = CanShowViewModelTabPresenter; DynamicViewModelNavigationPresenter.CanShowViewModelDefault = CanShowViewModelNavigationPresenter; ViewManager.ViewCleared += OnViewCleared; ViewManager.ClearDataContext = true; BindingServiceProvider.DataContextMemberAliases.Add("BindingContext"); BindingServiceProvider.BindingMemberPriorities["BindingContext"] = int.MaxValue - 1; }
static ViewFactoryConstants() { var type = typeof(ViewFactoryConstants); Bindings = DataConstant.Create<IList<string>>(type, nameof(Bindings), false); ItemTemplateId = DataConstant.Create<int>(type, nameof(ItemTemplateId)); DropDownItemTemplateId = DataConstant.Create<int>(type, nameof(DropDownItemTemplateId)); ContentTemplateId = DataConstant.Create<int>(type, nameof(ContentTemplateId)); MenuTemplateId = DataConstant.Create<int>(type, nameof(MenuTemplateId)); PopupMenuTemplateId = DataConstant.Create<int>(type, nameof(PopupMenuTemplateId)); PopupMenuEvent = DataConstant.Create<string>(type, nameof(PopupMenuEvent), true); PlacementTargetPath = DataConstant.Create<string>(type, nameof(PlacementTargetPath), true); }
static ViewModelConstants() { var type = typeof(ViewModelConstants); Id = DataConstant.Create<Guid>(type, nameof(Id)); IdParent = DataConstant.Create<Guid>(type, nameof(IdParent)); View = DataConstant.Create<object>(type, nameof(View), true); ViewModelTypeName = DataConstant.Create<string>(type, nameof(ViewModelTypeName), true); ViewModelState = DataConstant.Create<IDataContext>(type, nameof(ViewModelState), true); ViewModel = DataConstant.Create<IViewModel>(type, nameof(ViewModel), true); ParentViewModel = DataConstant.Create<WeakReference>(type, nameof(ParentViewModel), true); StateNotNeeded = DataConstant.Create<bool>(type, nameof(StateNotNeeded)); StateRestored = DataConstant.Create<bool>(type, nameof(StateRestored)); }
/// <summary> /// Initializes a new instance of the <see cref="XamarinFormsBootstrapperBase" /> class. /// </summary> static XamarinFormsBootstrapperBase() { ServiceProvider.SetDefaultDesignTimeManager(); WrapToNavigationPageConstant = DataConstant.Create(() => WrapToNavigationPageConstant); if (Device.OS != TargetPlatform.WinPhone) LinkerInclude.Initialize(); DynamicMultiViewModelPresenter.CanShowViewModelDefault = CanShowViewModelTabPresenter; DynamicViewModelNavigationPresenter.CanShowViewModelDefault = CanShowViewModelNavigationPresenter; ViewManager.ViewCleared += OnViewCleared; ViewManager.ClearDataContext = true; var contextName = ToolkitExtensions.GetMemberName<BindableObject>(() => e => e.BindingContext); BindingServiceProvider.DataContextMemberAliases.Add(contextName); BindingServiceProvider.BindingMemberPriorities[contextName] = int.MaxValue - 1; }
static BindingBuilderConstants() { RawSources = DataConstant.Create(() => RawSources, true); Source = DataConstant.Create(() => Source, true); BuildDelegate = DataConstant.Create(() => BuildDelegate, true); Target = DataConstant.Create(() => Target, true); TargetSource = DataConstant.Create(() => TargetSource, true); TargetPath = DataConstant.Create(() => TargetPath, true); Sources = DataConstant.Create(() => Sources, true); MultiExpression = DataConstant.Create(() => MultiExpression, true); Behaviors = DataConstant.Create(() => Behaviors, true); Converter = DataConstant.Create(() => Converter, true); ConverterParameter = DataConstant.Create(() => ConverterParameter, true); ConverterCulture = DataConstant.Create(() => ConverterCulture, true); CommandParameter = DataConstant.Create(() => CommandParameter, true); ToggleEnabledState = DataConstant.Create(() => ToggleEnabledState); Fallback = DataConstant.Create(() => Fallback, true); TargetNullValue = DataConstant.Create(() => TargetNullValue, false); NoCache = DataConstant.Create(() => NoCache); }
static BindingBuilderConstants() { var type = typeof(BindingBuilderConstants); RawSources = DataConstant.Create<IList<object>>(type, nameof(RawSources), true); Source = DataConstant.Create<object>(type, nameof(Source), true); BuildDelegate = DataConstant.Create<Func<IDataContext, IDataBinding>>(type, nameof(BuildDelegate), true); Target = DataConstant.Create<object>(type, nameof(Target), true); TargetSource = DataConstant.Create<ISourceValue>(type, nameof(TargetSource), true); TargetPath = DataConstant.Create<IBindingPath>(type, nameof(TargetPath), true); Sources = DataConstant.Create<IList<Func<IDataContext, IObserver>>>(type, nameof(Sources), true); MultiExpression = DataConstant.Create<Func<IDataContext, IList<object>, object>>(type, nameof(MultiExpression), true); Behaviors = DataConstant.Create<List<IBindingBehavior>>(type, nameof(Behaviors), true); Converter = DataConstant.Create<Func<IDataContext, IBindingValueConverter>>(type, nameof(Converter), true); ConverterParameter = DataConstant.Create<Func<IDataContext, object>>(type, nameof(ConverterParameter), true); ConverterCulture = DataConstant.Create<Func<IDataContext, CultureInfo>>(type, nameof(ConverterCulture), true); CommandParameter = DataConstant.Create<Func<IDataContext, object>>(type, nameof(CommandParameter), true); ToggleEnabledState = DataConstant.Create<bool>(type, nameof(ToggleEnabledState)); Fallback = DataConstant.Create<Func<IDataContext, object>>(type, nameof(Fallback), true); TargetNullValue = DataConstant.Create<object>(type, nameof(TargetNullValue), false); HasStablePath = DataConstant.Create<bool>(type, nameof(HasStablePath)); Observable = DataConstant.Create<bool>(type, nameof(Observable)); Optional = DataConstant.Create<bool>(type, nameof(Optional)); NoCache = DataConstant.Create(type, nameof(NoCache)); }
internal static Exception DataConstantCannotBeNull(DataConstant dataConstant) { return new InvalidOperationException($"The DataConstant cannot be null, id '{dataConstant.Id}'"); }
static MultiViewModel() { ViewModelState = DataConstant.Create(() => ViewModelState, true); SelectedIndex = DataConstant.Create(() => SelectedIndex); }
static ViewModelProvider() { IdGeneratorLocker = new object(); RestoredViewModels = new Dictionary<Guid, RestoredViewModel>(); ViewModelTypeNameConstant = DataConstant.Create(() => ViewModelTypeNameConstant, true); IdViewModelConstant = DataConstant.Create(() => IdViewModelConstant); IdParentViewModelConstant = DataConstant.Create(() => IdParentViewModelConstant); Tracer.TraceViewModelHandler += OnTraceViewModel; }
internal static Exception DataConstantCannotBeNull(DataConstant dataConstant) { return new InvalidOperationException(string.Format("The DataConstant cannot be null, id '{0}'", dataConstant.Id)); }
internal static Exception DuplicateDataConstant(DataConstant constant) { return new InvalidOperationException(string.Format("The data constant '{0}' was defined more than once.", constant.Id)); }
internal static Exception DataConstantNotFound(DataConstant dataConstant) { return new InvalidOperationException(string.Format("The DataContext doesn't contain the DataConstant with id '{0}'", dataConstant.Id)); }
internal static Exception DuplicateDataConstant(DataConstant constant) { return new InvalidOperationException($"The data constant '{constant.Id}' was defined more than once."); }
static DynamicViewModelWindowPresenter() { WindowViewMediatorConstant = DataConstant.Create(() => WindowViewMediatorConstant, true); RestoredViewConstant = DataConstant.Create(() => RestoredViewConstant, true); IsOpenViewConstant = DataConstant.Create(() => IsOpenViewConstant); }
/// <summary> /// Delete the value of this data constant /// </summary> public void RemoveDataValue() { initVal = null; flags &= NoFieldRVA; }
/// <summary> /// Add an initial value for this field (at dataLabel) (.data) /// </summary> /// <param name="val">the value for the field</param> public void AddDataValue(DataConstant val) { flags |= HasFieldRVA; initVal = val; }
static OrderWorkspaceViewModel() { StateConstant = DataConstant.Create(() => StateConstant, true); }
private static void SetAttributeValue(View view, Context context, IAttributeSet attrs, int[] groupId, int requiredAttributeId, string attachedMemberName, IDataContext dataContext, DataConstant<int> constant) { int? value = ReadAttributeValueId(context, attrs, groupId, requiredAttributeId); if (!value.HasValue) return; dataContext.Add(constant, value.Value); IBindingMemberInfo member = BindingServiceProvider .MemberProvider .GetBindingMember(view.GetType(), attachedMemberName, false, false); if (member != null) member.SetSingleValue(view, value); }
internal void AddData(DataConstant cVal) { output.AddInitData(cVal); }
static ProductWorkspaceViewModel() { StateConstant = DataConstant.Create(() => StateConstant, true); }
private IList<Action<IDataContext>> GetBoolValue(DataConstant<bool> constant) { var value = ReadBoolValue(); return new Action<IDataContext>[] { context => context.Add(constant, value) }; }
static MultiViewModel() { var type = typeof(MultiViewModel); ViewModelState = DataConstant.Create<StateList>(type, nameof(ViewModelState), true); SelectedIndex = DataConstant.Create<int>(type, nameof(SelectedIndex)); }
static DynamicViewModelWindowPresenter() { var type = typeof(DynamicViewModelWindowPresenter); WindowViewMediatorConstant = DataConstant.Create<IWindowViewMediator>(type, nameof(WindowViewMediatorConstant), true); RestoredViewConstant = DataConstant.Create<object>(type, nameof(RestoredViewConstant), true); IsOpenViewConstant = DataConstant.Create<bool>(type, nameof(IsOpenViewConstant)); }