예제 #1
0
        public ActionResult TimerGet(string duration = "PT25M")
        {
            TimerViewModel viewModel = new TimerViewModel();

            viewModel.Duration = duration;
            return(View("Timer", viewModel));
        }
예제 #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            _notifyIcon.Icon   = new Icon("Resources/icon.ico");
            _notifyIcon.Text   = "SingletonSean";
            _notifyIcon.Click += NotifyIcon_Click;

            _notifyIcon.ContextMenuStrip = new Forms.ContextMenuStrip();
            _notifyIcon.ContextMenuStrip.Items.Add("Status", Image.FromFile("Resources/icon.ico"), OnStatusClicked);
            //_notifyIcon.ContextMenuStrip.Items.Add(new Forms.ToolStripLabel("Status: Running"));
            //_notifyIcon.ContextMenuStrip.Items.Add(new Forms.ToolStripButton("Status: Running"));
            //_notifyIcon.ContextMenuStrip.Items.Add(new Forms.ToolStripDropDownButton("Status: Running", null,
            //    new Forms.ToolStripLabel("Label 1"),
            //    new Forms.ToolStripLabel("Label 2")));
            //_notifyIcon.BalloonTipClicked += NotifyIcon_BalloonTipClicked;

            _notifyIcon.Visible = true;

            _timerStore     = new TimerStore(new NotifyIconNotificationService(_notifyIcon));
            _timerViewModel = new TimerViewModel(_timerStore);

            MainWindow             = new MainWindow();
            MainWindow.DataContext = _timerViewModel;
            MainWindow.Show();

            base.OnStartup(e);
        }
예제 #3
0
        public ActionResult Index()
        {
            TimerViewModel model = new TimerViewModel();

            TempData["EndTime"] = Session["EndTime"];
            return(View(model));
        }
예제 #4
0
        public StackTypeTestPage(string questionId, TimerViewModel testTimeViewModel, ISettings settings, int index)
        {
            InitializeComponent();

            InitializeAsync(questionId, testTimeViewModel, settings, index);
            Title = (1 + index).ToString();
        }
예제 #5
0
 public EntryTypeTestPage(string questionId, TimerViewModel testTimeViewModel, string time, ISettings settings, int index)
 {
     _viewModelTest = new TestPageViewModel(questionId, testTimeViewModel, time, settings, index);
     InitializeComponent();
     Title          = (1 + index).ToString();
     BindingContext = _viewModelTest;
     Subscribe(index);
 }
        public void ClearTimer_SendsAnalyticFeatureUsed()
        {
            var timerViewModel = new TimerViewModel(AnalyticsFake);

            timerViewModel.ClearTimer.Execute(null);

            AnalyticsFake.VerifyFeatureUsedCallCount("ClearTimer", 1);
        }
예제 #7
0
 private void InitializeProperties()
 {
     this.Timer  = new TimerViewModel();
     this.Error  = new ErrorViewModel();
     this.Inputs = new List <InputViewModel>();
     this.Output = new VisitorOutputModel();
     this.InitVisitorOptions();
 }
예제 #8
0
 private void setStoryVoting(VotingSectionViewModel votingSectionVM, TimerViewModel timerVM, Story story)
 {
     votingSectionVM.IsVoting = true;
     timerVM.CssClass         = "text-danger";
     timerVM.TimerText        = "Time before voting end";
     timerVM.Distance         = (int)(story.EndOfVotingsDate - DateTime.Now).Value.TotalMilliseconds;
     timerVM.CountDownDate    = (DateTime)story.EndOfVotingsDate;
 }
        //async void OnAnswer3(object sender, EventArgs args)
        //{
        //    Button button = (Button)sender;

        //    if (button.BackgroundColor == Color.Blue)
        //    {
        //        button.Resources["ButtonStyle"] = Resources["selectedAnswerStyle"];
        //    }
        //    else
        //    {

        //        button.Resources["ButtonStyle"] = Resources["answerStyle"];
        //    }
        //}

        //async void OnAnswer2(object sender, EventArgs args)
        //{
        //    Button button = (Button)sender;

        //        if (button.BackgroundColor == Color.Blue)
        //        {
        //            button.Resources["ButtonStyle"] = Resources["selectedAnswerStyle"];
        //        }
        //        else {

        //            button.Resources["ButtonStyle"] = Resources["answerStyle"];
        //        }


        //}

        void OnClickedHomePage(object sender, EventArgs args)
        {
            count           = 0;
            _timerViewModel = null;
            Application.Current.Properties["TimerStatus"] = string.Empty;
            firstPageAppeared    = false;
            App.Current.MainPage = new NavigationPage(new QuizPage());
        }
예제 #10
0
 private void SetTimer(TimeSpan time)
 {
     _timer = null;
     if (!time.Equals(TimeSpan.Zero))
     {
         _timer = new TimerViewModel(time, -1);
     }
 }
