コード例 #1
0
 public KernelEdit(KernelViewModel vm)
 {
     this.DataContext = vm;
     InitializeComponent();
     this.CbCoins.SelectedItem = CoinViewModel.PleaseSelect;
     ResourceDictionarySet.Instance.FillResourceDic(this, this.Resources);
 }
コード例 #2
0
        public MainWindow(IProject project, IProjectFile file)
        {
            InitializeComponent();

            Kernel      = new KernelViewModel(project, file);
            DataContext = Kernel;
        }
コード例 #3
0
 public static void ShowEditWindow(KernelViewModel source)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         IconName       = "Icon_Kernel",
         IsDialogWindow = true,
         Width          = 580,
         Height         = 400,
         CloseVisible   = System.Windows.Visibility.Visible
     }, ucFactory: (window) => {
         KernelViewModel vm = new KernelViewModel(source);
         vm.CloseWindow     = () => window.Close();
         return(new KernelEdit(vm));
     }, fixedSize: false);
 }
コード例 #4
0
ファイル: KernelEdit.xaml.cs プロジェクト: bxlkm1/NtMiner
 public static void ShowWindow(FormType formType, KernelViewModel source)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         Title           = "内核",
         FormType        = formType,
         IconName        = "Icon_Kernel",
         IsMaskTheParent = true,
         Width           = 620,
         CloseVisible    = Visibility.Visible
     }, ucFactory: (window) => {
         KernelViewModel vm = new KernelViewModel(source);
         window.AddCloseWindowOnecePath(vm.Id);
         return(new KernelEdit(vm));
     }, fixedSize: false);
 }
コード例 #5
0
 public static void ShowWindow(FormType formType, KernelViewModel source)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         Title          = "内核",
         FormType       = formType,
         IconName       = "Icon_Kernel",
         IsDialogWindow = true,
         Width          = 620,
         CloseVisible   = Visibility.Visible
     }, ucFactory: (window) => {
         KernelViewModel vm = new KernelViewModel(source)
         {
             CloseWindow = () => window.Close()
         };
         return(new KernelEdit(vm));
     }, fixedSize: false);
 }
コード例 #6
0
 public static void ShowWindow(FormType formType, KernelViewModel source)
 {
     ContainerWindow.ShowWindow(new ContainerWindowViewModel {
         Title           = "内核",
         FormType        = formType,
         IconName        = "Icon_Kernel",
         IsMaskTheParent = true,
         Width           = 620,
         CloseVisible    = Visibility.Visible
     }, ucFactory: (window) => {
         KernelViewModel vm = new KernelViewModel(source);
         window.AddOnecePath <CloseWindowCommand>("处理关闭窗口命令", LogEnum.DevConsole, action: message => {
             window.Close();
         }, pathId: vm.Id, location: typeof(KernelEdit));
         return(new KernelEdit(vm));
     }, fixedSize: false);
 }
コード例 #7
0
        public static void ShowEditWindow(KernelViewModel source)
        {
            string title;

            if (!DevMode.IsDevMode)
            {
                title = "内核详情";
            }
            else
            {
                if (NTMinerRoot.Current.KernelSet.Contains(source.Id))
                {
                    title = "编辑内核";
                }
                else
                {
                    title = "添加内核";
                }
            }
            ContainerWindow.ShowWindow(new ContainerWindowViewModel {
                Title          = title,
                IconName       = "Icon_Kernel",
                IsDialogWindow = true,
                Width          = 660,
                Height         = 502,
                SaveVisible    = DevMode.IsDevMode ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed,
                CloseVisible   = System.Windows.Visibility.Visible,
                OnOk           = (uc) => {
                    var vm = ((KernelEdit)uc).Vm;
                    if (NTMinerRoot.Current.KernelSet.Contains(source.Id))
                    {
                        Global.Execute(new UpdateKernelCommand(vm));
                    }
                    else
                    {
                        Global.Execute(new AddKernelCommand(vm));
                    }
                    return(true);
                }
            }, ucFactory: (window) => {
                KernelViewModel vm = new KernelViewModel(source);
                return(new KernelEdit(vm));
            }, fixedSize: false);
        }
コード例 #8
0
        public static void ShowEditWindow(KernelViewModel source)
        {
            double width     = 660;
            double height    = 620;
            bool   fixedSize = false;

            if (!DevMode.IsDevMode)
            {
                width     = 0;
                height    = 0;
                fixedSize = true;
            }
            ContainerWindow.ShowWindow(new ContainerWindowViewModel {
                IconName       = "Icon_Kernel",
                IsDialogWindow = true,
                Width          = width,
                Height         = height,
                CloseVisible   = System.Windows.Visibility.Visible
            }, ucFactory: (window) => {
                KernelViewModel vm = new KernelViewModel(source);
                vm.CloseWindow     = () => window.Close();
                return(new KernelEdit(vm));
            }, fixedSize: fixedSize);
        }
コード例 #9
0
ファイル: Messages.cs プロジェクト: vebin/ntminer
 public KernelEditCommand(FormType formType, KernelViewModel source)
 {
     this.FormType = formType;
     this.Source   = source;
 }
コード例 #10
0
 public KernelCopySourceSelectViewModel(KernelViewModel kernelVm)
 {
     this.KernelVm = kernelVm;
 }
コード例 #11
0
ファイル: KernelEdit.xaml.cs プロジェクト: bxlkm1/NtMiner
 public KernelEdit(KernelViewModel vm)
 {
     this.DataContext = vm;
     InitializeComponent();
 }
