问题标签 [freshmvvm]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
570 浏览

mvvm - Xamarin.froms 中用于控制值的滑块

我在我的 xamarin 应用程序中添加了一个滑块,但我使用视图模型来捕获值。如何在 GUI 上移动滑块并显示上下递增的值,然后捕获其值?

或者有没有办法可以包含“MySlider_ValueChanged”事件并将其应用于视图模型页面而不是文件后面的内容页面代码?

0 投票
0 回答
117 浏览

xamarin.forms - FreshPageModelResolver.ResolvePageModel() 在 UWP Release 中抛出异常

我的应用程序使用 FreshMVVM。此代码适用于 iOS 和 Android,以及处于调试模式的 UWP。但是 UWP 版本在这里给出了一个例外:

消息是:

解决失败:MenuPage - 原因:此平台不支持操作。

0 投票
1 回答
1260 浏览

ios - ToolbarItems 在 iOS 中看起来不正确

我有一个带有 FreshMvvm 的 Xamarin.Forms 应用程序,并且正在尝试使用辅助 ToolbarItems。这是我的 PageModel 代码的一部分:

对于 Android,按下汉堡按钮后,菜单看起来像我期望的那样:

在此处输入图像描述

但在 iPhone 上,情况完全不同:

在此处输入图像描述

正如你所看到的,没有汉堡按钮,所有的 ToolbarItems 水平放置,彼此相邻,并且由于它们不适合屏幕的宽度,因此它们重叠。我意识到这是 iOS 的正常行为,但我无法接受。有什么办法可以解决吗?

0 投票
0 回答
57 浏览

xamarin.forms - Master-Detail:如何添加命令而不是详细信息页面

我有一个带有 FreshMvvm 的 Xamarin.Forms 应用程序。我正在尝试使用 Master-Detail 架构,如下所示:

这很好,但我需要添加导航元素,这些元素除了打开详细信息页面之外还可以做一些事情。例如,我可能需要在浏览器中打开一些网站或拨打电话等。这是否可行,如果可以,如何?

0 投票
1 回答
375 浏览

c# - “FreshIOC.Container.Register”有什么作用?

我正在为 Xamarin Forms 开设一门 MVVM 课程,一个班级的老师使用 FreshIOC.Container.Register 来“注册不同的实例或依赖项”,我不明白这对我的代码有何影响,如果有人能解释一下我会很感激的。

我的代码为例:

我看不到 FreshIOC.Container.Register 做了什么,或者它如何连接到 MainViewModel 类。顺便说一句,还有另一种方法称为“解决”而不是“注册”,如果您也能解释一下,我将不胜感激。

就是这样,如果您需要我的代码中的更多内容,我会在看到您的请求后立即提供,非常感谢大家的宝贵时间,祝您有美好的一天。

0 投票
1 回答
160 浏览

xamarin.forms - 响应式 UI 扩展视图支持该类型有一个 on_PropertyName_Changed 方法**,它是静态的

基于此链接:https ://reactiveui.net/docs/handbook/view-location/extending-iviewfor

每当我尝试使用 RG.Plugins.Popup nuget 执行示例中的代码时,都会收到以下错误Fody: The Type MyType '1 has a on_PropertyName_Changed method (OnViewModelChanged) which is static

我的代码与链接代码完全相同。不知道为什么会导致此错误发生。

.... 更新....

该死,所以如果有人遇到这个问题......我的解决方案是从 fodyweavers.xml 文件中删除以下织布工

为什么是这样?为什么删除上述行可以解决问题?下面是我的 FodyWeaver 文件

0 投票
1 回答
390 浏览

c# - FreshPageModelResolver.ResolvePageModel<>() 出错;

我正在尝试使用FreshPageModelResolver.ResolvePageModel<>();
,但出现以下异常:

System.Exception: 'XFShell.Pages.MainPage, XFShell, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found'。

对于我在其他页面中看到的,通常的问题是 ViewModel 页面和页面不遵循正确的命名法,但我检查了我的,它似乎是正确的,如果你能告诉我如何解决它,我将不胜感激它。

App.XAML.cs 代码:

MainViewModel.cs 代码:

MainPage.XAML.cs 代码:

MainViewModel.cs 位于名为“ViewModels”的文件夹中,而 MainPage.xaml.cs 和 MainPage.xaml 位于名为“Pages”的文件夹中。

就是这样,如果您需要更多信息,我会在看到您的请求后立即提供,谢谢大家的时间,希望您有美好的一天

0 投票
1 回答
460 浏览

xamarin.forms - FreshMVVM 导航在离开模态页面时抛出异常

我正在使用 LocalNotification 插件(nuget)根据事件生成电话通知,效果很好。如果用户导航到列出通知的页面并选择一个,它会转到 NotificationPageModel.cs 页面。从那里他们按下一个按钮,将他们导航出去,只要手动导航到它就可以工作。

如果用户单击手机的通知 (app.xaml.cs:OnLocalNotificationTapped),则在尝试离开时,它会生成 FreshTinyIoC.TinyIoCResolutionException。

当用户单击通知 ( masterDetailNav.Navigation.PushModalAsync(npage);) 时,我如何离开页面?

相关版本:Xamarin.Forms v3.6.0.264807 FreshMvvm v3.0.0 Plugin.LocalNotification by Thudugala v4.0.5

应用程序.xaml.cs

NotificationPageModel.cs:

堆栈跟踪

