public static void ShowEditWindow(CoinKernelViewModel source) { string title; if (!DevMode.IsDevMode) { title = "内核详情"; } else { if (NTMinerRoot.Current.CoinKernelSet.Contains(source.Id)) { title = "编辑内核"; } else { title = "添加内核"; } } ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = title, IsDialogWindow = true, IconName = "Icon_Kernel", SaveVisible = DevMode.IsDevMode ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed, CloseVisible = System.Windows.Visibility.Visible, OnOk = (uc) => { var vm = ((CoinKernelEdit)uc).Vm; if (NTMinerRoot.Current.CoinKernelSet.Contains(source.Id)) { Global.Execute(new UpdateCoinKernelCommand(vm)); } return(true); } }, ucFactory: (window) => { CoinKernelViewModel vm = new CoinKernelViewModel(source); return(new CoinKernelEdit(vm)); }, fixedSize: true); }
public static void ShowWindow() { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "收益计算器设置", IconName = "Icon_Calc", Width = 600, Height = 600, IsMaskTheParent = false, IsChildWindow = true, CloseVisible = Visibility.Visible }, ucFactory: (window) => { var uc = new CalcConfig(); window.AddCloseWindowOnecePath(uc.Vm.Id); uc.ItemsControl.MouseDown += (object sender, MouseButtonEventArgs e) => { if (e.LeftButton == MouseButtonState.Pressed) { window.DragMove(); } }; return(uc); }, fixedSize: true); }
void Init(Object target, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver) { m_ModalUndoGroup = Undo.GetCurrentGroup(); // Freeze to prevent flicker on OSX. // Screen will be updated again when calling // SetFreezeDisplay(false) further down. ContainerWindow.SetFreezeDisplay(true); // Set member variables m_SearchField = string.Empty; m_MainTarget = target; InitListArea(); m_Presets = FindAllPresetsForObject(target); UpdateSearchResult(currentSelection != null ? currentSelection.GetInstanceID() : 0); m_EventObject = eventReceiver; m_CanCreateNew = createNewAllowed; ShowWithMode(ShowMode.AuxWindow); titleContent = EditorGUIUtility.TrTextContent("Select Preset"); // Deal with window size Rect rect = m_Parent.window.position; rect.width = EditorPrefs.GetFloat("PresetSelectorWidth", 200); rect.height = EditorPrefs.GetFloat("PresetSelectorHeight", 390); position = rect; minSize = new Vector2(kMinWidth, kMinTopSize + kPreviewExpandedAreaHeight + 2 * kPreviewMargin); maxSize = new Vector2(10000, 10000); // Focus Focus(); ContainerWindow.SetFreezeDisplay(false); // Add after unfreezing display because AuxWindowManager.cpp assumes that aux windows are added after we get 'got/lost'- focus calls. m_Parent.AddToAuxWindowList(); }
public static void ShowWindow(GpuSpeedViewModel gpuSpeedVm = null) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "算力图", IconName = "Icon_SpeedChart", Width = 760, Height = 460, CloseVisible = Visibility.Visible, FooterVisible = Visibility.Collapsed }, ucFactory: (window) => { SpeedCharts uc = new SpeedCharts(); return(uc); }, beforeShow: (window, uc) => { if (gpuSpeedVm != null) { SpeedChartViewModel item = uc.Vm.SpeedChartVms.Items.FirstOrDefault(a => a.GpuSpeedVm == gpuSpeedVm); if (item != null) { uc.Vm.CurrentSpeedChartVm = item; } } }, fixedSize: false); }
public static void ShowWindow(GpuSpeedViewModel gpuSpeedVm = null) { ContainerWindow.ShowWindow(new ContainerWindowViewModel() { IconName = "Icon_Speed", Width = 860, Height = 520, CloseVisible = Visibility.Visible, FooterVisible = Visibility.Collapsed }, ucFactory: (window) => { SpeedCharts uc = new SpeedCharts(); return(uc); }, beforeShow: (uc) => { if (gpuSpeedVm != null) { SpeedChartsViewModel vm = (SpeedChartsViewModel)uc.DataContext; SpeedChartViewModel item = vm.SpeedChartVms.FirstOrDefault(a => a.GpuSpeedVm == gpuSpeedVm); if (item != null) { vm.SetCurrentSpeedChartVm(item); } } }, fixedSize: false); }
public static void ShowWindow(FormType formType, MineWorkViewModel source) { string title = source.IsSelfMineWork ? "单机作业" : "挖矿作业 — 作业通常用于让不同的矿机执行同样的挖矿任务"; ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = title, FormType = formType, IsMaskTheParent = true, Width = 1000, Height = 560, CloseVisible = System.Windows.Visibility.Visible, FooterVisible = System.Windows.Visibility.Collapsed, IconName = "Icon_MineWork" }, ucFactory: (window) => { MineWorkViewModel vm = new MineWorkViewModel(source); window.Closed += (sender, e) => { vm.Save.Execute(null); }; NotiCenterWindow.Bind(window); return(new MineWorkEdit(vm)); }, beforeShow: (window, uc) => { NTMinerContext.RefreshArgsAssembly.Invoke("打开编辑挖矿作业页面时"); }, fixedSize: false); }
private void Init(UnityEngine.Object target, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver) { this.m_ModalUndoGroup = Undo.GetCurrentGroup(); ContainerWindow.SetFreezeDisplay(true); this.m_SearchField = string.Empty; this.m_MainTarget = target; this.InitListArea(); this.m_Presets = PresetSelector.FindAllPresetsForObject(target); this.UpdateSearchResult((!(currentSelection != null)) ? 0 : currentSelection.GetInstanceID()); this.m_EventObject = eventReceiver; this.m_CanCreateNew = createNewAllowed; base.ShowWithMode(ShowMode.AuxWindow); base.titleContent = EditorGUIUtility.TrTextContent("Select Preset", null, null); Rect position = this.m_Parent.window.position; position.width = EditorPrefs.GetFloat("PresetSelectorWidth", 200f); position.height = EditorPrefs.GetFloat("PresetSelectorHeight", 390f); base.position = position; base.minSize = new Vector2(200f, 335f); base.maxSize = new Vector2(10000f, 10000f); base.Focus(); ContainerWindow.SetFreezeDisplay(false); this.m_Parent.AddToAuxWindowList(); }
public static void ShowWindow(VirtualMemoryViewModel vm) { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "远程设置虚拟内存", IconName = "Icon_VirtualMemory", CloseVisible = Visibility.Visible, Width = 800, MinWidth = 450, Height = 360, MinHeight = 360, IsMaskTheParent = true, FooterVisible = Visibility.Collapsed }, ucFactory: (window) => { MinerStudioRoot.MinerStudioService.GetDrivesAsync(vm.MinerClientVm); window.BuildEventPath <GetDrivesResponsedEvent>("收到了GetDrives的响应时绑定到界面", LogEnum.DevConsole, path: message => { if (message.ClientId != vm.MinerClientVm.ClientId) { return; } vm.Drives = message.Data.Select(a => new DriveViewModel(a)).ToList(); }, typeof(VirtualMemory)); return(new VirtualMemory(vm)); }, fixedSize: false); }
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); }
public static void ShowWindow( string downloadFileUrl, string fileTitle, // window, isSuccess, message, saveFileFullName, etagValue Action <ContainerWindow, bool, string, string> downloadComplete) { UIThread.Execute(() => () => { ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = "下载器 - " + fileTitle, IconName = "Icon_Download", Height = 200, Width = 400, IsMaskTheParent = false, IsChildWindow = true, CloseVisible = System.Windows.Visibility.Visible, }, ucFactory: (window) => { FileDownloaderViewModel vm = new FileDownloaderViewModel(downloadFileUrl, (isSuccess, message, saveFileFullName) => { UIThread.Execute(() => () => { downloadComplete(window, isSuccess, message, saveFileFullName); }); }); return(new FileDownloader(vm)); }, fixedSize: true); }); }
void Start() { ContainerWindow.ActiveWindow = this; gameObject.SetActive(false); }
public void MaybeDownloadAndLaunchBTv(MainWindow parentWindow) { if (!BTVManager.IsBTVInstalled()) { if (this.sDownloading && this.sWindow != null) { BTVManager.BringToFront((CustomWindow)this.sWindow); } else { ExtensionPopupControl btvExtPopup = new ExtensionPopupControl(); btvExtPopup.LoadExtensionPopupFromFolder("BTVExtensionPopup"); System.Action action1; System.Action action2; btvExtPopup.DownloadClicked += (EventHandler)((o, e) => { BlueStacksUIUtils.CloseContainerWindow((FrameworkElement)btvExtPopup); this.sDownloading = true; this.sWindow = new CustomMessageWindow(); BlueStacksUIBinding.Bind(this.sWindow.TitleTextBlock, "STRING_BTV_DOWNLOAD", ""); BlueStacksUIBinding.Bind(this.sWindow.BodyTextBlock, "STRING_BTV_INSTALL_WAIT", ""); BlueStacksUIBinding.Bind(this.sWindow.BodyWarningTextBlock, "STRING_BTV_WARNING", ""); this.sWindow.AddButton(ButtonColors.Blue, "STRING_CANCEL", new EventHandler(this.CancelDownloadConfirmation), (string)null, false, (object)null, true); this.sWindow.BodyWarningTextBlock.Visibility = Visibility.Visible; this.sWindow.ProgressBarEnabled = true; this.sWindow.IsWindowMinizable = true; this.sWindow.IsWindowClosable = false; this.sWindow.ImageName = "BTVTopBar"; this.sWindow.ShowInTaskbar = true; this.sWindow.Owner = (Window)parentWindow; this.sWindow.IsShowGLWindow = true; this.sWindow.Show(); new Thread(closure_3 ?? (closure_3 = (ThreadStart)(() => { if (!string.IsNullOrEmpty(RegistryManager.Instance.BtvDevServer)) { BTVManager.sBTvUrl = RegistryManager.Instance.BtvDevServer; } string redirectedUrl = BTVManager.GetRedirectedUrl(BTVManager.sBTvUrl); if (redirectedUrl == null) { Logger.Error("The download url was null"); } else { string downloadPath = Path.Combine(Path.GetTempPath(), Path.GetFileName(new Uri(redirectedUrl).LocalPath)); this.sDownloader = new LegacyDownloader(3, redirectedUrl, downloadPath); this.sDownloader.Download((LegacyDownloader.UpdateProgressCallback)(percent => { // ISSUE: variable of a compiler-generated type BTVManager.\u003C\u003Ec__DisplayClass25_0 cDisplayClass250 = this; int percent1 = percent; // ISSUE: reference to a compiler-generated field this.sWindow.Dispatcher.Invoke((Delegate)(() => cDisplayClass250.\u003C\u003E4__this.sWindow.CustomProgressBar.Value = (double)percent1)); }), (LegacyDownloader.DownloadCompletedCallback)(filePath => { this.sWindow.Dispatcher.Invoke((Delegate)(action1 ?? (action1 = (System.Action)(() => { this.sWindow.CustomProgressBar.Value = 100.0; this.sWindow.Close(); })))); Logger.Info("Successfully downloaded BlueStacks TV"); this.sDownloading = false; BTVManager.ExtractBTv(downloadPath); parentWindow.Dispatcher.Invoke((Delegate)(action2 ?? (action2 = (System.Action)(() => parentWindow.mTopBar.mBtvButton.ImageName = "btv")))); }), (LegacyDownloader.ExceptionCallback)(ex => Logger.Error("Failed to download file: {0}. err: {1}", (object)downloadPath, (object)ex.Message)), (LegacyDownloader.ContentTypeCallback)null, (LegacyDownloader.SizeDownloadedCallback)null, (LegacyDownloader.PayloadInfoCallback)null); } }))) { IsBackground = true }.Start(); }); btvExtPopup.Height = parentWindow.ActualHeight * 0.8; btvExtPopup.Width = btvExtPopup.Height * 16.0 / 9.0; ContainerWindow containerWindow = new ContainerWindow(parentWindow, (System.Windows.Controls.UserControl)btvExtPopup, (double)(int)btvExtPopup.Width, (double)(int)btvExtPopup.Height, false, true, false, -1.0, (Brush)null); } } else { this.StartBlueStacksTV(); } }
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"); } } }
public static void ShowWindow(MinerClientsWindowViewModel minerClientsWindowVm) { if (minerClientsWindowVm.SelectedMinerClients == null && minerClientsWindowVm.SelectedMinerClients.Length != 1) { return; } var minerClientVm = minerClientsWindowVm.SelectedMinerClients[0]; ContainerWindow.ShowWindow(new ContainerWindowViewModel { Title = $"超频 - 基于矿机{minerClientVm.MinerName}({minerClientVm.MinerIp})", IconName = "Icon_OverClock", Width = 800, Height = 700, IsMaskTheParent = false, IsChildWindow = true, CloseVisible = Visibility.Visible, FooterVisible = Visibility.Collapsed }, ucFactory: (window) => { var vm = new GpuProfilesPageViewModel(minerClientsWindowVm); window.BuildCloseWindowOnecePath(vm.Id); var uc = new GpuProfilesPage(vm); var client = minerClientsWindowVm.SelectedMinerClients[0]; void onSelectedMinerClientsChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(minerClientsWindowVm.SelectedMinerClients)) { List <MinerClientViewModel> toRemoves = new List <MinerClientViewModel>(); foreach (var item in vm.MinerClientVms) { if (item != minerClientVm) { var exist = minerClientsWindowVm.SelectedMinerClients.FirstOrDefault(a => a == item); if (exist == null) { toRemoves.Add(item); } } } foreach (var item in toRemoves) { vm.MinerClientVms.Remove(item); } List <MinerClientViewModel> toAdds = new List <MinerClientViewModel>(); foreach (var item in minerClientsWindowVm.SelectedMinerClients) { var exist = vm.MinerClientVms.FirstOrDefault(a => a == item); if (exist == null) { toAdds.Add(item); } } foreach (var item in toAdds) { vm.MinerClientVms.Add(item); } } } minerClientsWindowVm.PropertyChanged += onSelectedMinerClientsChanged; uc.Unloaded += (object sender, RoutedEventArgs e) => { minerClientsWindowVm.PropertyChanged -= onSelectedMinerClientsChanged; }; window.BuildEventPath <GetGpuProfilesResponsedEvent>("收到GetGpuProfilesJson的响应", LogEnum.DevConsole, path: message => { if (message.ClientId != minerClientVm.ClientId) { return; } vm.SetData(message.Data); }, typeof(GpuProfilesPage)); MinerStudioRoot.MinerStudioService.GetGpuProfilesJsonAsync(minerClientVm); return(uc); }, fixedSize: false); }