Пример #1
0
        public ManagerPair GetStrategyTradeManagerPair(Guid strategyId)
        {
            lock (_locker)
            {
                var sleepService = new SleepService();

                var apiClientFactory = new ApiClientFactory();
                var runnerService    = new RunnerService(apiClientFactory);
                var orderPlacer      = new OrderPlacer(apiClientFactory);
                var stakeCalculator  = new ClosingStakeCalculator();

                var openingStakeProviderFactory = new OpeningStakeProviderFactory();
                var test = new List <string>()
                {
                    "255f49e7-28e7-4f2b-acb9-34a2898866f4",
                    "5331775e-fc1f-46c5-b665-f3d478b7d09f",
                    "984950bb-210e-4e4b-b76c-cf668fe40a6a"
                };

                if (test.Contains(strategyId.ToString()))
                {
                    return(new ManagerPair(new TestOpeningOrderManager(), new TestClosingOrderManager()));
                }

                var orderPriceFinder = new OrderPriceFinder(openingStakeProviderFactory);

                return(new ManagerPair(new OpeningOrderManager(orderPlacer, runnerService, sleepService, orderPriceFinder), new ClosingOrderManager(sleepService, runnerService, orderPlacer, stakeCalculator)));
            }
        }
Пример #2
0
        private SleepService CreateSleepService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SleepService(userId);

            return(service);
        }
Пример #3
0
        // GET: Sleep
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new SleepService(userId);
            var model   = service.GetSleeps();

            return(View(model));
        }
Пример #4
0
        static void Main(string[] args)
        {
            SleepService sleepService = new SleepService();

            var lastSleepTime          = sleepService.GetLastSleepTime();
            var lastWakeTime           = sleepService.GetLastWakeTime();
            var systemBatteryState     = sleepService.GetSystemBatteryState();
            var systemPowerInformation = sleepService.GetSystemPowerInformation();

            Console.ReadLine();
        }
Пример #5
0
        public HiClockMainController(CompositionContainer aContainer, Lazy<HiClockMainViewModel> aHiClockMainViewModel, SleepService aSleepSvr, Lazy<IShellService> aShellService)
        {
            FContainer = aContainer;
            FHiClockMainViewModel = aHiClockMainViewModel;            
            FShellService = aShellService;
            aSleepSvr.SleepAction = new Action(ShowSleepScreen);
            FAboutViewModel = FContainer.GetExport<AboutViewModel>();

            FCloseSleepCommand = new DelegateCommand(StopSleep);
            FExitSettingCommand = new DelegateCommand(ExitSetting);
            FSetAutoStartCommand = new DelegateCommand(SetAutoStart);

            FAlarmTimer = new DispatcherTimer();
            FAlarmTimer.Tick += FAlarmTimer_Tick;
            FSleepDurationTimer = new DispatcherTimer();
            FSleepDurationTimer.Tick += FSleepDurationTimer_Tick;
        }
Пример #6
0
 protected DuoApi(string ikey, string skey, string host, string user_agent, string url_scheme,
                  SleepService sleepService, RandomService randomService)
 {
     this.ikey          = ikey;
     this.skey          = skey;
     this.host          = host;
     this.url_scheme    = url_scheme;
     this.sleepService  = sleepService;
     this.randomService = randomService;
     if (String.IsNullOrEmpty(user_agent))
     {
         this.user_agent = FormatUserAgent(DEFAULT_AGENT);
     }
     else
     {
         this.user_agent = user_agent;
     }
 }
Пример #7
0
        public NightwatchContext()
        {
            var sleepService = new SleepService();

            _nightwatchForm = new Nightwatch.NightwatchForm(sleepService);
            _nightwatchForm.DisableEvents();
            sleepService.StartService();
            _nightwatchForm.EnableEvents();

            var configMenuItem = new MenuItem("Configuration", new EventHandler(ShowConfig));
            var exitMenuItem   = new MenuItem("Exit", new EventHandler(Exit));

            _notifyIcon = new NotifyIcon();

            _notifyIcon.Icon        = Properties.Resources.icon;
            _notifyIcon.ContextMenu = new ContextMenu(new MenuItem[]
                                                      { configMenuItem, exitMenuItem });
            _notifyIcon.Visible = true;
            _notifyIcon.Click  += ShowConfig;
        }
Пример #8
0
        public NightwatchForm(SleepService sleepService)
        {
            _sleepService = sleepService;
            _sleepService.StateChanged += StateChanged;
            _sleepService.ModeChanged  += ModeChanged;
            _sleepService.AutomaticStartTimeChanged += AutomaticStartTimeChanged;
            _sleepService.AutomaticStopTimeChanged  += AutomaticStopTimeChanged;

            InitializeComponent();

            dateTimePickerAutomaticStartTime.Format     = DateTimePickerFormat.Time;
            dateTimePickerAutomaticStartTime.ShowUpDown = true;
            dateTimePickerAutomaticStopTime.Format      = DateTimePickerFormat.Time;
            dateTimePickerAutomaticStopTime.ShowUpDown  = true;

            var fileVersionInfo = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location);
            var fileVersion     = fileVersionInfo.FileVersion;
            var productVersion  = fileVersionInfo.ProductVersion;

            labelVersion.Text = productVersion;
            //labelVersion.t
        }