FreshTinyIoC.TinyIoCResolutionException 消息=解决失败:IFreshNavigationService Source=mscorlib StackTrace:在 FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal(FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration 注册,FreshTinyIoC.NamedParameterOverloads 参数,FreshTinyIoC.ResolveOptions 选项)[0x00reFshMv7] 在 C\ \FreshIOC\FreshTinyIOC.cs:3142 在 FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType, System.String name) [0x00000] 在 C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:1211 在 FreshTinyIoC.FreshTinyIoCContainer。 Resolve[ResolveType] (System.String name) [0x00000] in C:\Projects\FreshMvvm\src\FreshIOC\FreshTinyIOC.cs:1332 at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] (System.String name) [0x00000] in C :\Projects\FreshMvvm\src\FreshMvvm\FreshTinyIOCBuiltIn.cs:31 在 FreshMvvm.PageModelCoreMethods.PushNewNavigationServiceModal (FreshMvvm.IFreshNavigationService newNavigationService, FreshMvvm.FreshBasePageModel[] basePageModels, System.Boolean animate) [0x00073] 在 C:\Projects\FreshMvvm\ \FreshMvvm\PageModelCoreMethods.cs:178 at FreshMvvm.PageModelCoreMethods.PushPageModelWithNewNavigation[T] (System.Object data, System.Boolean animate) [0x00060] in C:\Projects\FreshMvvm\src\FreshMvvm\PageModelCoreMethods.cs:235 at cdaxrobot .PageModels.NotificationPageModel.Go () [0x00225] 在 C:\Work\RobotApp\App\cdaxrobot\cdaxrobot\cdaxrobot\PageModels\NotificationPageModel.cs:113 在 System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__7_0 (System.对象状态)[0x00000] 在 Android 的 /Users/builder/jenkins/workspace/archive-mono/2019-08/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 中。 App.SyncContext+<>c__DisplayClass2_0.b__0 () [0x00000] in <11f101b564894ca7af6c482ddc51c698>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11f101b564894ca7af6c482ddc51c698>:0 at Java_Lang.Thread+RunnableImplementor.Run () [0x00008] .IntPtr jnienv, System.IntPtr native__this) [0x00009] in <11f101b564894ca7af6c482ddc51c698>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)b__0 () [0x00000] in <11f101b564894ca7af6c482ddc51c698>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11f101b564894ca7af6c482ddc51c698>:0 at Java.LangIn.IRunnableTrjnienv.n_P.Run native__this) [0x00009] in <11f101b564894ca7af6c482ddc51c698>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)b__0 () [0x00000] in <11f101b564894ca7af6c482ddc51c698>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <11f101b564894ca7af6c482ddc51c698>:0 at Java.LangIn.IRunnableTrjnienv.n_P.Run native__this) [0x00009] in <11f101b564894ca7af6c482ddc51c698>:0 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)

0 投票
1 回答
860 浏览

c# - How to navigate through modal pages in Xamarin.Forms using Fresh.MVVM

I was trying to push a modal page in my xamarin forms app using MVVM when pressing a button. I already know how to use navigation stacks, but no idea how to do it with content pages as modal pages, I have tried multiple things, especially, calling the PushPageModel method.

This is the last thing I have tried: View or Page:

ViewModel class:

App.xaml.cs class:

This code gives the following error: "FreshTinyIoC.TinyIoCResolutionException: 'Resolve failed: IFreshNavigationService"

And that is all, if you need more information I will provide it as soon as I see your request, thank you all for your time, hope you have a great day.

Edit: Stack trace requested:

at FreshTinyIoC.FreshTinyIoCContainer.ResolveInternal (FreshTinyIoC.FreshTinyIoCContainer+TypeRegistration registration, FreshTinyIoC.NamedParameterOverloads parameters, FreshTinyIoC.ResolveOptions options) [0x000f7] in C:"Here goes the path" at FreshTinyIoC.FreshTinyIoCContainer.Resolve (System.Type resolveType, System.String name) [0x00000] in C:\"Here goes the path" at FreshTinyIoC.FreshTinyIoCContainer.Resolve[ResolveType] (System.String name) [0x00000] in C:"Here goes the path" at FreshMvvm.FreshTinyIOCBuiltIn.Resolve[ResolveType] (System.String name) [0x00000] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModelWithPage (Xamarin.Forms.Page page, FreshMvvm.FreshBasePageModel pageModel, System.Object data, System.Boolean modal, System.Boolean animate) [0x00177] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModel (FreshMvvm.FreshBasePageModel pageModel, System.Object data, System.Boolean modal, System.Boolean animate) [0x00048] in C:"Here goes the path" at FreshMvvm.PageModelCoreMethods.PushPageModel[T] (System.Object data, System.Boolean modal, System.Boolean animate) [0x00040] in C:"Here goes the path" at FirstApp.ViewModels.LogInViewModel.b__5_0 () [0x0003a] in D:\"Here goes the path"

0 投票
2 回答
401 浏览

c# - FreshMVVM 并在弹出 Modal 之前重置 VM

  • FreshMVVM 3.0.0
  • Xamarin 形式 4.2

我们的一些输入页面是模态加载的,当用户按下保存时,我们执行Command这样的

如果您查看CoreMethods.PopPageModelGitHub 中的调用,您会发现它处理两个进程

  1. 提高 PageWasPopped 信号
  2. 调用导航服务以从导航堆栈中弹出页面

处理弹出页面的FreshMVVM代码位于 FreshPageModel 中。除其他外,代码从 Appearing 和 Disappearing 事件中解脱钩,并将BindingContext 设置为 null。从上面的顺序可以看出,这意味着在从堆栈中弹出之前将BindingContexton设置为 null。View

这样做的问题是,在 0.5 到 1.5 秒之间的短时间内,用户会看到一个View看起来数据已全部重置的数据。如果他们刚刚按下保存,这可能会非常令人不安。

如果我在调用此问题之前反转逻辑顺序PopPageModel并从导航堆栈中弹出,则RaisePageWasPopped此问题消失。

以前没有其他人见过这个问题吗?

任何FreshMVVM想要指出我建议的方法错误的用户?