Esempio n. 1
0
        /// <summary>
        /// Executes the specified param.
        /// </summary>
        /// <param name="param">The param.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public OpResult Execute(string param)
        {
            OpResult opResult = new OpResult();

            try
            {
                Match match = m_regex.Match(param);
                if (match.Success)
                {
                    DialogResultObject result = new DialogResultObject();
                    result.result = AddInHost.Current.MediaCenterEnvironment.Dialog(
                        match.Groups["message"].Value,
                        match.Groups["caption"].Value,
                        DialogButtons.Ok,
                        int.Parse(match.Groups["timeout"].Value),
                        false);
                    opResult.StatusCode    = OpStatusCode.Success;
                    opResult.ContentObject = result;
                }
            }
            catch (Exception ex)
            {
                opResult.StatusCode = OpStatusCode.Exception;
                opResult.StatusText = ex.Message;
            }
            return(opResult);
        }
Esempio n. 2
0
        /// <summary>
        /// Executes the specified param.
        /// </summary>
        /// <param name="param">The param.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public OpResult Execute(string param)
        {
            OpResult opResult = new OpResult();

            try
            {
                Match match = m_regex.Match(param);
                if (match.Success)
                {
                    string imagefile = match.Groups["imagepath"].Value.Replace("/", "\\");

                    // get latest image file from directory, notation example: @"c:\temp\test*.jpg"
                    if (imagefile.Contains("*"))
                    {
                        imagefile = GetFileInfo.GetNewestImage(imagefile);
                    }

                    DialogResultObject dialogObject = new DialogResultObject();
                    dialogObject.result = AddInHost.Current.MediaCenterEnvironment.DialogNotification(
                        match.Groups["message"].Value,
                        new System.Collections.ArrayList(1),
                        int.Parse(match.Groups["timeout"].Value),
                        "file://" + imagefile);
                    opResult.StatusCode    = OpStatusCode.Ok;
                    opResult.ContentObject = dialogObject;
                }
            }
            catch (Exception ex)
            {
                opResult.StatusCode = OpStatusCode.Exception;
                opResult.StatusText = ex.Message;
            }
            return(opResult);
        }