Esempio n. 1
0
 public Gtd(IStoreFactory factory, IConsoleFacade console, IEvernoteConfiguration eConfig, ICommand[] commands)
 {
     this.factory = factory;
     this.eConfig = eConfig;
     this.commands = commands;
     this.console = console;
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new instance of the state tracker with the specified storage mechanism, and global persist trigger. 
        /// </summary>
        /// <remarks>
        /// Even though both arguments can be set via properties, this constructor is here to make the dependencies explicit.
        /// </remarks>
        /// <param name="storeFactory">The factory that will create an IStore for each tracked object's data.</param>
        /// <param name="persistTrigger">The object that will notify the state tracker when it should run a global persist operation. This will usually be when the application is shutting down.</param>
        public StateTracker(IStoreFactory storeFactory, ITriggerPersist persistTrigger)
        {
            StoreFactory = storeFactory;
            AutoPersistTrigger = persistTrigger;

            //add the basic configuration initializers
            RegisterConfigurationInitializer(new DefaultConfigurationInitializer()); //the default, will be used for all objects that don't have a more specific initializer
            RegisterConfigurationInitializer(new FormConfigurationInitializer());    //will be used for initializing configuration for forms (WinForms)
            RegisterConfigurationInitializer(new WindowConfigurationInitializer());  //will be used for initializing configuration for windows (WPF)
        }
Esempio n. 3
0
 public TraderContainer(IEconomy economy, ITrader trader, IStoreFactory storeFactory, IEconomyTraderProxyFactory marketTraderProxyFactory)
 {
     Contract.Requires<ArgumentNullException>(economy != null);
     Contract.Requires<ArgumentNullException>(trader != null);
     Contract.Requires<ArgumentNullException>(storeFactory != null);
     Contract.Requires<ArgumentNullException>(marketTraderProxyFactory != null);
     Economy = economy;
     Trader = trader;
     Store = storeFactory.Create(trader);
     Proxy = marketTraderProxyFactory.Create(this);
 }
Esempio n. 4
0
 public CachedNoteStore(IStoreFactory factory, IGTDConfiguration gConfig)
 {
     this.factory = factory;
     this.gConfig = gConfig;
 }
 public BestBetExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <BestBetEntity>(), "#manage/optimization/bestbets")
 {
 }
Esempio n. 6
0
 public StoreConverter(IStoreFactory storeFactory,
                       IToDomainConverter <Section, IStoreSection> storeSectionConverter)
 {
     this.storeFactory          = storeFactory;
     this.storeSectionConverter = storeSectionConverter;
 }
Esempio n. 7
0
 public AutocompleteImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <AutocompleteEntity>())
 {
 }
Esempio n. 8
0
 public RelatedQueryImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <RelatedQueryEntity>())
 {
 }
 public SynonymExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <SynonymEntity>(), "#manage/optimization/synonyms")
 {
 }
Esempio n. 10
0
 public RaceController(IStoreFactory storeFactory) : base(storeFactory)
 {
     _raceStore = _storeFactory.RaceStore;
 }
 public CurrencyController(IStoreFactory store) : base(store)
 {
 }
Esempio n. 12
0
        /// <summary>
        /// Main starting point of out program.
        /// </summary>
        public static void Main()
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.SetWindowSize(GeneralConstants.ConsoleWindowWidth, GeneralConstants.ConsoleWindowHeight);

#if DEBUG
            var collection = new List <IProduct>();
            collection.Add(new Dairy("Milk", 22.5m, DateTime.Now, 90, 32.1));
            collection.Add(new Dairy("Yougurt", 35.5m, DateTime.Now, 50, 5));
#endif
            string username = null;
            string password = null;
            string email    = null;

            StateType state = StateType.MainMenu;

            IStoreFactory storeFactory = StoreFactory.Instance;
            IUser         currentUser  = null;
            IDataStorage  userContext  = null;

            ConsoleKey key = ConsoleKey.NoName;

            while (true)
            {
                try
                {
                    switch (state)
                    {
                    case StateType.MainMenu:
                        MainMenu.Instance.Draw();
                        state = MainMenu.Instance.ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.LoginMenu:
                        //Validator.CheckIfPriceIsValid(-20);
                        LoginMenu.Instance.Draw();
                        state = LoginMenu.Instance.ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.RegisterMenu:
                        RegisterMenu.Instance.Draw();
                        state = RegisterMenu.Instance.ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.StoreMenu:
                        StoreMenu.Instance(collection).Draw();
                        state = StoreMenu.Instance(collection).ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.CartMenu:
                        CartMenu.Instance(currentUser.Cart).Draw();
                        state = CartMenu.Instance(currentUser.Cart).ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.PaymentMenu:
                        PaymentMenu.Instance.Draw();
                        state = PaymentMenu.Instance.ParseKey(Console.ReadKey().Key);
                        break;

                    case StateType.EnterUsername:
                        username = Console.ReadLine();
                        state    = StateType.RegisterMenu;
                        break;

                    case StateType.EnterPassword:
                        password = Console.ReadLine();
                        state    = StateType.RegisterMenu;
                        break;

                    case StateType.EnterEmail:
                        email = Console.ReadLine();
                        state = StateType.RegisterMenu;
                        break;

                    case StateType.Register:
                        userContext = storeFactory.CreateDataStorage("Users");
                        currentUser = storeFactory.CreateUser(typeof(Admin),
                                                              username, password, email);
                        userContext.Write(currentUser.ToString());
                        state = StateType.StoreMenu;
                        break;

                    case StateType.Login:
                        userContext = storeFactory.CreateDataStorage("Users");
                        var text = (userContext as FileStorage).ReadToEnd().Split('\n');
                        foreach (var str in text)
                        {
                            var temp = str.Split('|');
                            if (temp[1] == username && temp[2] == password)
                            {
                                currentUser = storeFactory.CreateUser(typeof(Admin), username, password, email);
                                break;
                            }
                        }

                        if (currentUser == null)
                        {
                            state = StateType.MainMenu;
                        }
                        else
                        {
                            state = StateType.StoreMenu;
                        }

                        break;

                    case StateType.NotSet:
                        state = ChangeMenuTemp(Console.ReadKey().Key, state);
                        break;

                    case StateType.AddToCart:
                        IProduct wantedProduct = TakeProductID(collection);
                        wantedProduct.Quantity--;
                        currentUser.Cart.AddToCart(wantedProduct);

                        if (wantedProduct.Quantity == 0)
                        {
                            collection.Remove(wantedProduct);
                        }

                        state = ChangeMenuTemp(Console.ReadKey().Key, state);
                        break;

                    default:
                        break;
                    }
                    Console.Clear();
                }
                catch (Exception ex)
                {
                    state = StateType.NotSet;
                    Console.WriteLine(ex.Message);
                }
            }
        }
 public PackageManager(IStoreFactory storeFactory)
 {
     _storeFactory = storeFactory;
 }
 public OrganizationController(IStoreFactory store) : base(store)
 {
 }
 public AutocompleteExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <AutocompleteEntity>(), "#manage/optimization/autocomplete")
 {
 }
 public BestBetImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <BestBetEntity>())
 {
 }
Esempio n. 17
0
 public CachedNoteStore(IStoreFactory factory, IGTDConfiguration gConfig)
 {
     this.factory = factory;
     this.gConfig = gConfig;
 }