/// <summary> /// this event is called after no network connection is avelibil /// to trigger a Windows notification /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void NetworkChange_NetworkAddressChanged(object sender, EventArgs e) { DynamicVals.GetIPaddrs(); if (DynamicVals.IP_Addrs == null || DynamicVals.IP_Addrs == String.Empty || DynamicVals.IP_Addrs == "NO CONNECTION") { if (!NETnotifcationOneTime) { nicon.ShowBalloonTip(5, "No Network Connection", "Please check the network connection of the client ", System.Windows.Forms.ToolTipIcon.Error); NETnotifcationOneTime = true; } } else { NETnotifcationOneTime = false; } }
/// <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; }