Exemple #1
0
 public MainPage()
 {
     NavigationPage.SetHasNavigationBar(this, false);
     myTimerOption = new TimerOption();
     GridChildrenInitialize();
     MainGridInitialize();
     StopWatch.AddLabelToDraw(timerNumL);
     SizeChanged += OnSizeChanged;
     Content      = mainG;
 }
Exemple #2
0
        public Settings()
        {
            //Loading pop-up interval from saved properties
            _interval = new IntervalOption("Pop-ups interval", getInterval());
            _notify   = new NotifyOption("Notification", getNotifyState());
            _vibrate  = new VibrateOption("Vibrate", getVibrateState());
            _timer    = new TimerOption("Timer", _interval.TimePeriod);
            // TODO: ADDING NEW OPTION: creating object

            _updateTimerValue = new UpdateTimerValue(OnPropertyChanged);
        }
Exemple #3
0
 //  construct fomr a time span
 public Timer(System.TimeSpan OriginTimeSpan, TimerOption timeroption)
 {
     originTimeSpan = OriginTimeSpan;
     diffTimeSpan   = originTimeSpan;
     startTime      = System.DateTime.Now;
     endTime        = startTime.Add(diffTimeSpan);
     currentTime    = System.DateTime.Now;
     expire         = false;
     alarm          = false;
     endSig         = false;
     pause          = false;
     timerOption    = timeroption;
 }
 public TimerConfigure(System.DateTime StartTime, System.DateTime EndTime, System.DateTime CurrentTime, System.DateTime PauseTime,
                       System.TimeSpan DiffTimeSpan, System.TimeSpan OriginTimeSpan,
                       bool Expire, bool Alarm, bool EndSig, bool Pause, TimerOption TO)
 {
     startTime      = StartTime;
     endTime        = EndTime;
     currentTime    = CurrentTime;
     pauseTime      = PauseTime;
     diffTimeSpan   = DiffTimeSpan;
     originTimeSpan = OriginTimeSpan;
     expire         = Expire;
     alarm          = Alarm;
     endSig         = EndSig;
     pause          = Pause;
     timerOption    = TO;
 }
Exemple #5
0
 //  Create a niew one, overload.
 public TimerForm(System.TimeSpan OriginTimeSpan, TimerOption timeroption, int CountLimit)
 {
     this.themeColors = new ThemeColors();
     InitializeComponent();
     this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(CloseWindowsReceicer);
     this.timer        = null;
     this.old          = false;
     //  To build the timer.
     this.option      = timeroption;
     this.duration    = OriginTimeSpan;
     this.ChooseStyle = ChooseStyle.TimeSpan;
     this.count_limit = CountLimit;
     this.refreshProgressBar(1); //  For User Experience
     this.displayer.AppendText(OriginTimeSpan.ToString("hh':'mm':'ss'.'fff"));
     this.button1.Text = "Start";
     this.soundconfigure.load();
 }
        //  Read the json file from the path and build from it.
        public virtual void load(string path)
        {
            TimerConfigure tc = new TimerConfigure();
            string         json;

            using (StreamReader sr = new StreamReader(path))
            {
                json = sr.ReadToEnd();
                Console.WriteLine("Read configure done.");
                tc                  = JsonConvert.DeserializeObject <TimerConfigure>(json);
                this.startTime      = tc.startTime;
                this.endTime        = tc.endTime;
                this.originTimeSpan = tc.originTimeSpan;
                this.expire         = tc.expire;
                this.endSig         = false;
                this.alarm          = tc.alarm;
                this.pause          = true;
                this.timerOption    = tc.timerOption;
                this.diffTimeSpan   = tc.diffTimeSpan;
                this.pauseTime      = tc.pauseTime;
            }
        }
