Strahan
Member
- Joined
 - Mar 28, 2015
 
- Messages
 - 11
 
- Programming Experience
 - 3-5
 
Hi!  I use OBS to keep a video log of meetings I am in.  OBS saves as files like "2023-06-16 00:04:18.mkv".  Every couple days, I have to go through and rename them to reflect what the meeting was about.  It hit me today; I could leverage FileSystemWatcher to detect when videos are created then rename them immediately.  In the most basic form, these are the classes:
	
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
When the program opens, I get my notification.  I click the notification, nothing happens.  I fired up a test project and copied the notifications class and called send, and it worked when I clicked the notification.  It's making me crazy, I can't figure out why it works in my test program but not the other one.  Any ideas?
Thanks!
	
		
			
		
		
	
				
			
			
				C#:
			
		
		
		public partial class Primary : Form {
  public Primary() {
    InitializeComponent();
  }
  private void Primary_Load(object sender, EventArgs e) {
    Notifications.Send("Video Monitor", "Video created!");
  }
}
public class Notifications {
  private static NotifyIcon notifyIcon;
  private static Timer disposeTimer;
  public static void Send(string title, string content) {
    if (notifyIcon == null) {
      notifyIcon = new NotifyIcon();
      notifyIcon.Icon = SystemIcons.Information;
      notifyIcon.Visible = true;
      notifyIcon.Click += (sender, e) => {
        MessageBox.Show("CLICK");
      };
      disposeTimer = new Timer();
      disposeTimer.Interval = 10000;
      disposeTimer.Tick += (s, e) => {
        if (notifyIcon != null) {
          notifyIcon.Visible = false;
          notifyIcon.Dispose();
          notifyIcon = null;
        }
        disposeTimer.Stop();
      };
      disposeTimer.Start();
    }
    notifyIcon.BalloonTipTitle = title;
    notifyIcon.BalloonTipText = content;
    notifyIcon.ShowBalloonTip(5000);
  }
}
	Thanks!