private void BtnNew_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(TxtFreeMemory.Text)) { // 新建任务。具体实现请见Gui/wizardWindow try { var wizard = new WizardWindow(wm); wizard.ShowDialog(); int activeTaskCount = tm.GetActiveTaskCount(); BtnRun.IsEnabled = activeTaskCount > 0; BtnDelete.IsEnabled = activeTaskCount > 0; BtnEmpty.IsEnabled = activeTaskCount > 0; BtnMoveDown.IsEnabled = activeTaskCount > 1; BtnMoveUp.IsEnabled = activeTaskCount > 1; BtnMoveTop.IsEnabled = activeTaskCount > 2; BtnChap.IsEnabled = activeTaskCount > 0; } catch (Exception ex) { Logger.Fatal(ex.StackTrace); Environment.Exit(0); } } else { MessageBox.Show("请输入系统可用空闲内存!", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BtnNew_Click(object sender, RoutedEventArgs e) { // 新建任务。具体实现请见Gui/wizardWindow try { var wizard = new WizardWindow(wm); wizard.ShowDialog(); BtnRun.IsEnabled = tm.HasNextTask(); BtnChap.IsEnabled = BtnRun.IsEnabled; tm.IsCanStart = true; } catch (Exception ex) { Logger.Fatal(ex.StackTrace); Environment.Exit(0); } }
private void BtnNew_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(TxtFreeMemory.Text)) { int availMB = WmiUtils.GetAvailablePhysicalMemory(); if (availMB < 0) { MessageBox.Show("无法获取当前空闲内存!请自行检查当前可用内存。", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); } else if (int.Parse(TxtFreeMemory.Text) < availMB) { Initializer.Config.memoryTotal = WmiUtils.GetTotalPhysicalMemory(); } else { MessageBox.Show("内存设置大于系统可用空闲内存!", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); return; } Initializer.Config.memoryLimit = int.Parse(TxtFreeMemory.Text); Initializer.WriteConfig(); // 新建任务。具体实现请见Gui/wizardWindow try { var wizard = new WizardWindow(wm); wizard.ShowDialog(); int activeTaskCount = tm.GetActiveTaskCount(); BtnRun.IsEnabled = activeTaskCount > 0; BtnDelete.IsEnabled = activeTaskCount > 0; BtnEmpty.IsEnabled = activeTaskCount > 0; BtnMoveDown.IsEnabled = activeTaskCount > 1; BtnMoveUp.IsEnabled = activeTaskCount > 1; BtnMoveTop.IsEnabled = activeTaskCount > 2; BtnChap.IsEnabled = activeTaskCount > 0; } catch (Exception ex) { Logger.Fatal(ex.StackTrace); Environment.Exit(0); } } else { MessageBox.Show("请输入系统可用空闲内存!", "OKEGui", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void BtnNew_Click(object sender, RoutedEventArgs e) { var wizard = new WizardWindow(ref tm); wizard.ShowDialog(); }