Exemple #7
0
        //  Constructor: read cofigure from json file and build
        public Timer(string path = "./TimerConfig.json")
        {
            string json;

            using (StreamReader sr = new StreamReader(path))
            {
                json = sr.ReadToEnd();
                Console.WriteLine("Read configure done\n Now building the timer...");
                this.timerConfigure = JsonConvert.DeserializeObject <TimerConfigure>(json);
                this.startTime      = this.timerConfigure.startTime;
                this.endTime        = this.timerConfigure.endTime;
                this.originTimeSpan = this.timerConfigure.originTimeSpan;
                this.expire         = this.timerConfigure.expire;
                this.endSig         = false;
                this.alarm          = this.timerConfigure.alarm;
                this.pause          = true;
                this.timerOption    = this.timerConfigure.timerOption;
                this.diffTimeSpan   = this.timerConfigure.diffTimeSpan;
                this.currentTime    = System.DateTime.Now;
                this.pauseTime      = this.timerConfigure.pauseTime;
            }
        }
Exemple #8
0
        //  Overload
        private static Timer TimerBuildSwitcher(System.TimeSpan OriginTimeSpan, TimerOption timeroption, int cycle_limit = 0)
        {
            Timer T = null;

            switch (timeroption)
            {
            case TimerOption.Normal:
                T = new Timer(OriginTimeSpan, timeroption);
                break;

            case TimerOption.Cycle:
                T = new CycleTimer(OriginTimeSpan, timeroption);
                break;

            case TimerOption.Timing:
                //  This might go wrong.
                T = new TimingTimer(OriginTimeSpan, timeroption);
                break;

            case TimerOption.CycleCount:
                //  Here need to be modified, the limit should be sent from UI.
                //  Fixed
                T = new CycleCountTimer(OriginTimeSpan, timeroption, cycle_limit);
                break;

            case TimerOption.Interval:
                T = new IntervalCycleTimer(OriginTimeSpan, timeroption, cycle_limit);
                break;

            default:
                Console.WriteLine("Timer type not chosen, it's set to default now.");
                T = new Timer(OriginTimeSpan, TimerOption.Normal);     //  Build a default timer.
                break;
            }
            return(T);
        }
Exemple #9
0
 public TimingTimer(System.TimeSpan OriginTimeSpan, TimerOption timeroption) : base(
         OriginTimeSpan, timeroption)
 {
     ;
 }
Exemple #10
0
 public IntervalCycle_TimerConfigure(System.DateTime StartTime, System.DateTime EndTime, System.DateTime CurrentTime, System.DateTime PauseTime,
                                     System.TimeSpan DiffTimeSpan, System.TimeSpan OriginTimeSpan,
                                     bool Expire, bool Alarm, bool EndSig, bool Pause, TimerOption TO, int Interval, int Count) :
     base(StartTime, EndTime, CurrentTime, PauseTime, DiffTimeSpan, OriginTimeSpan, Expire, Alarm, EndSig, Pause, TO)
 {
     interval = Interval;
     count    = Count;
 }
Exemple #11
0
 public CycleCount_TimerConfigure(System.DateTime StartTime, System.DateTime EndTime, System.DateTime CurrentTime, System.DateTime PauseTime,
                                  System.TimeSpan DiffTimeSpan, System.TimeSpan OriginTimeSpan,
                                  bool Expire, bool Alarm, bool EndSig, bool Pause, TimerOption TO, int Limit, int Count) :
     base(StartTime, EndTime, CurrentTime, PauseTime, DiffTimeSpan, OriginTimeSpan, Expire, Alarm, EndSig, Pause, TO)
 {
     limit = Limit;
     count = Count;
 }
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.option = (TimerOption)(comboBox1.SelectedIndex + 1);   //  When selected the option, it will be set.
 }
 public CycleCountTimer(System.TimeSpan OriginTimeSpan, TimerOption timeroption, int Limit) : base(
         OriginTimeSpan, timeroption)
 {
     this.limit = Limit;
     this.count = 0;
 }
 public IntervalCycleTimer(System.TimeSpan OriginTimeSpan, TimerOption timeroption, int Interval) : base(
         OriginTimeSpan, timeroption)
 {
     this.interval     = Interval;
     this.intervalSpan = new System.TimeSpan(0, 0, this.interval);
 }