示例#1
0
 public GingerHelperEventArgs(eGingerHelperEventActions EventAction, eGingerHelperMsgType messageType, RoutedEventHandler btnHandler = null, GingerHelperMsg helperMsg = null)
 {
     mHelperMsg = helperMsg;
     mGingerHelperEventActions = EventAction;
     mbtnHandler  = btnHandler;
     mMessageType = messageType;
 }
示例#2
0
        public static void ToGingerHelper(eGingerHelperMsgKey messageKey, RoutedEventHandler btnHandler = null, params object[] messageArgs)
        {
            GingerHelperMsg messageToShow     = null;
            string          messageContent    = string.Empty;
            string          orgMessageContent = string.Empty;

            try
            {
                //get the message from pool
                if ((GingerHelperMsgsPool != null) && GingerHelperMsgsPool.Keys.Contains(messageKey))
                {
                    messageToShow = GingerHelperMsgsPool[messageKey];
                }
                if (messageToShow == null)
                {
                    // We do want to pop the error message so below is just in case...
                    string mess = "";
                    foreach (object o in messageArgs)
                    {
                        mess += o.ToString() + " ";
                    }
                    MessageBox.Show(messageKey.ToString() + " - " + mess);

                    ToLog(eLogLevel.WARN, "The Ginger Helper message with key: '" + messageKey + "' was not found! and won't show to the user!");
                }
                orgMessageContent = messageToShow.MsgContent;
                //enter message args if exist
                if (messageArgs.Length > 0)
                {
                    messageToShow.MsgContent = string.Format(messageToShow.MsgContent, messageArgs);
                }


                if (CurrentAppLogLevel == eAppLogLevel.Debug)
                {
                    ToLog(eLogLevel.INFO, "Showing User Message (GingerHelper): " + messageContent);
                }
                else if (AddAllReportingToConsole)
                {
                    ToConsole("Showing User Message (GingerHelper): " + messageContent);
                }


                OnGingerHelperEvent(eGingerHelperEventActions.Show, btnHandler, messageToShow);
                messageToShow.MsgContent = orgMessageContent;
            }
            catch (Exception ex)
            {
                ToLog(eLogLevel.ERROR, "Failed to show the Ginger Helper message with the key: " + messageKey, ex);
            }
        }
示例#3
0
        public static void OnGingerHelperEvent(eGingerHelperEventActions EventAction, RoutedEventHandler btnHandler = null, GingerHelperMsg helperMsg = null)
        {
            GingerHelperEventHandler handler = HandlerGingerHelperEvent;

            if (handler != null)
            {
                handler(new GingerHelperEventArgs(EventAction, btnHandler, helperMsg));
            }
        }
示例#4
0
 public GingerHelperEventArgs(eGingerHelperEventActions EventAction, RoutedEventHandler btnHandler = null, GingerHelperMsg helperMsg = null)
 {
     mHelperMsg = helperMsg;
     mGingerHelperEventActions = EventAction;
     mbtnHandler = btnHandler;
 }