小编ent*_*pic的帖子

使用 MVVM 的 WPF 导航

我正在尝试按照这篇文章中提供的答案进行操作,但我一定遗漏了一些微不足道的东西。我将我的DataTemplates定义App.xaml如下:

<Application.Resources>
    <DataTemplate DataType="{x:Type vm:BlowerViewModel}">
        <v:BlowerView />
    </DataTemplate>
    <DataTemplate DataType="{x:Type vm:HomeViewModel}">
        <v:HomeView />
    </DataTemplate>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)

然后,在我的MainWindow.xaml我已经定义了以下代码:

<Window x:Class="App.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:App.UI.ViewModel"
        Title="MainWindow" SizeToContent="WidthAndHeight">
    <Window.DataContext>
        <vm:MainViewModel />
    </Window.DataContext>
    <ContentControl Content="{Binding CurrentView}" />
</Window>
Run Code Online (Sandbox Code Playgroud)

的代码MainViewModel包含一个属性CurrentView和一个ICommand以便我可以切换视图。定义如下:

public class MainViewModel : BaseViewModel
{
    private BaseViewModel _currentView;

    public MainViewModel()
    {
        CurrentView = new HomeViewModel();
    }

    public BaseViewModel CurrentView
    {
        get { return _currentView; }
        set
        {
            if (_currentView != …
Run Code Online (Sandbox Code Playgroud)

.net c# wpf mvvm

5
推荐指数
1
解决办法
907
查看次数

Microsoft Teams 选项卡 SSO getAuthToken 返回 ResourceDisabled

我正在一个多租户团队应用程序中工作,并且想要使用 SSO 向机器人添加一个选项卡。在我的开发环境中,这一切都工作正常,我可以毫无问题地登录。当我将其部署到 QA 环境时,出现以下错误

AUTHMSAL: Event: adal:tokenRenewFailure, code: invalid_resource|AADSTS500011: The resource principal named api://[mydomain]/[myappid] was not found in the tenant named [tenant]. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You might have sent your authentication request to the wrong tenant.
Trace ID: d9eae514-36e0-4c28-afeb-3312133b0a01
Correlation ID: 82e84904-a4ef-490a-a114-b5efb68eb701
Timestamp: 2021-05-14 15:22:47Z, resource: api://[mydomain]/[myappid], action: resourceDisabled
Run Code Online (Sandbox Code Playgroud)

我不确定为什么会失败。我已在 QA 中检查了租户,并确认我的应用程序列在“企业应用程序”下,并且权限已获得同意,并获得了管理员同意。我还检查了我的开发环境和 qa 环境的应用程序注册设置是否存在任何差异(除了 URI 名称),结果没有任何差异。

这是我用来尝试检索 …

reactjs botframework microsoft-teams

5
推荐指数
1
解决办法
4549
查看次数

C# StreamWriter 以日语输出

出于某种奇怪的原因,我正在从 .txt(记事本)文件中读取数据,我只想去掉第一个 5 位数字。程序运行后,我的输出文件以我认为是日语的格式打印。我将在下面发布一些代码以及示例输入和输出。任何帮助将不胜感激追查为什么会发生这种情况。谢谢你。

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace BasicFileStripper
{
class Program
{
    static void Main(string[] args)
    {
        //var encoding = new ASCIIEncoding();
        StreamWriter write = new StreamWriter(@"C:\Users\Josh\Desktop\MillerEpicOutputs\ClientIds.txt");
        StreamReader read = new StreamReader(@"C:\Users\Josh\Desktop\MillerEpicOutputs\j.txt");//, encoding);
        string line;
        int count = 0;
        write.Write("{");
        while ((line = read.ReadLine()) != null)
        {
            count++;
            string copy = line.Substring(0, 5);
            write.Write(copy + ",");
            Console.WriteLine(line);
        }
        write.WriteLine("};");
        write.WriteLine("Count: " + count);
        write.Close();
    }
}
}
Run Code Online (Sandbox Code Playgroud)

样本输入:

68669 - (DO NOT …
Run Code Online (Sandbox Code Playgroud)

c# streamwriter

2
推荐指数
1
解决办法
876
查看次数

标签 统计

c# ×2

.net ×1

botframework ×1

microsoft-teams ×1

mvvm ×1

reactjs ×1

streamwriter ×1

wpf ×1