首页 > 解决方案 > 来自 Prism.AppModel 的 IAutoInitialize 接口问题导致我的弹出窗口没有文本

问题描述

我确实在我的项目中使用了 Prism.Forms nuget 包。 包版本

今天我更新了包,出现了以下错误:

错误 CS0246 找不到类型或命名空间名称“IAutoInitialize”(您是否缺少 using 指令或程序集引用?)

然后我尝试在从我的视图模型中删除 IAutoInitialize 继承后运行该应用程序,并发现我的自定义弹出窗口没有显示更多文本。(我检查了我的 ShowDialog() 调用,是的,我正在将文本传递给对话框页面构造函数)

下面是出现 IAutoInitialize 问题的视图模型代码:

public class CustomPopupViewModel : BindableBase, IDialogAware, IAutoInitialize
{
    public event Action<IDialogParameters> RequestClose;
    public DelegateCommand CancelCommand { get; set; }
    public DelegateCommand ConfirmCommand { get; set; }

    private string _Title;
    public string Title
    {
        get { return _Title; }
        set { SetProperty(ref _Title, value); }
    }

    private string _Message;
    public string Message
    {
        get { return _Message; }
        set { SetProperty(ref _Message, value); }
    }

    private string _CancelMsg;
    public string CancelMsg
    {
        get { return _CancelMsg; }
        set { SetProperty(ref _CancelMsg, value); }
    }

    private string _ConfirmMsg;
    public string ConfirmMsg
    {
        get { return _ConfirmMsg; }
        set { SetProperty(ref _ConfirmMsg, value); }
    }

    public CustomPopupViewModel()
    {
        CancelCommand = new DelegateCommand(CancelTapped);
        ConfirmCommand = new DelegateCommand(ConfirmTapped);
    }

    private void ConfirmTapped()
    {
        RequestClose(new DialogParameters { { typeof(bool).Name, true } });
    }

    private void CancelTapped()
    {
        RequestClose(new DialogParameters { { typeof(bool).Name, false } });
    }

    public bool CanCloseDialog() => true;

    public void OnDialogClosed() { }

    public void OnDialogOpened(IDialogParameters parameters) { }
}

我认为删除 IAutoInitialize 界面是我的弹出窗口中没有显示文本的原因。我的问题是,8.0.0.1909 版本更新后 IAutoInitialize 位于何处或如何解决此问题。

标签: c#androidxamarin.formspopupprism

解决方案


根据此处的发行说明,IAutoInitialize 自 8.0.0.1909 版(2020 年 10 月 21 日)起已删除:

“删除了 IAutoInitialize - 推荐迁移使用 Sponsor Connect 上的 Prism.Magician”


推荐阅读