Example #1
0
 private ServiceAction CreateAction(JObject jAction, ServiceConfiguration configuration)
 {
     return(ServiceAction.CreateSilently(
                jAction.Get("Name"), jAction.Get("UriPath"),
                jAction.Get("Method"), jAction.Get("Body"),
                jAction.Get("MediaType"), () => configuration.BaseUri));
 }
        public ServiceConfigurationBuilder WithGroup(int index, int numberOfActions)
        {
            var actionGroup = ActionGroup.CreateSilently($"My action group name {index}", _configuration,
                                                         _navigationService);

            for (int i = 1; i <= numberOfActions; i++)
            {
                var action = ServiceAction.CreateSilently($"My action name {i}", $"my?action=path{i}",
                                                          $"Post {i}", $"My action body {i}", $"My action content type {i}", () => _configuration.BaseUri);
                actionGroup.Actions.Add(action);
            }
            _configuration.ActionGroups.Add(actionGroup);
            return(this);
        }
        private ServiceConfiguration CreateRealTestData()
        {
            var configuration = ServiceConfiguration.CreateSilently("Domoticz", "http://mediacomputer:8080",
                                                                    NavigationService, ActionInvokerFactory);

            ServiceAction[] actions =
            {
                ServiceAction.CreateSilently("On",                                        "json.htm?type=command&param=switchlight&idx=1&switchcmd=Set%20Level&level=15",
                                             "Get",                                       "",                                                                            "", () => configuration.BaseUri),
                ServiceAction.CreateSilently("Off",                                       "json.htm?type=command&param=switchlight&idx=1&switchcmd=Off",
                                             "Get",                                       "",                                                                            "", () => configuration.BaseUri)
            };
            var actionGroup = ActionGroup.CreateSilently("Dining Room", configuration, NavigationService);

            actionGroup.Actions.AddRange(actions);
            ActionGroup[] groups =
            {
                actionGroup
            };
            configuration.ActionGroups.AddRange(groups);
            return(configuration);
        }
 private static ServiceAction CreateAction(Func <string> configuration, int i)
 {
     return(ServiceAction.CreateSilently($"Action with long name {i}",
                                         "dostuff?a=b&c=d", "Get", "", "", configuration));
 }