private void spotifyPullNotification() { foreach (var theProcess in Process.GetProcesses()) { //if ((theProcess.MainModule.FileName.Split('\\')[theProcess.MainModule.FileName.Split('\\').Length - 1] == "spotify.exe") && (theProcess.MainWindowTitle != mainWindowTitleCurrent)) if (theProcess.ProcessName == "Spotify" && theProcess.MainWindowTitle != mainWindowTitleCurrent) { mainWindowTitleCurrent = theProcess.MainWindowTitle; String sArtist = mainWindowTitleCurrent.Split('-')[0]; //sArtist = sArtist.Remove(sArtist.Length - 2); String sSong = mainWindowTitleCurrent.Replace(mainWindowTitleCurrent.Split('-')[0] + " ", ""); Notification yepTheyExistStill = new Notification(sSong, sArtist, Image.FromFile(@"C:\ProjectSnowshoes\System\Media\Icons\Applications\Png\Spotify.png")); yepTheyExistStill.Show(); yepTheyExistStill.BringToFront(); } } }
private void notificationTimer_Tick(object sender, EventArgs e) { if (System.IO.File.ReadAllText("C:\\ProjectSnowshoes\\notification.txt") != Properties.Settings.Default.notificationtext) { String turntUp = System.IO.File.ReadAllText("C:\\ProjectSnowshoes\\notification.txt").Split('\n')[0]; String turntUpA = System.IO.File.ReadAllText("C:\\ProjectSnowshoes\\notification.txt").Split('\n')[1]; String turntUpAA = System.IO.File.ReadAllText("C:\\ProjectSnowshoes\\notification.txt").Split('\n')[2]; Notification notif = new Notification(turntUp, turntUpA, Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png")); notif.Show(); notif.BringToFront(); Properties.Settings.Default.notificationtext = System.IO.File.ReadAllText("C:\\ProjectSnowshoes\\notification.txt"); Properties.Settings.Default.Save(); if (n1a.Visible == false) { n1a.Visible = true; n1b.Visible = true; n1c.Visible = true; n1a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n1b.Text = turntUp; n1c.Text = turntUpA; nP1 = turntUpAA; } else if (n2a.Visible == false) { n2a.Visible = true; n2b.Visible = true; n2c.Visible = true; n2a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n2b.Text = turntUp; n2c.Text = turntUpA; nP2 = turntUpAA; } else if (n3a.Visible == false) { n3a.Visible = true; n3b.Visible = true; n3c.Visible = true; n3a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n3b.Text = turntUp; n3c.Text = turntUpA; nP3 = turntUpAA; } else if (n4a.Visible == false) { n4a.Visible = true; n4b.Visible = true; n4c.Visible = true; n4a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n4b.Text = turntUp; n4c.Text = turntUpA; nP4 = turntUpAA; } else if (n5a.Visible == false) { n5a.Visible = true; n5b.Visible = true; n5c.Visible = true; n5a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n5b.Text = turntUp; n5c.Text = turntUpA; nP5 = turntUpAA; } else if (n6a.Visible == false) { n6a.Visible = true; n6b.Visible = true; n6c.Visible = true; n6a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n6b.Text = turntUp; n6c.Text = turntUpA; nP6 = turntUpAA; } else if (n7a.Visible == false) { n7a.Visible = true; n7b.Visible = true; n7c.Visible = true; n7a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n7b.Text = turntUp; n7c.Text = turntUpA; nP7 = turntUpAA; } else { n1a.Image = Image.FromFile("C:\\ProjectSnowshoes\\notificationIcon.png"); n1b.Text = turntUp; n1c.Text = turntUpA; nP1 = turntUpAA; } } }