Exemple #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);
        }
Exemple #2
0
        private void SetSyncCommandEnabledIfConfigValid()
        {
            var syncConfig = SyncConfig.CreateFromFile();
            ConfigValidCheckResult validConfig = ValidateConfigCreateMissingConfigMessage(syncConfig);

            contextMenuStrip1.Items["syncNowToolStripMenuItem"].Enabled = (validConfig.HasValidConfig);
        }
Exemple #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);
        }
Exemple #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;
        }