Example #1
0
        /// <summary>
        /// Runs a cycle if it hasn't been run today
        /// </summary>
        private static void RunOnAwake()
        {
            if (HasBeenRunToday())
            {
                //App has allready been run and will not be run again
                return;
            }

#if DEBUG
            //To allow debug mode to override the once-per-day rule
            Properties.Settings.Default.LastDiscardCycle = DateTime.Today.AddDays(-1);
#endif

            //Runs a discard cycle;
            DiscardCycle.RunNow(
                where : GetDiscardDirectories().Select(i => new DirectoryInfo(i)),
                cycles: (int)(DateTime.Today - Properties.Settings.Default.LastDiscardCycle).TotalDays
                );

            //Writes the flag file
            WriteFlagFile();

            _icon.UpdateIcon();
        }