예제 #11
0
 public void PostCountdownTimer(TimerViewModel model)
 {
     if (Session["EndTime"] == null)
     {
         Session["EndTime"] = DateTime.Now.AddHours(model.Hour).AddMinutes(model.Minute).AddSeconds(model.Second).ToString("dd-MM-yyyy h:mm:ss tt");
     }
     TempData["EndTime"] = Session["EndTime"];
     Response.Redirect("/Home/Index");
 }
예제 #12
0
 private async void InitializeAsync(string id, TimerViewModel testTimeViewModel, ISettings settings, int index)
 {
     await Task.Run(() =>
     {
         _viewModel = new StackTypeTestViewModel(id, testTimeViewModel, settings, index);
         Subscribe(index);
         Device.BeginInvokeOnMainThread(() => { BindingContext = _viewModel; });
     });
 }
예제 #13
0
 public MainViewModel()
 {
     Items       = new ObservableCollection <ItemViewModel>();
     Exercises   = new ObservableCollection <string>();
     stopwatch   = new Stopwatch();
     timer       = new TimerViewModel();
     this._timer = new Timer(new TimerCallback((s) => this.FirePropertyChanged()),
                             null, 1000, 1000);
 }
예제 #14
0
        public MainPage()
        {
            this.InitializeComponent();
            TimerProgressBar.Value = 75;

            Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.LayoutMetricsChanged += TitleBar_LayoutMetricsChanged;

            DataContext = Model = new TimerViewModel();
        }
 async void OnGoToModelessFinishClicked(object sender, EventArgs args)
 {
     // _timerViewModel.StartTime = TimeSpan.FromSeconds(0);
     _timerViewModel   = null;
     count             = 0;
     firstPageAppeared = false;
     Application.Current.Properties["TimerStatus"] = string.Empty;
     await Navigation.PushAsync(new SummaryResult());
 }
예제 #16
0
        private void setStoryNotVoting(VotingSectionViewModel votingSectionVM, TimerViewModel timerVM, Story story)
        {
            votingSectionVM.IsVoting = false;

            timerVM.CssClass      = "NotVoting";
            timerVM.TimerText     = "Time before voting";
            timerVM.Distance      = (int)(story.NextVotingDate - DateTime.Now).Value.TotalMilliseconds;
            timerVM.CountDownDate = (DateTime)story.NextVotingDate;
        }
예제 #17
0
        public MainWindow()
        {
            InitializeComponent();

            VM = ViewModelSource <TimerViewModel> .Create();

            this.DataContext = VM;

            EventManager.RegisterClassHandler(typeof(Tile), LoadedEvent, new RoutedEventHandler((d, e) => ((Tile)d).Padding = new Thickness(10)));
        }
예제 #18
0
 public ActionResult TomatoTimerPost(TimerViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Timer", "Tools", new { duration = viewModel.Duration }));
     }
     else
     {
         return(View("Timer", viewModel));
     }
 }
 async void OnTimeoutPropertyChanged(object sender, PropertyChangedEventArgs args)
 {
     if (_timerViewModel != null && !_timerViewModel.IsVisiblePrevNavButton)
     {
         // _timerViewModel.StartTime = TimeSpan.FromSeconds(0);
         _timerViewModel   = null;
         count             = 0;
         firstPageAppeared = false;
         Application.Current.Properties["TimerStatus"] = string.Empty;
         await Navigation.PushAsync(new SummaryResult());
     }
 }
예제 #20
0
        public MainWindow()
        {
            InitializeComponent();

            var timer          = new MyTimer();
            var timerViewModel = new TimerViewModel(timer);

            new Follower("First follower", timer);
            new Follower("Second follower", timer);

            DataContext = timerViewModel;
        }
예제 #21
0
 public void ApplyPreset(Preset preset)
 {
     if (preset != null)
     {
         TimerViewModel viewModel = (TimerViewModel)BindingContext;
         viewModel.BaseSecs   = preset.baseseconds.ToString();
         viewModel.PlusSecs   = preset.plusseconds.ToString();
         viewModel.TeaName    = preset.name;
         viewModel.TeaAltName = preset.altname;
         viewModel.TeaDetails = String.Format("{0}, brew at {1}°C for {2} infusions.", App.teaTypeNames[(int)preset.type], preset.temp, preset.maxinfusions);
         viewModel.teaType    = (int)preset.type;
         SetToolbarColours(App.teaColoursDarkTxt[(int)preset.type], Color.Black, false);
     }
 }
예제 #22
0
        public async void SavePomodoroToFileAsync()
        {
            StorageFile file = await TimerViewModel.GetSaveFileAsync();

            PomodoroSession session = CreatePomodoroSessionForTests();

            await FileIO.AppendTextAsync(file, session.Serialize());

            string content = await FileIO.ReadTextAsync(file);

            string expected = "TEST," + DateTime.Today.ToString() + ",1500";

            Assert.AreEqual(expected, content);
        }
