static void mgmtWtch_EventArrived(object sender, System.Management.EventArrivedEventArgs e) { PropertyData processName = e.NewEvent.Properties["ProcessName"]; string test = "nichts"; if (processName.Value.ToString() != null) { test = processName.Value.ToString(); } Console.WriteLine(test); if (test.Contains("League of Lege")) { if (e.NewEvent.ClassPath.ToString().Equals("Win32_ProcessStartTrace")) { Console.WriteLine("League of Legends launched"); ApiFetcher.getData(0, 3); } else { Console.WriteLine("League of Legends stopped"); FileWriter.WriteToFile("Not Ingame"); ApiFetcher.getData(); } } }
static void Main(string[] args) { var thread = new Thread(() => { Form1 form = new Form1(); ApiFetcher.registerEventHandler(form); Application.Run(form); }); thread.Start(); Thread.Sleep(2000); mgmtWtch = new System.Management.ManagementEventWatcher("Select * From Win32_ProcessStartTrace"); mgmtWtch.EventArrived += new System.Management.EventArrivedEventHandler(mgmtWtch_EventArrived); mgmtWtch.Start(); stopWatch = new System.Management.ManagementEventWatcher(" Select * From Win32_ProcessStopTrace"); stopWatch.EventArrived += new System.Management.EventArrivedEventHandler(mgmtWtch_EventArrived); stopWatch.Start(); var t = new Thread(() => ApiFetcher.getData(1, 1)); t.Start(); Process.GetCurrentProcess().WaitForExit(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox item = (ComboBox)sender; string selectedItem = (string)item.SelectedItem; textBox1.Text = selectedItem; ApiFetcher.CURRENT_SUMMONER = ApiFetcher.getSummonerID(selectedItem); }
private void button2_Click(object sender, EventArgs e) { updateLabel("loading"); RiotSharp.FeaturedGamesEndpoint.FeaturedGames testgame = ApiFetcher.api.GetFeaturedGames(RiotSharp.Region.euw); string sname = testgame.GameList[0].Participants[0].SummonerName; ApiFetcher.CURRENT_SUMMONER = ApiFetcher.api.GetSummoner(RiotSharp.Region.euw, sname).Id; //ApiFetcher.CURRENT_SUMMONER = 60077041; int result = ApiFetcher.getData(); ApiFetcher.getData(1, 1); }
private void button1_Click(object sender, EventArgs e) { updateLabel("loading"); ApiFetcher.CURRENT_SUMMONER = ApiFetcher.getSummonerID(textBox1.Text); ApiFetcher.getData(1, 1); }
public Form1() { InitializeComponent(); textBox1.Text = ApiFetcher.getSummonerName(ApiFetcher.CURRENT_SUMMONER); ApiFetcher.favlist.ForEach(item => comboBox1.Items.Add(ApiFetcher.getSummonerName(item))); }