protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); bool createNew; _oneInstanceMutex = new Mutex(false, "BgInfo_OneInstanceMutex", out createNew); if (!createNew) { Shutdown(); return; } _mgr = new BgInfoManager(); _mgr.CreateWindows(); _mgr.InitTray(); }
/// <summary> /// Application start up (MAIN) event /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { /// load the Windows Minibar Icon DynamicVals.DecodeComputerName(); nicon.Icon = new System.Drawing.Icon("EITlogo.ico"); nicon.Visible = true; nicon.Click += nIcon_Click; base.OnStartup(e); nicon.Text = "Robin Sebastian 2018: HorizonTCBGviewer"; // set of a mutex to allow to the app only once at the same time bool createNew; _oneInstanceMutex = new Mutex(false, "BgInfo_OneInstanceMutex", out createNew); if (!createNew) { Shutdown(); return; } // configure a Upate Event timer to upate the Backround image after 5mins // this should help slower computer to start the seoson complite before the backround // image is changed BGhandler = new BGPichtureUpdateHandler(); BGhandler.NotificationUdadateEvent += BGhandler_NotificationUdadateEvent; if (!(BGhandler.HandelRefrech(false))) { _timer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(5) }; _timer.Tick += _timer_Tick; _timer.Start(); } _mgr = new BgInfoManager(); _mgr.CreateWindows(); NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged; }