Example #1
0
        private ConfigValidCheckResult ValidateConfigCreateMissingConfigMessage(SyncConfig config)
        {
            var result = new ConfigValidCheckResult {
                HasValidConfig = true
            };

            if (config == null)
            {
                result.HasValidConfig = false;
            }
            else
            {
                if (config.DestinationDir.IsNullOrWhitespace())
                {
                    result.Message       += "There isn't a destination media directory defined." + Environment.NewLine;
                    result.HasValidConfig = false;
                }

                if (config.SourceDir.IsNullOrWhitespace())
                {
                    result.Message       += "There isn't a source media directory defined." + Environment.NewLine;
                    result.HasValidConfig = false;
                }
            }
            return(result);
        }
Example #2
0
        private void SetSyncCommandEnabledIfConfigValid()
        {
            var syncConfig = SyncConfig.CreateFromFile();
            ConfigValidCheckResult validConfig = ValidateConfigCreateMissingConfigMessage(syncConfig);

            contextMenuStrip1.Items["syncNowToolStripMenuItem"].Enabled = (validConfig.HasValidConfig);
        }
Example #3
0
        private SyncConfig LoadSyncConfig()
        {
            var syncConfig = SyncConfig.CreateFromFile();

            ConfigValidCheckResult validConfig = ValidateConfigCreateMissingConfigMessage(syncConfig);

            if (validConfig.HasValidConfig == false)
            {
                ShowBalloon(validConfig.Message);
                optionsToolStripMenuItem_Click(null, null);
                return(null);
            }
            return(syncConfig);
        }
Example #4
0
        private ConfigValidCheckResult ValidateConfigCreateMissingConfigMessage(SyncConfig config)
        {
            var result = new ConfigValidCheckResult { HasValidConfig = true };

            if (config == null)
            {
                result.HasValidConfig = false;
            }
            else
            {
                if (config.DestinationDir.IsNullOrWhitespace())
                {
                    result.Message += "There isn't a destination media directory defined." + Environment.NewLine;
                    result.HasValidConfig = false;
                }

                if (config.SourceDir.IsNullOrWhitespace())
                {
                    result.Message += "There isn't a source media directory defined." + Environment.NewLine;
                    result.HasValidConfig = false;
                }
            }
            return result;
        }