示例#1
0
 public override void Link()
 {
     VirtualRoot.Window <ShowDialogWindowCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             DialogWindow.ShowDialog(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon);
         });
     });
     VirtualRoot.Window <ShowQQGroupQrCodeCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             QQGroupQrCode.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowCalcCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             Calc.ShowWindow(message.CoinVm);
         });
     });
     VirtualRoot.Window <ShowFileDownloaderCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             FileDownloader.ShowWindow(message.DownloadFileUrl, message.FileTitle, message.DownloadComplete);
         });
     });
     VirtualRoot.Window <ShowCalcConfigCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             CalcConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowMinerClientsWindowCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             MinerClientsWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowNTMinerUpdaterConfigCommand>(LogEnum.DevConsole,
                                                          action: message => {
         UIThread.Execute(() => {
             NTMinerUpdaterConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowAboutPageCommand>(LogEnum.DevConsole,
                                               action: message => {
         UIThread.Execute(() => {
             AboutPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowKernelOutputPageCommand>(LogEnum.DevConsole,
                                                      action: message => {
         UIThread.Execute(() => {
             KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm);
         });
     });
     VirtualRoot.Window <ShowKernelInputPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             KernelInputPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowColumnsShowPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             ColumnsShowPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowGroupPageCommand>(LogEnum.DevConsole,
                                               action: message => {
         UIThread.Execute(() => {
             GroupPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowSysDicPageCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             SysDicPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowVirtualMemoryCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             VirtualMemory.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowRestartWindowsCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             RestartWindows.ShowDialog();
         });
     });
     VirtualRoot.Window <ShowNotificationSampleCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             NotificationSample.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowInnerPropertyCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             InnerProperty.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowChartsWindowCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             ChartsWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowOverClockDataPageCommand>(LogEnum.DevConsole,
                                                       action: message => {
         UIThread.Execute(() => {
             OverClockDataPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowUserPageCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             UserPage.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowKernelDownloaderCommand>(LogEnum.DevConsole,
                                                      action: message => {
         UIThread.Execute(() => {
             KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete);
         });
     });
     VirtualRoot.Window <EnvironmentVariableEditCommand>(LogEnum.DevConsole,
                                                         action: message => {
         UIThread.Execute(() => {
             EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable);
         });
     });
     VirtualRoot.Window <InputSegmentEditCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment);
         });
     });
     VirtualRoot.Window <CoinKernelEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             CoinKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <CoinEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             CoinEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ColumnsShowEditCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             ColumnsShowEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowContainerWindowCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             ContainerWindow window = ContainerWindow.GetWindow(message.Vm);
             window?.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowSpeedChartsCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             SpeedCharts.ShowWindow(message.GpuSpeedVm);
         });
     });
     VirtualRoot.Window <GroupEditCommand>(LogEnum.DevConsole,
                                           action: message => {
         UIThread.Execute(() => {
             GroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelInputEditCommand>(LogEnum.DevConsole,
                                                 action: message => {
         UIThread.Execute(() => {
             KernelInputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputFilterEditCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             KernelOutputFilterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputTranslaterEditCommand>(LogEnum.DevConsole,
                                                            action: message => {
         UIThread.Execute(() => {
             KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <KernelOutputEditCommand>(LogEnum.DevConsole,
                                                  action: message => {
         UIThread.Execute(() => {
             KernelOutputEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowPackagesWindowCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             PackagesWindow.ShowWindow();
         });
     });
     VirtualRoot.Window <KernelEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             KernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowLogColorCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             LogColor.ShowWindow();
         });
     });
     VirtualRoot.Window <ShowMinerClientSettingCommand>(LogEnum.DevConsole,
                                                        action: message => {
         UIThread.Execute(() => {
             MinerClientSetting.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.Window <ShowMinerNamesSeterCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             MinerNamesSeter.ShowWindow(message.Vm);
         });
     });
     VirtualRoot.Window <ShowGpuProfilesPageCommand>(LogEnum.DevConsole,
                                                     action: message => {
         UIThread.Execute(() => {
             GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm);
         });
     });
     VirtualRoot.Window <ShowMinerClientAddCommand>(LogEnum.DevConsole,
                                                    action: message => {
         UIThread.Execute(() => {
             MinerClientAdd.ShowWindow();
         });
     });
     VirtualRoot.Window <MinerGroupEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             MinerGroupEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <MineWorkEditCommand>(LogEnum.DevConsole,
                                              action: message => {
         UIThread.Execute(() => {
             MineWorkEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <OverClockDataEditCommand>(LogEnum.DevConsole,
                                                   action: message => {
         UIThread.Execute(() => {
             OverClockDataEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PackageEditCommand>(LogEnum.DevConsole,
                                             action: message => {
         UIThread.Execute(() => {
             PackageEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PoolKernelEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             PoolKernelEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <PoolEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             PoolEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <ShowControlCenterHostConfigCommand>(LogEnum.DevConsole,
                                                             action: message => {
         UIThread.Execute(() => {
             ControlCenterHostConfig.ShowWindow();
         });
     });
     VirtualRoot.Window <SysDicItemEditCommand>(LogEnum.DevConsole,
                                                action: message => {
         UIThread.Execute(() => {
             SysDicItemEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <SysDicEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             SysDicEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <UserEditCommand>(LogEnum.DevConsole,
                                          action: message => {
         UIThread.Execute(() => {
             UserEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <WalletEditCommand>(LogEnum.DevConsole,
                                            action: message => {
         UIThread.Execute(() => {
             WalletEdit.ShowWindow(message.FormType, message.Source);
         });
     });
     VirtualRoot.Window <UpgradeCommand>(LogEnum.DevConsole,
                                         action: message => {
         Upgrade(message.FileName, message.Callback);
     });
 }
示例#2
0
        public override void Link()
        {
            var location = this.GetType();

            VirtualRoot.AddCmdPath <ShowDialogWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    DialogWindow.ShowSoftDialog(new DialogWindowViewModel(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon));
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowQQGroupQrCodeCommand>(action: message => {
                UIThread.Execute(() => {
                    QQGroupQrCode.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCalcCommand>(action: message => {
                UIThread.Execute(() => {
                    Calc.ShowWindow(message.CoinVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowLocalIpsCommand>(action: message => {
                UIThread.Execute(() => {
                    LocalIpConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowEthNoDevFeeCommand>(action: message => {
                UIThread.Execute(() => {
                    EthNoDevFeeEdit.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCalcConfigCommand>(action: message => {
                UIThread.Execute(() => {
                    CalcConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerClientsWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNTMinerUpdaterConfigCommand>(action: message => {
                UIThread.Execute(() => {
                    NTMinerUpdaterConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowAboutPageCommand>(action: message => {
                UIThread.Execute(() => {
                    AboutPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelOutputPageCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelInputPageCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelInputPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowTagBrandCommand>(action: message => {
                if (NTMinerRoot.IsBrandSpecified)
                {
                    return;
                }
                UIThread.Execute(() => {
                    BrandTag.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCoinPageCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinPage.ShowWindow(message.CurrentCoin, message.TabType);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowGroupPageCommand>(action: message => {
                UIThread.Execute(() => {
                    GroupPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowSysDicPageCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowVirtualMemoryCommand>(action: message => {
                UIThread.Execute(() => {
                    VirtualMemory.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowRestartWindowsCommand>(action: message => {
                UIThread.Execute(() => {
                    RestartWindows.ShowDialog();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNotificationSampleCommand>(action: message => {
                UIThread.Execute(() => {
                    NotificationSample.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowPropertyCommand>(action: message => {
                UIThread.Execute(() => {
                    Property.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowChartsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    ChartsWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowOverClockDataPageCommand>(action: message => {
                UIThread.Execute(() => {
                    OverClockDataPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNTMinerWalletPageCommand>(action: message => {
                UIThread.Execute(() => {
                    NTMinerWalletPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMessagePathIdsCommand>(action: message => {
                UIThread.Execute(() => {
                    MessagePathIds.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowUserPageCommand>(action: message => {
                UIThread.Execute(() => {
                    UserPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowRemoteDesktopLoginDialogCommand>(action: message => {
                UIThread.Execute(() => {
                    RemoteDesktopLogin.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelsWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelDownloaderCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EnvironmentVariableEditCommand>(action: message => {
                UIThread.Execute(() => {
                    EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <InputSegmentEditCommand>(action: message => {
                UIThread.Execute(() => {
                    InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <CoinKernelEditCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinKernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <CoinEditCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ColumnsShowEditCommand>(action: message => {
                UIThread.Execute(() => {
                    ColumnsShowEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowSpeedChartsCommand>(action: message => {
                UIThread.Execute(() => {
                    SpeedCharts.ShowWindow(message.GpuSpeedVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowFileWriterPageCommand>(action: message => {
                UIThread.Execute(() => {
                    FileWriterPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <FileWriterEditCommand>(action: message => {
                UIThread.Execute(() => {
                    FileWriterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowFragmentWriterPageCommand>(action: message => {
                UIThread.Execute(() => {
                    FragmentWriterPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <FragmentWriterEditCommand>(action: message => {
                UIThread.Execute(() => {
                    FragmentWriterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <GroupEditCommand>(action: message => {
                UIThread.Execute(() => {
                    GroupEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ServerMessageEditCommand>(action: message => {
                UIThread.Execute(() => {
                    ServerMessageEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <KernelInputEditCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelInputEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <KernelOutputKeywordEditCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputKeywordEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <KernelOutputTranslaterEditCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <KernelOutputEditCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowPackagesWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    PackagesWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <KernelEditCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientSettingCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerClientSetting.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerNamesSeterCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerNamesSeter.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowGpuProfilesPageCommand>(action: message => {
                UIThread.Execute(() => {
                    GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientAddCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerClientAdd.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <MinerGroupEditCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerGroupEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <NTMinerWalletEditCommand>(action: message => {
                UIThread.Execute(() => {
                    NTMinerWalletEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <MineWorkEditCommand>(action: message => {
                UIThread.Execute(() => {
                    MineWorkEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <OverClockDataEditCommand>(action: message => {
                UIThread.Execute(() => {
                    OverClockDataEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <PackageEditCommand>(action: message => {
                UIThread.Execute(() => {
                    PackageEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <PoolKernelEditCommand>(action: message => {
                UIThread.Execute(() => {
                    PoolKernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <PoolEditCommand>(action: message => {
                UIThread.Execute(() => {
                    PoolEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <SysDicItemEditCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicItemEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <SysDicEditCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelOutputKeywordsCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputKeywords.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <UserEditCommand>(action: message => {
                UIThread.Execute(() => {
                    UserEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <WalletEditCommand>(action: message => {
                UIThread.Execute(() => {
                    WalletEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
        }
示例#3
0
        public override void BuildPaths()
        {
            var location = this.GetType();

            VirtualRoot.AddCmdPath <ShowDialogWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    DialogWindow.ShowSoftDialog(new DialogWindowViewModel(message: message.Message, title: message.Title, onYes: message.OnYes, icon: message.Icon));
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCalcCommand>(action: message => {
                UIThread.Execute(() => {
                    Calc.ShowWindow(message.CoinVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowLocalIpsCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerClientUcs.LocalIpConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowAboutPageCommand>(action: message => {
                UIThread.Execute(() => {
                    AboutPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelOutputPageCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputPage.ShowWindow(message.SelectedKernelOutputVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelInputPageCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelInputPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowTagBrandCommand>(action: message => {
                if (NTMinerContext.IsBrandSpecified)
                {
                    return;
                }
                UIThread.Execute(() => {
                    BrandTag.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCoinPageCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinPage.ShowWindow(message.CurrentCoin, message.TabType);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCoinGroupsCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinGroupPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowSysDicPageCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowVirtualMemoryCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerClientUcs.VirtualMemory.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowRestartWindowsCommand>(action: message => {
                UIThread.Execute(() => {
                    RestartWindows.ShowDialog(new RestartWindowsViewModel(message.CountDownSeconds));
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNotificationSampleCommand>(action: message => {
                UIThread.Execute(() => {
                    NotificationSample.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowPropertyCommand>(action: message => {
                UIThread.Execute(() => {
                    Property.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMessagePathIdsCommand>(action: message => {
                UIThread.Execute(() => {
                    MessagePathIds.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelsWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelDownloaderCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelDownloading.ShowWindow(message.KernelId, message.DownloadComplete);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditEnvironmentVariableCommand>(action: message => {
                UIThread.Execute(() => {
                    EnvironmentVariableEdit.ShowWindow(message.CoinKernelVm, message.EnvironmentVariable);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditInputSegmentCommand>(action: message => {
                UIThread.Execute(() => {
                    InputSegmentEdit.ShowWindow(message.CoinKernelVm, message.Segment);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditCoinKernelCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinKernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditCoinCommand>(action: message => {
                UIThread.Execute(() => {
                    CoinEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowSpeedChartsCommand>(action: message => {
                UIThread.Execute(() => {
                    SpeedCharts.ShowWindow(message.GpuSpeedVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowFileWriterPageCommand>(action: message => {
                UIThread.Execute(() => {
                    FileWriterPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditFileWriterCommand>(action: message => {
                UIThread.Execute(() => {
                    FileWriterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowFragmentWriterPageCommand>(action: message => {
                UIThread.Execute(() => {
                    FragmentWriterPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditFragmentWriterCommand>(action: message => {
                UIThread.Execute(() => {
                    FragmentWriterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditGroupCommand>(action: message => {
                UIThread.Execute(() => {
                    GroupEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditServerMessageCommand>(action: message => {
                UIThread.Execute(() => {
                    ServerMessageEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditKernelInputCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelInputEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditKernelOutputKeywordCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputKeywordEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditKernelOutputTranslaterCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputTranslaterEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditKernelOutputCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowPackagesWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    PackagesWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditKernelCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditPackageCommand>(action: message => {
                UIThread.Execute(() => {
                    PackageEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditPoolKernelCommand>(action: message => {
                UIThread.Execute(() => {
                    PoolKernelEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditPoolCommand>(action: message => {
                UIThread.Execute(() => {
                    PoolEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditSysDicItemCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicItemEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditSysDicCommand>(action: message => {
                UIThread.Execute(() => {
                    SysDicEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowKernelOutputKeywordsCommand>(action: message => {
                UIThread.Execute(() => {
                    KernelOutputKeywords.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowSignUpPageCommand>(action: message => {
                UIThread.Execute(() => {
                    SignUpPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditWalletCommand>(action: message => {
                UIThread.Execute(() => {
                    WalletEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);

            #region MinerStudio
            VirtualRoot.AddCmdPath <ShowQQGroupQrCodeCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.QQGroupQrCode.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowCalcConfigCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.CalcConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioViews.MinerClientsWindow.ShowWindow(message.IsToggle);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNTMinerUpdaterConfigCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.NTMinerUpdaterConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientFinderConfigCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MinerClientFinderConfig.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowChartsWindowCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioViews.ChartsWindow.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowOverClockDataPageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.OverClockDataPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerStudioVirtualMemoryCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.VirtualMemory.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerStudioLocalIpsCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.LocalIpConfig.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowNTMinerWalletPageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.NTMinerWalletPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowUserPageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.UserPage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowGpuNamePageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.GpuNameCounts.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowChangePassword>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.ChangePassword.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowWsServerNodePageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.WsServerNodePage.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowRemoteDesktopLoginDialogCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.RemoteDesktopLogin.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientSettingCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MinerClientSetting.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerNamesSeterCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MinerNamesSeter.ShowWindow(message.Vm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowGpuProfilesPageCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.GpuProfilesPage.ShowWindow(message.MinerClientsWindowVm);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <ShowMinerClientAddCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MinerClientAdd.ShowWindow();
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditMinerGroupCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MinerGroupEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditNTMinerWalletCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.NTMinerWalletEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditMineWorkCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.MineWorkEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditOverClockDataCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.OverClockDataEdit.ShowWindow(message.FormType, message.Source);
                });
            }, location: location);
            VirtualRoot.AddCmdPath <EditColumnsShowCommand>(action: message => {
                UIThread.Execute(() => {
                    MinerStudioUcs.ColumnsShowEdit.ShowWindow(message.Source);
                });
            }, location: location);
            #endregion
        }
示例#4
0
        public CoinViewModel(Guid id)
        {
            _id = id;
            this.ApplyTemplateOverClock = new DelegateCommand <OverClockDataViewModel>((data) => {
                DialogWindow.ShowDialog(message: data.Tooltip, title: "确定应用该超频设置吗?", onYes: () => {
                    FillOverClock(data);
                    ApplyOverClock();
                }, icon: IconConst.IconConfirm);
            });
            this.ApplyCustomOverClock = new DelegateCommand(() => {
                DialogWindow.ShowDialog(message: $"确定应用您的自定义超频吗?", title: "确认自定义超频", onYes: () => {
                    ApplyOverClock();
                }, icon: IconConst.IconConfirm);
            });
            this.FillOverClockForm = new DelegateCommand <OverClockDataViewModel>((data) => {
                FillOverClock(data);
            });
            this.AddOverClockData = new DelegateCommand(() => {
                new OverClockDataViewModel(Guid.NewGuid())
                {
                    CoinId = this.Id
                }.Edit.Execute(FormType.Add);
            });
            this.Save = new DelegateCommand(() => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                if (NTMinerRoot.Current.CoinSet.Contains(this.Id))
                {
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                }
                else
                {
                    VirtualRoot.Execute(new AddCoinCommand(this));
                }
                CloseWindow?.Invoke();
            });
            this.ViewCoinInfo = new DelegateCommand(() => {
                Process.Start("https://www.feixiaohao.com/currencies/" + this.EnName + "/");
            });
            this.Edit = new DelegateCommand <FormType?>((formType) => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                CoinEdit.ShowWindow(formType ?? FormType.Edit, this);
            });
            this.Remove = new DelegateCommand(() => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                DialogWindow.ShowDialog(message: $"您确定删除{this.Code}币种吗?", title: "确认", onYes: () => {
                    VirtualRoot.Execute(new RemoveCoinCommand(this.Id));
                }, icon: IconConst.IconConfirm);
            });
            this.SortUp = new DelegateCommand(() => {
                CoinViewModel upOne = CoinViewModels.Current.AllCoins.OrderByDescending(a => a.SortNumber).FirstOrDefault(a => a.SortNumber < this.SortNumber);
                if (upOne != null)
                {
                    int sortNumber   = upOne.SortNumber;
                    upOne.SortNumber = this.SortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(upOne));
                    this.SortNumber = sortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                    CoinPageViewModel.Current.OnPropertyChanged(nameof(CoinPageViewModel.List));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.MainCoins));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.AllCoins));
                }
            });
            this.SortDown = new DelegateCommand(() => {
                CoinViewModel nextOne = CoinViewModels.Current.AllCoins.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.SortNumber > this.SortNumber);
                if (nextOne != null)
                {
                    int sortNumber     = nextOne.SortNumber;
                    nextOne.SortNumber = this.SortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(nextOne));
                    this.SortNumber = sortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                    CoinPageViewModel.Current.OnPropertyChanged(nameof(CoinPageViewModel.List));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.MainCoins));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.AllCoins));
                }
            });

            this.AddPool = new DelegateCommand(() => {
                int sortNumber = this.Pools.Count == 0 ? 1 : this.Pools.Max(a => a.SortNumber) + 1;
                new PoolViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(FormType.Add);
            });
            this.AddWallet = new DelegateCommand(() => {
                int sortNumber = this.Wallets.Count == 0 ? 1 : this.Wallets.Max(a => a.SortNumber) + 1;
                new WalletViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(FormType.Add);
            });
            this.AddCoinKernel = new DelegateCommand(() => {
                KernelSelect.ShowWindow(this);
            });
        }
示例#5
0
        public CoinViewModel(Guid id)
        {
            _id             = id;
            this.BrowseIcon = new DelegateCommand(() => {
                if (!DevMode.IsDevMode)
                {
                    return;
                }
                OpenFileDialog openFileDialog = new OpenFileDialog {
                    InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                    Filter           = "png (*.png)|*.png",
                    FilterIndex      = 1
                };
                if (openFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try {
                        string iconFileFullName = openFileDialog.FileName;
                        this.IconImageSource    = new Uri(iconFileFullName, UriKind.Absolute).ToString();
                        string pngFileName      = Path.GetFileName(iconFileFullName);
                        if (AppContext.Instance.CoinVms.AllCoins.Any(a => a.Icon == pngFileName && a.Id != this.Id))
                        {
                            throw new ValidationException("币种图标不能重名");
                        }
                        this.Icon = pngFileName;
                    }
                    catch (Exception e) {
                        Logger.ErrorDebugLine(e.Message, e);
                    }
                }
            });
            this.ApplyTemplateOverClock = new DelegateCommand <OverClockDataViewModel>((data) => {
                DialogWindow.ShowDialog(message: data.Tooltip, title: "确定应用该超频设置吗?", onYes: () => {
                    FillOverClock(data);
                    ApplyOverClock();
                }, icon: IconConst.IconConfirm);
            });
            this.ApplyCustomOverClock = new DelegateCommand(() => {
                DialogWindow.ShowDialog(message: $"确定应用您的自定义超频吗?", title: "确认自定义超频", onYes: () => {
                    ApplyOverClock();
                }, icon: IconConst.IconConfirm);
            });
            this.FillOverClockForm = new DelegateCommand <OverClockDataViewModel>((data) => {
                FillOverClock(data);
            });
            this.AddOverClockData = new DelegateCommand(() => {
                new OverClockDataViewModel(Guid.NewGuid())
                {
                    CoinId = this.Id
                }.Edit.Execute(FormType.Add);
            });
            this.Save = new DelegateCommand(() => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                if (NTMinerRoot.Instance.CoinSet.Contains(this.Id))
                {
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                }
                else
                {
                    VirtualRoot.Execute(new AddCoinCommand(this));
                }
                CloseWindow?.Invoke();
            });
            this.Edit = new DelegateCommand <FormType?>((formType) => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                CoinEdit.ShowWindow(formType ?? FormType.Edit, this);
            });
            this.Remove = new DelegateCommand(() => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                DialogWindow.ShowDialog(message: $"您确定删除{this.Code}币种吗?", title: "确认", onYes: () => {
                    VirtualRoot.Execute(new RemoveCoinCommand(this.Id));
                }, icon: IconConst.IconConfirm);
            });
            this.SortUp = new DelegateCommand(() => {
                CoinViewModel upOne = AppContext.Instance.CoinVms.AllCoins.OrderByDescending(a => a.SortNumber).FirstOrDefault(a => a.SortNumber < this.SortNumber);
                if (upOne != null)
                {
                    int sortNumber   = upOne.SortNumber;
                    upOne.SortNumber = this.SortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(upOne));
                    this.SortNumber = sortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                    AppContext.Instance.CoinVms.OnPropertyChanged(nameof(AppContext.CoinViewModels.MainCoins));
                    AppContext.Instance.CoinVms.OnPropertyChanged(nameof(AppContext.CoinViewModels.AllCoins));
                }
            });
            this.SortDown = new DelegateCommand(() => {
                CoinViewModel nextOne = AppContext.Instance.CoinVms.AllCoins.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.SortNumber > this.SortNumber);
                if (nextOne != null)
                {
                    int sortNumber     = nextOne.SortNumber;
                    nextOne.SortNumber = this.SortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(nextOne));
                    this.SortNumber = sortNumber;
                    VirtualRoot.Execute(new UpdateCoinCommand(this));
                    AppContext.Instance.CoinVms.OnPropertyChanged(nameof(AppContext.CoinViewModels.MainCoins));
                    AppContext.Instance.CoinVms.OnPropertyChanged(nameof(AppContext.CoinViewModels.AllCoins));
                }
            });

            this.AddPool = new DelegateCommand(() => {
                int sortNumber = this.Pools.Count == 0 ? 1 : this.Pools.Max(a => a.SortNumber) + 1;
                new PoolViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(FormType.Add);
            });
            this.AddWallet = new DelegateCommand(() => {
                int sortNumber = this.Wallets.Count == 0 ? 1 : this.Wallets.Max(a => a.SortNumber) + 1;
                new WalletViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(FormType.Add);
            });
        }
示例#6
0
        public CoinViewModel(Guid id)
        {
            _id = id;
            this.ViewCoinInfo = new DelegateCommand(() => {
                Process.Start("https://www.feixiaohao.com/currencies/" + this.EnName + "/");
            });
            this.Edit = new DelegateCommand(() => {
                CoinEdit.ShowEditWindow(this);
            });
            this.Remove = new DelegateCommand(() => {
                if (this.Id == Guid.Empty)
                {
                    return;
                }
                DialogWindow.ShowDialog(message: $"您确定删除{this.Code}币种吗?", title: "确认", onYes: () => {
                    Global.Execute(new RemoveCoinCommand(this.Id));
                }, icon: "Icon_Confirm");
            });
            this.SortUp = new DelegateCommand(() => {
                CoinViewModel upOne = CoinViewModels.Current.AllCoins.OrderByDescending(a => a.SortNumber).FirstOrDefault(a => a.SortNumber < this.SortNumber);
                if (upOne != null)
                {
                    int sortNumber   = upOne.SortNumber;
                    upOne.SortNumber = this.SortNumber;
                    Global.Execute(new UpdateCoinCommand(upOne));
                    this.SortNumber = sortNumber;
                    Global.Execute(new UpdateCoinCommand(this));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.AllCoins));
                }
            });
            this.SortDown = new DelegateCommand(() => {
                CoinViewModel nextOne = CoinViewModels.Current.AllCoins.OrderBy(a => a.SortNumber).FirstOrDefault(a => a.SortNumber > this.SortNumber);
                if (nextOne != null)
                {
                    int sortNumber     = nextOne.SortNumber;
                    nextOne.SortNumber = this.SortNumber;
                    Global.Execute(new UpdateCoinCommand(nextOne));
                    this.SortNumber = sortNumber;
                    Global.Execute(new UpdateCoinCommand(this));
                    CoinViewModels.Current.OnPropertyChanged(nameof(CoinViewModels.AllCoins));
                }
            });

            this.AddPool = new DelegateCommand(() => {
                int sortNumber = this.Pools.Count == 0 ? 1 : this.Pools.Max(a => a.SortNumber) + 1;
                new PoolViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(null);
            });
            this.AddWallet = new DelegateCommand(() => {
                int sortNumber = this.Wallets.Count == 0 ? 1 : this.Wallets.Max(a => a.SortNumber) + 1;
                new WalletViewModel(Guid.NewGuid())
                {
                    CoinId     = Id,
                    SortNumber = sortNumber
                }.Edit.Execute(null);
            });
            this.AddCoinKernel = new DelegateCommand(() => {
                KernelSelect.ShowWindow(this);
            });
        }
示例#7
0
        private void UpdatePlaygroundObjects()
        {
            foreach (var tileEdit in _tileEdits)
            {
                if (tileEdit.Rectangle.IsMouseOver)
                {
                    switch (_selectedItem)
                    {
                    case SelectedItem.Wall:
                        tileEdit.IsWall         = true;
                        tileEdit.HasCoin        = tileEdit.HasObstacle =
                            tileEdit.IsEnd      = tileEdit.IsStart = tileEdit.IsSpawn = false;
                        tileEdit.Rectangle.Fill = Brushes.Black;
                        break;

                    case SelectedItem.Obstacle:
                        if (!tileEdit.IsWall && !tileEdit.HasCoin && !tileEdit.IsStart && !tileEdit.IsEnd &&
                            !tileEdit.IsSpawn)
                        {
                            tileEdit.HasObstacle = true;
                            var obs = new ObstacleEdit(tileEdit.Rectangle.Width * .8,
                                                       tileEdit.Rectangle.Height * .8, tileEdit.X + (tileEdit.Rectangle.Width * .1),
                                                       tileEdit.Y + (tileEdit.Rectangle.Height * .1));
                            _obstacleEdits.Add(obs);
                            Canvas.SetTop(obs.Ellipse, obs.Y);
                            Canvas.SetLeft(obs.Ellipse, obs.X);
                            _editorView.EditorCanvas.Children.Add(obs.Ellipse);
                            _tileObstacleEdits.Add(new TileObstacleEdit(tileEdit, obs));
                        }

                        break;

                    case SelectedItem.Coin:
                        if (!tileEdit.IsWall && !tileEdit.HasObstacle && !tileEdit.IsStart && !tileEdit.IsEnd &&
                            !tileEdit.IsSpawn)
                        {
                            tileEdit.HasCoin = true;
                            var coin = new CoinEdit(tileEdit.Rectangle.Width * .6, tileEdit.Rectangle.Height * .75,
                                                    tileEdit.X + (tileEdit.Rectangle.Width * .2),
                                                    tileEdit.Y + (tileEdit.Rectangle.Height * .15));
                            _coinEdits.Add(coin);
                            Canvas.SetTop(coin.Ellipse, coin.Y);
                            Canvas.SetLeft(coin.Ellipse, coin.X);
                            _editorView.EditorCanvas.Children.Add(coin.Ellipse);
                            _tileCoinEdits.Add(new TileCoinEdit(tileEdit, coin));
                        }

                        break;

                    case SelectedItem.End:
                        tileEdit.IsEnd          = true;
                        tileEdit.HasCoin        = tileEdit.HasObstacle =
                            tileEdit.IsWall     = tileEdit.IsStart = tileEdit.IsSpawn = false;
                        tileEdit.Rectangle.Fill = Brushes.Red;
                        _gotEnd = true;
                        break;

                    case SelectedItem.Start:
                        tileEdit.IsStart        = true;
                        tileEdit.HasCoin        = tileEdit.HasObstacle =
                            tileEdit.IsEnd      = tileEdit.IsWall = tileEdit.IsSpawn = false;
                        tileEdit.Rectangle.Fill = Brushes.Blue;
                        _gotStart = true;
                        break;

                    case SelectedItem.Spawn:
                        tileEdit.IsSpawn        = true;
                        tileEdit.HasCoin        = tileEdit.HasObstacle =
                            tileEdit.IsEnd      = tileEdit.IsWall = tileEdit.IsStart = false;
                        tileEdit.Rectangle.Fill = Brushes.SaddleBrown;
                        _gotSpawn = true;
                        break;

                    case SelectedItem.Erase:
                        if (tileEdit.IsSpawn)
                        {
                            _gotSpawn = false;
                        }

                        if (tileEdit.IsEnd)
                        {
                            _gotEnd = false;
                        }

                        if (tileEdit.IsStart)
                        {
                            _gotStart = false;
                        }

                        tileEdit.HasCoin        = tileEdit.HasObstacle =
                            tileEdit.IsEnd      = tileEdit.IsWall = tileEdit.IsStart = tileEdit.IsSpawn = false;
                        tileEdit.Rectangle.Fill = Brushes.Green;
                        break;
                    }
                }
            }

            foreach (var obstacleEdit in _obstacleEdits)
            {
                if (obstacleEdit.Ellipse.IsMouseOver)
                {
                    if (_selectedItem == SelectedItem.Erase)
                    {
                        //ze blijven wel in de array, maar voorzover ik zie boeit dan niet echt, boeit dus wel voor tileEdits, dit moet worden gematched en worden aangepast
                        foreach (var tileObstacleEdit in _tileObstacleEdits)
                        {
                            if (obstacleEdit.Equals(tileObstacleEdit.ObstacleEdit))
                            {
                                _tileEdits.Find(x => x.Equals(tileObstacleEdit.TileEdit)).HasObstacle = false;
                            }
                        }

                        _editorView.EditorCanvas.Children.Remove(obstacleEdit.Ellipse);
                    }
                }
            }

            foreach (var coinEdit in _coinEdits)
            {
                if (coinEdit.Ellipse.IsMouseOver)
                {
                    if (_selectedItem == SelectedItem.Erase)
                    {
                        //ze blijven wel in de array, maar voorzover ik zie boeit dan niet echt, boeit dus wel voor tileEdits, dit moet worden gematched en worden aangepast
                        foreach (var tileCoinEdit in _tileCoinEdits)
                        {
                            if (coinEdit.Equals(tileCoinEdit.CoinEdit))
                            {
                                _tileEdits.Find(x => x.Equals(tileCoinEdit.TileEdit)).HasCoin = false;
                            }
                        }

                        _editorView.EditorCanvas.Children.Remove(coinEdit.Ellipse);
                    }
                }
            }
        }