protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            //clean up notifyicon (would otherwise stay open until application finishes)
            MyNotifyIcon1.Dispose();
            MyNotifyIcon2.Dispose();

            base.OnClosing(e);
        }
        private async Task Login()
        {
            try
            {
                string mobile = this.txtMobile.Text.Trim(), password = this.txtPassword.Password;
                if (mobile.Length == 0 || password.Length == 0)
                {
                    MyNotifyIcon2.ShowBalloonTip("تحذير", "الرجاء ملأ كافة الحقول", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Warning);
                    return;
                }
                this.LoginButton.Content   = "الرجاء الانتظار";
                this.LoginButton.IsEnabled = false;
                var val = await Task.Run(() => TamayozService.MySetting.PostLoginAPI(mobile, password));

                switch (val["Status"])
                {
                case "0":
                    MyNotifyIcon2.ShowBalloonTip("خطأ تسجيل الدخول", val["Message"], Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Error);
                    this.LoginButton.Content   = "تسجيل دخول";
                    this.LoginButton.IsEnabled = true;
                    break;

                case "1":
                    MyNotifyIcon2.ShowBalloonTip("مرحبا بك", val["Message"], MyNotifyIcon2.Icon, true);
                    PleaseWait pw = new PleaseWait();
                    pw.OnPopup += Pw_OnPopup;
                    pw.Show();
                    HideMe();
                    break;

                case "2":
                    MyNotifyIcon2.ShowBalloonTip("خطأ تسجيل الدخول", val["Message"], Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Error);
                    this.LoginButton.Content   = "تسجيل دخول";
                    this.LoginButton.IsEnabled = true;
                    break;

                default:
                    MyNotifyIcon2.ShowBalloonTip("خطأ اتصال", "حصل خطأ أثناء محاولة الاتصال الرجاء مراجعة المشرف ", Hardcodet.Wpf.TaskbarNotification.BalloonIcon.Error);
                    this.LoginButton.Content   = "تسجيل دخول";
                    this.LoginButton.IsEnabled = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("MainWindow: Login: " + ex.Message);
            }
        }
 private void Pw_OnPopup(object sender, PleaseWait.PopupEventArgs e)
 {
     try
     {
         Application.Current.Dispatcher.Invoke(() =>
         {
             Popup pu = new Popup(
                 e.Result["title"].ToString(),
                 e.Result["content"].ToString(),
                 e.Result["url"].ToString(),
                 e.Result["icon_url"].ToString(),
                 e.Result["notif_id"].ToString()
                 );
             pu.Show();
         });
         MyNotifyIcon2.ShowBalloonTip(e.Result["title"].ToString(), e.Result["content"].ToString(), MyNotifyIcon2.Icon, true);
     }
     catch (Exception ex)
     {
         //MessageBox.Show("MainWindow: Pw_OnPopup: " + ex.Message);
     }
 }