public static void ShowWindow(Guid kernelId, Action <bool, string> downloadComplete = null) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "内核", IconName = "Icon_Logo", CloseVisible = Visibility.Visible, HeaderVisible = Visibility.Collapsed, FooterVisible = Visibility.Collapsed, Width = DevMode.IsDebugMode ? 1200 : AppStatic.MainWindowWidth, Height = AppStatic.MainWindowHeight }, ucFactory: (window) => { var uc = new KernelPage { CloseWindow = () => window.Close() }; return(uc); }, beforeShow: uc => { if (kernelId != Guid.Empty) { KernelPageViewModel vm = (KernelPageViewModel)uc.DataContext; vm.Download(kernelId, (isSuccess, message) => { if (isSuccess) { ((KernelPage)uc).CloseWindow(); } downloadComplete(isSuccess, message); }); } }, fixedSize: true); }
public static void ShowWindow(Guid kernelId, Action <bool, string> downloadComplete = null) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { IconName = "Icon_Kernels", CloseVisible = System.Windows.Visibility.Visible, HeaderVisible = System.Windows.Visibility.Collapsed, FooterVisible = System.Windows.Visibility.Collapsed, Width = (DevMode.IsDevMode ? 1160 : 860), Height = 520 }, ucFactory: (window) => { var uc = new KernelPage(); uc.CloseWindow = () => window.Close(); return(uc); }, beforeShow: uc => { if (kernelId != Guid.Empty) { KernelPageViewModel vm = (KernelPageViewModel)uc.DataContext; vm.Download(kernelId, (isSuccess, message) => { if (isSuccess) { ((KernelPage)uc).CloseWindow(); } downloadComplete(isSuccess, message); }); } }, fixedSize: true); }
public static void ShowWindow(Guid kernelId, Action <bool, string> downloadComplete = null) { if (_window == null) { _window = new KernelPage(); } _window.Show(); _window.Activate(); if (kernelId != Guid.Empty) { KernelPageViewModel vm = (KernelPageViewModel)_window.DataContext; vm.Download(kernelId, (isSuccess, message) => { if (isSuccess) { _window.Close(); } downloadComplete(isSuccess, message); }); } }