コード例 #1
0
        public void Show(NotifyType type, string header, string body, Action activated, Action <Exception> failed = null)
        {
            try
            {
                if (HoppoPluginSettings.Current.EnableSoundNotify)
                {
                    mp.Dispatcher.Invoke(new Action(() =>
                    {
                        var Audiofile = GetRandomSound(type.ToString());
                        mp.Close();
                        mp.Volume = HoppoPluginSettings.Current.Volume;
                        mp.Open(new Uri(UniversalConstants.CurrentDirectory + Audiofile));
                        mp.Play();
                    }));
                }
            }

            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                notifyIcon.ShowBalloonTip(5000, "ERROR", ex.ToString(), ToolTipIcon.Error);
            }

            if (this.notifyIcon == null)
            {
                return;
            }

            if (activated != null)
            {
                this.notifyIcon.BalloonTipClicked -= this.activatedAction;

                this.activatedAction = (sender, args) => activated();
                this.notifyIcon.BalloonTipClicked += this.activatedAction;
            }
            notifyIcon.ShowBalloonTip(5000, header, body, ToolTipIcon.Info);
        }
コード例 #2
0
ファイル: btprint.cs プロジェクト: hjgode/BT_Printer_Demo
 /// <summary>
 /// Used to display messages to the user
 /// </summary>
 /// <param name="strMessage"></param>
 /// <param name="type"></param>
 public void NotifyUser(string strMessage, NotifyType type)
 {
     System.Diagnostics.Debug.WriteLine(type.ToString() + ":" + strMessage);
 }
コード例 #3
0
ファイル: Notify.cs プロジェクト: olegp306/ToyCorp2017
 public static string FormatMessage(NotifyType notifyType, string message)
 {
     return(String.Format("<div class=\"notify-item type-{0}\">{1}<div class=\"close\"></div></div>", notifyType.ToString().ToLower(), message));
 }
コード例 #4
0
 public void Notify(string message, NotifyType type = NotifyType.Success, NotifyPosition position = NotifyPosition.TopRight)
 {
     TempData["Notify_Message"]  = message;
     TempData["Notify_Type"]     = type.ToString().Uncapitalize();
     TempData["Notify_Position"] = position.ToString().Uncapitalize();
 }
コード例 #5
0
ファイル: Notify.cs プロジェクト: AzarinSergey/learn
 public static string ShowMessage(NotifyType notifyType, string message)
 {
     return String.Format("<div class=\"notify-item type-{0}\">{1}<div class=\"close\"></div></div>", notifyType.ToString().ToLower(), message);
 }
コード例 #6
0
        public void SendNotification(int iUserID, string sUserName)
        {
            MethodBase lmth          = MethodBase.GetCurrentMethod();
            string     lsRoutineName = lmth.DeclaringType + "." + lmth.Name;

            if (NotifyType == cNotificationTypes.NOTSPECIFIED)
            {
                throw new System.Exception("The NotifyType must be specified to be able to send a notification to the user.");
            }

            SortedList sParam = new SortedList();

            sParam.Add("@UserID", iUserID);
            DataTable dtPref = cUtilities.LoadDataTable("uspGetPlayerNotificationPrefs", sParam, "LARPortal", sUserName, lsRoutineName);

            dtPref.CaseSensitive = false;
            DataView dvPref = new DataView(dtPref, "NotificationCode = '" + NotifyType.ToString() + "' and isnull(DeliveryMethod,'NONE') <>  'NONE'", "", DataViewRowState.CurrentRows);

            if (dvPref.Count > 0)
            {
                string sNotifyType = dvPref[0]["DeliveryMethod"].ToString().ToUpper();
                string sAddress    = "";
                string sCallingJob = "";

                sCallingJob = dvPref[0]["CallingJob"].ToString();

                if (sNotifyType.StartsWith("T"))
                {
                    sAddress = dvPref[0]["TextAddress"].ToString();
                    if (dvPref[0]["TextAddress"].ToString().Length > 0)
                    {
                        if (SubjectText.Length == 0)
                        {
                            // If there is nothing in the current subject text and the text address on the record > '' set the subject text.
                            SubjectText = dvPref[0]["TextMessageText"].ToString();
                            //                        sAddress = dvPref[0]["TextAddress"].ToString();
                        }
                    }

                    if (SubjectText.Length == 0)
                    {
                        // If the subject is blank (wasn't specified or was blank in the record) use the Email settings.
                        sNotifyType = "Email";
                    }
                }

                if (sNotifyType.StartsWith("E"))
                {
                    // Either the user specified Email, or there's missing information from the text address.
                    sAddress = dvPref[0]["EMailAddress"].ToString();
                    if (SubjectText.Length == 0)
                    {
                        SubjectText = dvPref[0]["EMailSubjectText"].ToString();
                    }
                    if (EMailBody.Length == 0)
                    {
                        EMailBody = dvPref[0]["EMailMessageText"].ToString();
                    }

                    // If the subject is blank, use the first 100 characters from the body of the email.
                    if (SubjectText.Length == 0)
                    {
                        // Take the first 100 character from body.
                        SubjectText = (EMailBody.Length <= 100 ? EMailBody : EMailBody.Substring(0, 100));
                    }
                }

                if ((sAddress.Length > 0) &&
                    (SubjectText.Length > 0) &&
                    (sCallingJob.Length > 0))
                {
                    Classes.cEmailMessageService cEMS = new Classes.cEmailMessageService();
                    cEMS.SendMail(SubjectText, EMailBody, sAddress, "", "", sCallingJob, sUserName);
                }
            }
        }
コード例 #7
0
ファイル: LtaController.cs プロジェクト: eallegretta/LtaBlog
 public void Notify(string message, NotifyType type = NotifyType.Success, NotifyPosition position = NotifyPosition.TopRight)
 {
     TempData["Notify_Message"] = message;
     TempData["Notify_Type"] = type.ToString().Uncapitalize();
     TempData["Notify_Position"] = position.ToString().Uncapitalize();
 }
コード例 #8
0
ファイル: CSSMS.cs プロジェクト: ronripp/CStat
        public CSResult NotifyUser(string username, NotifyType nt, string msg, bool allowResend, bool cleanLog)
        {
            var Settings = CSSettings.GetCSSettings(_config, _userManager);

            var u = Settings.GetUser(username);

            if ((u == null) || (u.PhoneNum.Length < 7))
            {
                var csRes = new CSResult();
                csRes.Set(false, ((u == null) ? "No user found" : "No phone # found."), nt.ToString() + ">" + username, "");
                return(csRes);
            }

            return(SendMessage(u.PhoneNum, msg, allowResend, cleanLog));
        }
コード例 #9
0
 /// <summary>
 ///     新增訊息提示
 /// </summary>
 /// <param name="type">訊息類別<see cref="NotifyType" /></param>
 /// <param name="message"></param>
 protected void AddNotify(NotifyType type, string message)
 {
     TempData["Msg.Type"]    = type.ToString().ToLower();
     TempData["Msg.Title"]   = type.GetDescription();
     TempData["Msg.Message"] = message;
 }