Ejemplo n.º 1
0
 private void TimerPreview_Click(object sender, EventArgs e)
 {
     if (sender is TimerPreview)
     {
         TimerPreview preview = sender as TimerPreview;
         preview.Focus();
     }
 }
Ejemplo n.º 2
0
        private void timerPreview_SaveRequested(object sender, SettingIOEventArgs e)
        {
            TimerPreview preview = sender as TimerPreview;

            if (preview == null)
            {
                return;
            }

            var success = true;

            try
            {
                var id = e.Settings.Id;

                // Fetch the current name for the timer to be saved
                var currentName = e.Settings.Name;
                if (currentName != null && !TimerSettings.IsUntitled(currentName))
                {
                    var settingsManager = this.savedTimersToolStripItem.SettingsManager;

                    // Fetch the old name for this timer in case it has been changed
                    ////var oldName = settingsManager.Fetch(id).Name;

                    // Update and save this timer
                    settingsManager.AddOrUpdate(e.Settings);
                    preview.Settings = settingsManager.Save(id);

                    this.AddSavedTimersToPreviews(preview.Settings.Id, preview.Settings.Name);

                    ////// Now, get the possible new Id
                    ////var newId = preview.Settings.Id;

                    ////// If the name has changed, remove it from the preview lists
                    ////if (!oldName.Equals(currentName))
                    ////{
                    ////    // Removed the old name from the dropdown and add the new name in
                    ////    this.ClearPresetFromPreviews(id, oldName);
                    ////    this.AddSavedTimersToPreviews(newId, currentName);
                    ////}
                }
            }
            catch (Exception)
            {
                success = false;
            }

            if (!success)
            {
                MessageBox.Show("Could not save setting. Please try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 3
0
        private void timerPreview_TimeElapsed(object sender, EventArgs e)
        {
            TimerPreview preview = sender as TimerPreview;

            if (preview == null)
            {
                return;
            }

            string title = "Time Elapsed";
            string text  = preview.DisplayName + " has elapsed. Click to open the timer";

            //this.notifyIcon.ShowBalloonTip(2000, title, text, ToolTipIcon.Info);

            this.notifyIcon.Text            = "Right click to open the Control Panel";
            this.notifyIcon.BalloonTipText  = text;
            this.notifyIcon.BalloonTipTitle = title;
            this.notifyIcon.Icon            = SystemIcons.Application;
            this.notifyIcon.BalloonTipIcon  = ToolTipIcon.Info;
            this.notifyIcon.ShowBalloonTip(5000);
        }