示例#1
0
        /// <summary> Proceed toolbar button </summary>
        /// <param name="sender">Sender object </param>
        /// <param name="e">Event Args </param>
        /// <remarks>Process if there is something to process</remarks>
        private void btnProceed_Click(object sender, EventArgs e)
        {
            // Validate that there is something to process
            if (ValidResourceInfo())
            {
                // Build settings and validate that settings have been selected (language(s))
                var settings = _generation.BuildSettings(BuildSettingsString());
                if (ValidSettings(settings))
                {
                    // Add resource info and settings to a dictionary to be passed to processing class
                    var dictionary = new Dictionary <string, object>
                    {
                        { ProcessGeneration.ResourceInfoKey, _resourceInfo },
                        { ProcessGeneration.SettingsKey, settings }
                    };

                    // Setup display before processing
                    ProcessingSetup(Properties.Resources.ResourceFiles, _resourceInfo.Count * settings.Languages.Count, false);

                    // Start background worker for processing (async)
                    wrkBackground.RunWorkerAsync(dictionary);
                }
                else
                {
                    // No languages were selected
                    DisplayMessage(Properties.Resources.NoLanguagesSelected, MessageBoxIcon.Error);
                }
            }
            else
            {
                // No source files to process
                DisplayMessage(Properties.Resources.NothingToProcess, MessageBoxIcon.Error);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Run headless or via generation form?
            if (args.Length == 0)
            {
                Application.Run(new Generation());
            }
            else
            {
                var generation = new ProcessGeneration();

                // Get rid of quotes
                for (var arg = 0; arg < args.Length; arg++)
                {
                    args[arg] = args[arg].Replace("\"", "");
                }

                // Get resource info and validate
                var resourceInfo = generation.GetResourceInfo(@args[0]);
                if (!generation.ValidResourceInfo(resourceInfo))
                {
                    throw new Exception(Properties.Resources.ErrorResourceFile);
                }

                // Get settings and validate
                var settings = generation.BuildSettings(generation.GetSettings(@args[1]));
                if (!generation.ValidSettings(settings))
                {
                    throw new Exception(Properties.Resources.ErrorSettingsFile);
                }

                // Add resource info and settings to a dictionary to be passed to processing class
                var dictionary = new Dictionary <string, object>
                {
                    { ProcessGeneration.ResourceInfoKey, resourceInfo },
                    { ProcessGeneration.SettingsKey, settings }
                };

                // Start process
                generation.Process(dictionary);
            }
        }