public PowerMon() { this.InitializeComponent(); ViewModel = Monitor.ViewModel; OpenPower.MouseUp += OpenPowerClick; OpenCool.MouseUp += OpenCoolClick; StartupCheck.IsChecked = TaskTool.GetIsEnabled(); StartupCheck.Click += StartupCheck_Click; StartupCheck.Checked += StartupCheck_Checked; StartupCheck.Unchecked += StartupCheck_Unchecked; double screenWidth = SystemParameters.PrimaryScreenWidth; double screenHeight = SystemParameters.PrimaryScreenHeight; double windowWidth = this.Width; double windowHeight = this.Height; this.Left = screenWidth / 2d - windowWidth / 2d; this.Top = screenHeight / 2d - windowHeight / 2d; if (ViewModel.Initialized) { initVars(); } }
private static void Main(string[] args) { XTrace.UseConsole(true, true); XTrace.WriteLine("浏览器操作"); int p = XmlConfig <SeleniumConfig> .Current.PiHao; //string ph = DataFile.WtingRead("请输入配置文件 ", "输入的配置路径:", (string path) => (path.IndexOf(".config") == -1 ? false : XmlConfig<SeleniumConfig>.Current.Load(path))); string ph = @"Config\Selenium.config"; XTrace.WriteLine($"加载的配置地址:" + ph); XmlConfig <SeleniumConfig> .Current.Load(ph); XmlConfig <SeleniumConfig> .Current.ConfigFile = ph; XmlConfig <SeleniumConfig> .Current.Load(ph); XmlConfig <SeleniumConfig> .Current.ConfigFile = ph; XmlConfig <SeleniumConfig> .Current.Load(ph); TaskTool.AddHyDataConneStr(XmlConfig <SeleniumConfig> .Current.HyAccountDb); TaskTool.AddJiQiMaConnStr(XmlConfig <SeleniumConfig> .Current.JiQiMaDb); Program.ClearProcess(); Program.SetConsoleCtrlHandler(Program.cancelHandler, true); ModifyHead.LoadPicFileInfo(XmlConfig <SeleniumConfig> .Current.TouXiang); switch (DataFile.WtingReadInt("任务类型 0=刷活跃 1=快速注册 2=文本账号保存到数据库", "输入的任务类型:")) { case 0: { AutoHuoYueCaoZuo huoyue = new AutoHuoYueCaoZuo(); Program.AutoCaoZuo = huoyue; huoyue.Start(); break; } case 1: { int needCount = DataFile.WtingReadInt("需要注册的数量:", "输入的注册数量:"); AutoQuickReg reg = new AutoQuickReg(); Program.AutoCaoZuo = reg; reg.Start(needCount); break; } case 2: { AutoLoginTask Login = new AutoLoginTask(); Program.AutoCaoZuo = Login; Login.Start(); break; } } DataFile.WatingOut(); }
private async void removeTaskFromJobButton_Clicked(object sender, EventArgs e) { if (selectedTopTaskTool != null) { addedTaskTools.Remove(selectedTopTaskTool); ListviewPickerPopulate(); selectedTopTaskTool = null; TasksForThisJobListView.SelectedItem = null; } else { await Application.Current.MainPage.DisplayAlert("Alert", "Select a task above to remove from the job.", "Yes"); } }
private async void addTaskToTheJobButton_Clicked(object sender, EventArgs e) { if (selectedBottomTaskTool != null) { addedTaskTools.Add(selectedBottomTaskTool); ListviewPickerPopulate(); selectedBottomTaskTool = null; TotalTaskListview.SelectedItem = null; } else { await Application.Current.MainPage.DisplayAlert("Alert", "Select a task below to add to the job above.", "Yes"); } }
protected static void OnRunOnStartupChanged(object sender, DependencyPropertyChangedEventArgs e) { if (sender is TrippLiteViewModel vm && ((bool)e.NewValue != TaskTool.GetIsEnabled())) { var b = (bool)e.NewValue; // Launch itself as administrator ProcessStartInfo proc = new ProcessStartInfo(); proc.UseShellExecute = true; proc.WorkingDirectory = Environment.CurrentDirectory; proc.FileName = AppDomain.CurrentDomain.BaseDirectory + "\\" + AppDomain.CurrentDomain.FriendlyName + ".exe"; proc.Verb = "runas"; if (b) { proc.Arguments = "/erologin"; } else { proc.Arguments = "/drologin"; } try { var exec = Process.Start(proc); exec?.WaitForExit(); } catch { vm.RunOnStartup = TaskTool.GetIsEnabled(); return; } } }
private void TotalTaskListview_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) { selectedBottomTaskTool = e.ItemData as TaskTool; }
private void TasksForThisJobListView_ItemTapped(object sender, Syncfusion.ListView.XForms.ItemTappedEventArgs e) { selectedTopTaskTool = e.ItemData as TaskTool; }