예제 #23
0
        private void SetupGame()
        {
            this.Timer    = new TimerViewModel(new TimeSpan(0, 0, Constants.playSeconds));
            this.GameInfo = new GameInfoViewModel();

            this.StageImage = this.GetStageImage();
            this.Timer.Start();
            this.GenerateWord(null);
            this.GenerateLetters(null);

            OnPropertyChanged("Timer");
            OnPropertyChanged("GameInfo");
            OnPropertyChanged("StageImage");
        }
예제 #24
0
        /// <summary>
        /// Creates a LoopTimer from the properties of a TimerViewModel.
        /// </summary>
        /// <param name="tvm">
        /// TimerViewModel containing parameters set in the UI.
        /// </param>
        public LoopTimer(TimerViewModel tvm)
        {
            _workLength                = tvm.WorkLength;
            _shortBreakLength          = tvm.ShortBreakLength;
            _longBreakLength           = tvm.LongBreakLength;
            _shortBreaksUntilLongBreak = tvm.ShortBreaksUntilLongBreak;

            _shortBreaksTaken = 0;

            _taskProgress = 0;

            _currentTaskString = tvm.CurrentTask;

            _notes = tvm.Notes;
        }
예제 #25
0
        public TimerPage()
        {
            InitializeComponent();
            teaTimer.Clear();
            timerViewModel      = new TimerViewModel(StartTimer, ClearTimer, PlusInfTemp, SubInfTemp, ResetInfTemp);
            notificationService = DependencyService.Get <ILocalNotification>();

            var assembly = typeof(App).GetTypeInfo().Assembly;
            var stream   = assembly.GetManifestResourceStream($"GongFuTimer.Audio." + "Alarm.wav");

            alarmPlayer.Load(stream);

            BindingContext = timerViewModel;

            // update loop
            Device.BeginInvokeOnMainThread(MainLoop);
        }
예제 #26
0
        public MainWindow()
        {
            InitializeComponent();

            WindowViewModel = new WindowViewModel();
            TimerViewModel  = new TimerViewModel();
            DataContext     = WindowViewModel;

            ClockOnlyPanel.DataContext     = BigClockPanel.DataContext =
                BigSalaryPanel.DataContext = SalaryOnlyPanel.DataContext = TimerViewModel;

            LoadSettings();

            _timer          = new Timer(100);
            _timer.Elapsed += _timer_Elapsed;
            _timer.Start();
        }
예제 #27
0
        public async Task <ActionResult> Timer()
        {
            var viewModel      = new TimerViewModel();
            var identityUserId = User.Identity.GetUserId();

            using (var context = new ApplicationDbContext())
            {
                try
                {
                    viewModel.Categories = await context.Categories.Where(o => o.User.Id == identityUserId).ToListAsync();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Ошибка поиска категорий у пользователя: " + ex.Source + " " + ex.Message);
                }
            }
            return(View(viewModel));
        }
예제 #28
0
        public IClockUserCtrl GetTimerClockUserControl(Dispatcher dispatcher)
        {
            var dispatcherForPlayer = new DispatcherTimerImpl(new DispatcherTimer(DispatcherPriority.Normal, dispatcher));
            var clockForPlayer      = new TimerClock(_config, _logger, dispatcherForPlayer);

            var stream = Utils.GetResourceStream(_config.RingtoneFilename);
            var player = new LoopSoundPlayer(stream, _config, clockForPlayer);

            var dispatcherTimer = new DispatcherTimerImpl(new DispatcherTimer(DispatcherPriority.Normal, dispatcher));
            var clock           = new TimerClock(_config, _logger, dispatcherTimer);

            var ctrl = new ClockUserCtrl("_timer");
            var vm   = new TimerViewModel(ctrl, player, clock, _config, _logger);

            ctrl.SetViewModel(vm);

            return(ctrl);
        }
예제 #29
0
        public async Task <IActionResult> Series(string userId, long serieId,
                                                 long cubeId, int categoryOptionId)
        {
            var user = await _userManager.FindByIdAsync(userId);

            var cube = await _cubeService.GetCubeAsync(cubeId);

            var categoryOption = await _categoryService.GetSingleCategoryOptionAsync(categoryOptionId);

            if (user != null && cube != null && categoryOption != null)
            {
                var model = new TimerViewModel();
                await CreateSeriesModel(model, cube, user, categoryOption, serieId);

                return(View(model));
            }

            return(BadRequest());
        }
예제 #30
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.EdgesForExtendedLayout = UIRectEdge.None;

            viewModel = new TimerViewModel();

            this.Root = new RootElement("Timer")
            {
                new Section()
                {
                    (time = new StringElement(string.Empty, "4:00")),
                    new StringElement("Start", () => { viewModel.StartCommand.Execute(null); }),
                    new StringElement("Pause", () => { viewModel.PauseCommand.Execute(null); }),
                    new StringElement("Stop", () => { viewModel.StopCommand.Execute(null); })
                }
            };

            viewModel.PropertyChanged += viewModel_PropertyChanged;
        }