コード例 #12
0
ファイル: KernelPage.xaml.cs プロジェクト: ayxcjqx/ntminer
 private void Current_IsDownloadingChanged(KernelViewModel obj)
 {
     Vm.OnPropertyChanged(nameof(Vm.DownloadingVms));
 }
コード例 #13
0
        public static void ShowWindow(KernelViewModel kernel, string tag)
        {
            KernelCopySourceSelect uc = null;

            ContainerWindow.ShowWindow(new ContainerWindowViewModel {
                Title          = "选择内核",
                IconName       = "Icon_Kernel",
                IsDialogWindow = true,
                CloseVisible   = System.Windows.Visibility.Visible
            }, ucFactory: (window) => {
                uc = new KernelCopySourceSelect(new KernelCopySourceSelectViewModel(kernel));
                return(uc);
            }, fixedSize: true);
            if (uc != null)
            {
                if (uc.Vm.SelectedKernelVm != null)
                {
                    var sourceVm = uc.Vm.SelectedKernelVm;
                    DialogWindow.ShowDialog(message: $"您确定从{sourceVm.FullName}复制内容吗?", title: "确认", onYes: () => {
                        if (tag == "basic")
                        {
                            kernel.HelpArg              = sourceVm.HelpArg;
                            kernel.Args                 = sourceVm.Args;
                            kernel.TotalSpeedPattern    = sourceVm.TotalSpeedPattern;
                            kernel.TotalSharePattern    = sourceVm.TotalSharePattern;
                            kernel.AcceptSharePattern   = sourceVm.AcceptSharePattern;
                            kernel.RejectSharePattern   = sourceVm.RejectSharePattern;
                            kernel.RejectPercentPattern = sourceVm.RejectPercentPattern;
                            kernel.GpuSpeedPattern      = sourceVm.GpuSpeedPattern;
                            kernel.IsSupportDualMine    = sourceVm.IsSupportDualMine;
                            kernel.DualFullArgs         = sourceVm.DualFullArgs;

                            kernel.DualTotalSpeedPattern    = sourceVm.DualTotalSpeedPattern;
                            kernel.DualTotalSharePattern    = sourceVm.DualTotalSharePattern;
                            kernel.DualAcceptSharePattern   = sourceVm.DualAcceptSharePattern;
                            kernel.DualRejectSharePattern   = sourceVm.DualRejectSharePattern;
                            kernel.DualRejectPercentPattern = sourceVm.DualRejectPercentPattern;
                            kernel.DualGpuSpeedPattern      = sourceVm.DualGpuSpeedPattern;
                        }
                        else if (tag == "output")
                        {
                            foreach (var item in NTMinerRoot.Current.KernelOutputTranslaterSet.GetKernelOutputTranslaters(sourceVm.Id))
                            {
                                var list  = NTMinerRoot.Current.KernelOutputTranslaterSet.GetKernelOutputTranslaters(kernel.Id);
                                var exist = list.FirstOrDefault(a => a.RegexPattern == item.RegexPattern);
                                if (exist != null)
                                {
                                    Global.Execute(new UpdateKernelOutputTranslaterCommand(new KernelOutputTranslaterViewModel(item)
                                    {
                                        Id       = exist.GetId(),
                                        KernelId = kernel.Id
                                    }));
                                }
                                else
                                {
                                    Global.Execute(new AddKernelOutputTranslaterCommand(new KernelOutputTranslaterViewModel(item)
                                    {
                                        Id       = Guid.NewGuid(),
                                        KernelId = kernel.Id
                                    }));
                                }
                            }
                            foreach (var item in NTMinerRoot.Current.KernelOutputFilterSet.GetKernelOutputFilters(sourceVm.Id))
                            {
                                var list  = NTMinerRoot.Current.KernelOutputFilterSet.GetKernelOutputFilters(kernel.Id);
                                var exist = list.FirstOrDefault(a => a.RegexPattern == item.RegexPattern);
                                if (exist != null)
                                {
                                    Global.Execute(new UpdateKernelOutputFilterCommand(new KernelOutputFilterViewModel(item)
                                    {
                                        Id       = exist.GetId(),
                                        KernelId = kernel.Id
                                    }));
                                }
                                else
                                {
                                    Global.Execute(new AddKernelOutputFilterCommand(new KernelOutputFilterViewModel(item)
                                    {
                                        Id       = Guid.NewGuid(),
                                        KernelId = kernel.Id
                                    }));
                                }
                            }
                        }
                    }, icon: "Icon_Confirm");
                }
            }
        }
コード例 #14
0
 public KernelEdit(KernelViewModel vm)
 {
     this.DataContext = vm;
     InitializeComponent();
     ResourceDictionarySet.Instance.FillResourceDic(this, this.Resources);
 }
コード例 #15
0
 public void OnIsDownloadingChanged(KernelViewModel kernelVm)
 {
     IsDownloadingChanged?.Invoke(kernelVm);
 }
コード例 #16
0
 public bool TryGetKernelVm(Guid kernelId, out KernelViewModel kernelVm)
 {
     return(_dicById.TryGetValue(kernelId, out kernelVm));
 }
コード例 #17
0
 public KernelEdit(KernelViewModel vm)
 {
     this.DataContext = vm;
     InitializeComponent();
     this.CbCoins.SelectedItem = CoinViewModel.PleaseSelect;
 }