Exemple #1
0
        /// <summary>
        /// Notify of DB change for a rod. Records changes to file and
        /// executes any events attached.
        /// </summary>
        /// <param name="rod">Rod name of database that has been changed</param>
        private static void FishDBChanged(string rod)
        {
            DBByRod[rod].Save(GetFileName(rod));
            // Cache a few before doing a DB upload
            if (DBNewFish.Count > 4)
            {
                FishSQL.UploadNewFish();
            }

            if (null != OnChanged)
            {
                OnChanged();
            }
        } // @ private static void FishDBChanged(string rod)
        private void DoSync()
        {
            if (!FishSQL.OpenConnection())
            {
                return;
            }

            try
            {
                StartDBTransaction(Resources.DBSyncMessageStart);
                FishDB.MarkAllFishNew();
                FishDB.GetUpdates();
                FishSQL.BackgroundUpload();
                FishSQL.DoDownloadFish();
            }
            catch (Exception e)
            {
                Error(e.ToString());
            }
            EndDBTransaction(Resources.DBSyncMessageDone);
        }