コード例 #1
0
ファイル: VoiceNote.cs プロジェクト: shubhtr/tomboy-1
        void OnRecordButtonClicked(object sender, EventArgs args)
        {
            start_record(voice_note_path);
            record_button.Sensitive = false;
            play_button.Sensitive   = false;
            stop_button.Sensitive   = true;

            // If there was not, now there is...
            if (!has_voice_note)
            {
                has_voice_note = true;
                Window.Icon    = icon;
            }

            button_manager.Reset(500);
        }
コード例 #2
0
		public override void Initialize ()
		{
			if (timeout == null) {
				timeout = new InterruptableTimeout ();
				timeout.Timeout += CheckNewDay;
				timeout.Reset (0);
				timeout_owner = true;
			}
			manager = Tomboy.DefaultNoteManager;
			initialized = true;
		}
コード例 #3
0
 public override void Initialize()
 {
     if (timeout == null)
     {
         timeout          = new InterruptableTimeout();
         timeout.Timeout += CheckNewDay;
         timeout.Reset(0);
         timeout_owner = true;
     }
     manager     = Tomboy.DefaultNoteManager;
     initialized = true;
 }
コード例 #4
0
ファイル: Task.cs プロジェクト: WisniowskiPiotr/tomboy
        /// <summary>
        /// Set a 4 second timeout to execute the save.  Possibly
        /// invalidate the text, which causes a re-serialize when the
        /// timeout is called...
        /// </summary>
        public void QueueSave(bool content_changed)
        {
            DebugSave("Got QueueSave");

            // Replace the existing save timeout.  Wait 4 seconds
            // before saving...
            save_timeout.Reset(4000);
            save_needed = true;

            if (content_changed)
            {
                data.LastChangeDate = DateTime.Now;
            }
        }
コード例 #5
0
        // Called only by instance with timeout_owner set.
        void CheckNewDay(object sender, EventArgs args)
        {
            Note notd = NoteOfTheDay.GetNoteByDate(manager, DateTime.Today);

            if (notd == null && !manager.ReadOnly)
            {
                NoteOfTheDay.CleanupOld(manager);

                // Create a new NotD if the day has changed
                NoteOfTheDay.Create(manager, DateTime.Now);
            }

            // Re-run every minute
            timeout.Reset(1000 * 60);
        }
コード例 #6
0
        public virtual bool BeginSyncTransaction()
        {
            // Lock expiration: If a lock file exists on the server, a client
            // will never be able to synchronize on its first attempt.	The
            // client should record the time elapsed
            if (File.Exists(lockPath))
            {
                SyncLockInfo currentSyncLock = CurrentSyncLock;
                if (initialSyncAttempt == DateTime.MinValue)
                {
                    Logger.Debug("Sync: Discovered a sync lock file, wait at least {0} before trying again.", currentSyncLock.Duration);
                    // This is our initial attempt to sync and we've detected
                    // a sync file, so we're gonna have to wait.
                    initialSyncAttempt = DateTime.Now;
                    lastSyncLockHash   = currentSyncLock.HashString;
                    return(false);
                }
                else if (lastSyncLockHash != currentSyncLock.HashString)
                {
                    Logger.Debug("Sync: Updated sync lock file discovered, wait at least {0} before trying again.", currentSyncLock.Duration);
                    // The sync lock has been updated and is still a valid lock
                    initialSyncAttempt = DateTime.Now;
                    lastSyncLockHash   = currentSyncLock.HashString;
                    return(false);
                }
                else
                {
                    if (lastSyncLockHash == currentSyncLock.HashString)
                    {
                        // The sync lock has is the same so check to see if the
                        // duration of the lock has expired.	If it hasn't, wait
                        // even longer.
                        if (DateTime.Now - currentSyncLock.Duration < initialSyncAttempt)
                        {
                            Logger.Debug("Sync: You haven't waited long enough for the sync file to expire.");
                            return(false);
                        }
                    }

                    // Cleanup Old Sync Lock!
                    CleanupOldSync(currentSyncLock);
                }
            }

            // Reset the initialSyncAttempt
            initialSyncAttempt = DateTime.MinValue;
            lastSyncLockHash   = string.Empty;

            // Create a new lock file so other clients know another client is
            // actively synchronizing right now.
            syncLock.RenewCount = 0;
            syncLock.Revision   = newRevision;
            UpdateLockFile(syncLock);
            // TODO: Verify that the lockTimeout is actually working or figure
            // out some other way to automatically update the lock file.
            // Reset the timer to 20 seconds sooner than the sync lock duration
            lockTimeout.Reset((uint)syncLock.Duration.TotalMilliseconds - 20000);

            updatedNotes = new List <string>();
            deletedNotes = new List <string>();

            return(true);
        }
コード例 #7
0
 public override void PostSyncCleanup()
 {
     // Set unmount timeout to 5 minutes or something
     unmountTimeout.Reset(1000 * 60 * 5);
 }