Exemplo n.º 1
0
 public Run(IStored <ScheduledTasks> tasks, IStored <ScheduledTasks> likes, Cli cli, IAutomaton automaton, ILog log)
 {
     _tweetTasks = tasks;
     _likeTasks  = likes;
     _cli        = cli;
     _automaton  = automaton;
     _log        = log;
 }
Exemplo n.º 2
0
 public RandomLikeAutomaton(IStored <RandomLikeAutomatonData> data, IStored <ScheduledTasks> tasks, Like like, ITwitterGateway twitter, ILog log)
 {
     _data    = data;
     _tasks   = tasks;
     _like    = like;
     _twitter = twitter;
     _log     = log;
 }
Exemplo n.º 3
0
        public IInstance newInstance(Context context, IStored stored)
        {
            CategoryDeclaration decl = context.getRegisteredDeclaration <CategoryDeclaration>(this.GetTypeName());
            IInstance           inst = decl.newInstance(context, stored);

            inst.setMutable(this.Mutable);
            return(inst);
        }
Exemplo n.º 4
0
            private object ConvertInstance(IStored instance)
            {
                IDictionary <string, object> doc = new Dictionary <string, object>();

                foreach (string name in instance.Names)
                {
                    doc[name] = ConvertValue(instance.GetData(name));
                }
                return(doc);
            }
Exemplo n.º 5
0
 protected virtual IValue getCurrent()
 {
     try
     {
         IStored      stored = enumerator.Current;
         CategoryType type   = ReadItemType(stored);
         return(type.newInstance(context, stored));
     } catch (PromptoError e) {
         throw new Exception(e.Message);
     }
 }
Exemplo n.º 6
0
 void PopulateInstance(Context context, IStored stored, IInstance instance)
 {
     SetDbId(context, instance, stored.DbId);
     foreach (String name in GetAllAttributes(context))
     {
         PopulateMember(context, stored, instance, name);
     }
     if (instance.getStorable() != null)
     {
         instance.getStorable().Dirty = false;
     }
 }
Exemplo n.º 7
0
        public IInstance newInstance(Context context, IStored stored)
        {
            IInstance instance = newInstance(context);

            instance.setMutable(true);
            try
            {
                PopulateInstance(context, stored, instance);
            }
            finally
            {
                instance.setMutable(false);
            }
            return(instance);
        }
Exemplo n.º 8
0
        void PopulateMember(Context context, IStored stored, IInstance instance, String name)
        {
            AttributeDeclaration decl = context.getRegisteredDeclaration <AttributeDeclaration>(name);

            if (!decl.Storable)
            {
                return;
            }
            if (stored.HasData(name))
            {
                Object data  = stored.GetData(name);
                IValue value = decl.getIType().ConvertCSharpValueToIValue(context, data);
                instance.SetMemberValue(context, name, value);
            }
        }
Exemplo n.º 9
0
        CategoryType ReadItemType(IStored stored)
        {
            Object value = stored.GetData("category");

            if (value is List <String> )
            {
                List <String> categories = (List <String>)value;
                String        category   = categories[categories.Count - 1];
                CategoryType  type       = new CategoryType(category);
                type.Mutable = this.Mutable;
                return(type);
            }
            else
            {
                throw new InvalidDataError("Could not infer category!");
            }
        }
Exemplo n.º 10
0
        public override IValue interpret(Context context)
        {
            IStore  store  = DataStore.Instance;
            IQuery  query  = buildFetchOneQuery(context, store);
            IStored stored = store.FetchOne(query);

            if (stored == null)
            {
                return(NullValue.Instance);
            }
            else
            {
                List <String> categories     = (List <String>)stored.GetData("category");
                String        actualTypeName = categories.FindLast((v) => true);
                CategoryType  type           = new CategoryType(actualTypeName);
                if (this.type != null)
                {
                    type.Mutable = this.type.Mutable;
                }
                return(type.newInstance(context, stored));
            }
        }
Exemplo n.º 11
0
 public Cancel(IStored <ScheduledTasks> tasks, ILog log)
 {
     _tasks = tasks;
     _log   = log;
 }
 public WithDisplayedUsername(ILog log, IStored <Credentials> credentials, ICommand inner)
 {
     _log         = log;
     _credentials = credentials;
     _inner       = inner;
 }
Exemplo n.º 13
0
 public ScheduleTweet(IStored <ScheduledTasks> tasks, Tweet tweet, ILog log)
 {
     _tasks = tasks;
     _tweet = tweet;
     _log   = log;
 }
Exemplo n.º 14
0
 public HttpTwitterClient(IStored <Credentials> credentials)
 {
     _credentials = credentials;
 }
Exemplo n.º 15
0
 public SetupCommand(IStored <Credentials> credentials, ILog log)
 {
     _credentials = credentials;
     _log         = log;
 }
Exemplo n.º 16
0
 public Run(ILog log, IStored <ProcessTargetList> targets)
 {
     _targets = targets;
     _log     = log;
 }
Exemplo n.º 17
0
 public ViewTasks(IStored <ScheduledTasks> tasks, ILog log)
 {
     _tasks = tasks;
     _log   = log;
 }
Exemplo n.º 18
0
 public static Task <V> ViewModelTask <M, V>(this IStored <M> inst)
     where M : class, IStored <M>, new()
     where V : ViewModel <M>, new()
 {
     return(Task.FromResult((V)inst.ViewModel));
 }
Exemplo n.º 19
0
 /// <summary>
 /// The Dispose() extension method is called implicitly before the
 /// ViewModel is returned and saves the M object either to the returned
 /// ViewState or implicitly on the server.
 /// </summary>
 /// <typeparam name="M"></typeparam>
 public static void Save <M>(this IStored <M> inst)
     where M : class, IStored <M>, new()
 {
     inst.ViewModel.ViewState = StorageServer.Save <M>(inst.ViewModel);
 }
Exemplo n.º 20
0
 public ScheduleLike(IStored <ScheduledTasks> tasks, Like like, ILog log)
 {
     _tasks = tasks;
     _like  = like;
     _log   = log;
 }
Exemplo n.º 21
0
 public ViewCredentials(IStored <Credentials> credentials, ILog log)
 {
     _credentials = credentials;
     _log         = log;
 }
 public RemoveTargetProcess(ILog log, IStored <ProcessTargetList> targets)
 {
     _log     = log;
     _targets = targets;
 }
Exemplo n.º 23
0
 public SetMaxLikes(IStored <RandomLikeAutomatonData> data, ITwitterGateway twitter, ILog log)
 {
     _data    = data;
     _twitter = twitter;
     _log     = log;
 }