コード例 #1
0
ファイル: GTD.cs プロジェクト: trayburn/EverGTD
 public Gtd(IStoreFactory factory, IConsoleFacade console, IEvernoteConfiguration eConfig, ICommand[] commands)
 {
     this.factory = factory;
     this.eConfig = eConfig;
     this.commands = commands;
     this.console = console;
 }
コード例 #2
0
ファイル: StateTracker.cs プロジェクト: anakic/Jot
        /// <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)
        }
コード例 #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);
 }
コード例 #4
0
 public CachedNoteStore(IStoreFactory factory, IGTDConfiguration gConfig)
 {
     this.factory = factory;
     this.gConfig = gConfig;
 }
コード例 #5
0
 public BestBetExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <BestBetEntity>(), "#manage/optimization/bestbets")
 {
 }
コード例 #6
0
 public StoreConverter(IStoreFactory storeFactory,
                       IToDomainConverter <Section, IStoreSection> storeSectionConverter)
 {
     this.storeFactory          = storeFactory;
     this.storeSectionConverter = storeSectionConverter;
 }
コード例 #7
0
 public AutocompleteImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <AutocompleteEntity>())
 {
 }
コード例 #8
0
 public RelatedQueryImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <RelatedQueryEntity>())
 {
 }
コード例 #9
0
 public SynonymExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <SynonymEntity>(), "#manage/optimization/synonyms")
 {
 }
コード例 #10
0
 public RaceController(IStoreFactory storeFactory) : base(storeFactory)
 {
     _raceStore = _storeFactory.RaceStore;
 }
コード例 #11
0
 public CurrencyController(IStoreFactory store) : base(store)
 {
 }
コード例 #12
0
ファイル: StartUp.cs プロジェクト: Team-Li-Mei/Store-App
        /// <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);
                }
            }
        }
コード例 #13
0
 public PackageManager(IStoreFactory storeFactory)
 {
     _storeFactory = storeFactory;
 }
コード例 #14
0
 public OrganizationController(IStoreFactory store) : base(store)
 {
 }
コード例 #15
0
 public AutocompleteExporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <AutocompleteEntity>(), "#manage/optimization/autocomplete")
 {
 }
コード例 #16
0
 public BestBetImporter(IStoreFactory storeFactory) : base(storeFactory.GetStore <BestBetEntity>())
 {
 }
コード例 #17
0
ファイル: CachedNoteStore.cs プロジェクト: trayburn/EverGTD
 public CachedNoteStore(IStoreFactory factory, IGTDConfiguration gConfig)
 {
     this.factory = factory;
     this.gConfig = gConfig;
 }