Ejemplo n.º 1
0
 public static void ShowWindow(Guid kernelId, Action <bool, string> downloadComplete)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         IsMaskTheParent = true,
         Title           = "下载挖矿内核",
         IconName        = "Icon_Download",
         Width           = 294,
         Height          = 120,
         CloseVisible    = System.Windows.Visibility.Visible,
         FooterVisible   = System.Windows.Visibility.Collapsed
     },
                                ucFactory: (window) => {
         var uc = new KernelDownloading {
             CloseWindow = window.Close
         };
         return(uc);
     },
                                beforeShow: (window, uc) => {
         if (kernelId != Guid.Empty)
         {
             uc.Vm.Download(kernelId, (isSuccess, message) => {
                 if (isSuccess)
                 {
                     uc.CloseWindow();
                 }
                 downloadComplete(isSuccess, message);
             });
             uc.Vm.OnPropertyChanged(nameof(uc.Vm.DownloadingVms));
         }
     }, fixedSize: true);
 }
 public static void ShowWindow(Guid kernelId, Action <bool, string> downloadComplete)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         IsDialogWindow = true,
         Title          = "下载挖矿内核",
         IconName       = "Icon_Download",
         CloseVisible   = System.Windows.Visibility.Visible,
         FooterVisible  = System.Windows.Visibility.Collapsed
     },
                                ucFactory: (window) => {
         var uc = new KernelDownloading {
             CloseWindow = window.Close
         };
         return(uc);
     },
                                beforeShow: uc => {
         if (kernelId != Guid.Empty)
         {
             var vm = (KernelDownloadingViewModel)uc.DataContext;
             vm.Download(kernelId, (isSuccess, message) => {
                 if (isSuccess)
                 {
                     ((KernelDownloading)uc).CloseWindow();
                 }
                 downloadComplete(isSuccess, message);
             });
             vm.OnPropertyChanged(nameof(vm.DownloadingVms));
         }
     }, fixedSize: true);
 }