コード例 #1
0
        /// <summary>
        ///     Starts comparing by clicking related button
        /// </summary>
        /// <returns>
        ///     <br>True: If call worked fine</br>
        ///     <br>False: If an error occurred</br>
        /// </returns>
        public bool StartCompare()
        {
            try
            {
                Button button = new ActionElements().ButtonCompare;
                bool   success;
                if (button != null && button.Enabled)
                {
                    //Mouse.MoveTo(button, 500);
                    button.Click();
                    success = true;
                }
                else
                {
                    Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Button not not accessible.");
                    success = false;
                }

                return(success);
            }
            catch (Exception exception)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), exception.Message);
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        ///     Checks if comparison is finished
        /// </summary>
        /// <returns>
        ///     <br>True: if comparison is finished</br>
        ///     <br>False: if comparison is not finished</br>
        /// </returns>
        public bool IsComparing()
        {
            bool   result      = true;
            Button button      = new ActionElements().ButtonCompare;
            Button progressBar = new StatusbarElements().ComparisonProgress;

            if (button == null)
            {
                result = false;
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Compare button is null and not available.");
            }
            else
            {
                if (button.Enabled || progressBar == null)
                {
                    result = false;
                    Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Comparison is not in progress.");
                }
                else
                {
                    Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Comparison is in progress.");
                }
            }

            return(result);
        }
コード例 #3
0
        protected virtual void HandleChild(ParseResult result, XElement child)
        {
            switch (child.Name.LocalName.ToLower())
            {
            case "input":

                var input = new Input(Context, SupportedFeatures);
                input.Parse(result, child);

                if (!result.IsOkForRender())
                {
                    return;
                }

                if (Context == NotificationType.Toast)
                {
                    if (Inputs.Count >= 5)
                    {
                        result.AddErrorButRenderAllowed("Toasts can only display up to 5 inputs.", GetErrorPositionInfo(child));
                        return;
                    }
                }

                Inputs.Add(input);
                input.Parent = this;

                break;


            case "action":

                var action = new Action(Context, SupportedFeatures);
                action.Parse(result, child);

                if (!result.IsOkForRender())
                {
                    return;
                }

                if (Context == NotificationType.Toast)
                {
                    if (ActionElements.Count >= 5)
                    {
                        result.AddErrorButRenderAllowed("Toasts can only display up to 5 actions.", GetErrorPositionInfo(child));
                        return;
                    }
                }

                ActionElements.Add(action);
                action.Parent = this;

                break;


            default:
                result.AddWarning($"Invalid child {child.Name.LocalName} under actions element.", GetErrorPositionInfo(child));
                break;
            }
        }
コード例 #4
0
        /// <summary>
        /// Method to serialize Tropo action objects and add to the base Tropo object.
        /// </summary>
        /// <param name="action"></param>
        /// <param name="prefix"></param>
        private void Serialize(TropoBase action, string prefix)
        {
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                DefaultValueHandling = DefaultValueHandling.Ignore
            };

            ActionElements.Add("{ \"" + prefix + "\":" + JsonConvert.SerializeObject(action, Formatting.None, settings) + "}");
        }
コード例 #5
0
        /// <summary>
        /// Ooverload method for Say that allows an arrat of prompts to be used.
        /// </summary>
        /// <param name="says">The prompts to say or send to the caller.</param>
        public void Say(IEnumerable <String> says)
        {
            List <Say> saysToAdd = new List <Say>();

            foreach (string element in says)
            {
                Say say = new Say();
                say.Value    = element;
                say.As       = null;
                say.Name     = null;
                say.Required = true;

                saysToAdd.Add(say);
            }

            JsonSerializerSettings settings = new JsonSerializerSettings();

            settings.DefaultValueHandling = DefaultValueHandling.Ignore;
            ActionElements.Add("{ \"say\":" + JsonConvert.SerializeObject(saysToAdd, Formatting.None, settings) + "}");
        }