예제 #1
0
 public NetworkOperator(
     IApplicationDialog dialogs,
     IDeviceManager deviceManager,
     NetworkService networkService)
 {
     this.dialogs        = dialogs;
     this.deviceManager  = deviceManager;
     this.networkService = networkService;
 }
        public static async ValueTask <T?> SelectItem <T>(
            this IApplicationDialog dialog,
            T[] values,
            Func <T, string> formatter,
            int selected = -1,
            string?title = null)
        {
            var items  = values.Select(formatter).ToArray();
            var result = await dialog.Select(items, selected, title);

            return(result >= 0 ? values[result] : default);
        public static ValueTask <int> Select <T>(
            this IApplicationDialog dialog,
            T[] values,
            Func <T, string> formatter,
            int selected = -1,
            string?title = null)
        {
            var items = values.Select(formatter).ToArray();

            return(dialog.Select(items, selected, title));
        }
 public DialogMenuViewModel(
     ApplicationState applicationState,
     IApplicationDialog dialog)
     : base(applicationState)
 {
     InformationCommand = MakeAsyncCommand(async() =>
     {
         await dialog.Information("message");
     });
     ConfirmCommand = MakeAsyncCommand(async() =>
     {
         var ret = await dialog.Confirm("message");
         await dialog.Information($"result=[{ret}]");
     });
     SelectCommand = MakeAsyncCommand(async() =>
     {
         selected = await dialog.Select(Enumerable.Range(1, 15).Select(x => $"Item-{x}").ToArray(), selected);
         await dialog.Information($"result=[{selected}]");
     });
 }
예제 #5
0
    public void ShowDialog <T>(ViewModelBase viewModel) where T : IApplicationDialog
    {
        IApplicationDialog dialog = (IApplicationDialog)Activator.CreateInstance(typeof(T));

        dialog.Show();
    }