小编Mai*_*das的帖子

是否可以创建 GRPC 控制台应用程序作为服务器?

我正在使用 .NET Core 3.1,想要创建一个 GRPC 服务,其中控制台应用程序作为服务器,WPF 应用程序作为客户端。

我在网上看不到任何示例 - 由于某种原因,所有控制台应用程序似乎都连接并发送消息,没有一个是服务器。

是否可以让控制台应用程序启动服务并让 WPF 应用程序连接并向其发送消息?

我已经下载了下面的项目,并尝试看看是否可以让控制台应用程序作为服务器。[.NET Core 中的 GRPC][1]

任何指示表示赞赏。[1]: https: //www.jenx.si/2019/06/14/experimenting-with-grpc-in-net-core/

下面的控制台应用程序现在是服务器,但我无法在主函数中读取和存储来自客户端的有效负载 - 我可以看到它是从客户端接收的。

如何将来自客户端的有效负载消息存储在 Main 函数中?

//Console App Main function listening for

static async Task Main(string[] args)
{
        _gRpcServer = new Server
        {
            Services ={Jenx.Grpc.SimpleDemo.Contracts.JenxSimpleGrpcService.BindService(new ConsoleAppGrpcClient())},
            Ports = {new ServerPort("localhost", 505050, ServerCredentials.Insecure)}
        };
}

//receives Client Message successfully
public override Task<ReplyMessage> SendMessage(RequestMessage request, ServerCallContext context)
    {
        Console.WriteLine($"Message Received: {request.RequestPayload}");
        Console.WriteLine("Sending message back to the client...");

//<<---need to Store below in …
Run Code Online (Sandbox Code Playgroud)

c# wpf console-application grpc asp.net-core-3.1

9
推荐指数
2
解决办法
5996
查看次数

Angular2/4 mat-select多个ngModel

我有一个mat-select下拉列表,启用了多个,我使用NgModel来存储用户选择的值.

问题是,当我导航到另一个页面并返回时,用户选择的值不在mat-select中..我知道ngModel有这些值...我遗漏了一些东西......

HTML

<mat-form-field>
 <mat-select placeholder="Customers" name="customerDetails" ngDefaultControl       
 formControlName="customerDetails" [(ngModel)]="custonerDetails" 
 [formControl]="customerDetailsCtrl" multiple   
 (ngModelChange)="onCustomerValueChanges(customer)" >

  <mat-option *ngFor="let customer of customerDetailsResult"
  [value]="customer">{{customer.CustomerNo}}- 
                     {{customer.CustomerDescription}}
   </mat-option>
 </mat-select>
</mat-form-field>
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

angular-material angular2-forms angular2-ngmodel angular

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

WPF 条件工具提示

Textblock在网格内有一个,并且有一个ToolTip应该显示“工具提示”绑定,但如果它是NullEmpty它应该显示“名称”绑定。

我如何在 XAML 中实现这一目标?

<TextBlock Margin="3" TextAlignment="Left" VerticalAlignment="Center" FontSize="12" Foreground="Black" HorizontalAlignment="Left" ToolTip="{Binding Tooltip}" Text="{Binding Name}"/>

wpf binding tooltip

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