/// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void ItemMenuItemCallback(object sender, EventArgs e)
        {
            var runtimeService   = this.container.GetExportedValue <IRuntimeService>();
            var settings         = this.Solution.GetSettings();
            var data             = runtimeService.GetDataGenerationData(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, false, -1);
            var dataSet          = SerializationUtility.Create(data);
            var projectInfoTable = dataSet.Tables[settings.ProjectInfo];

            var successCount = 0;
            var failCount    = 0;

            GenerationOutput.WriteLine($"------ Update from {settings.Address} \"{settings.DataBase}\" \"{settings.ProjectInfo}\": Selected Resource Files ------");
            foreach (var item in this.GetSelectedItems())
            {
                try
                {
                    item.Write(projectInfoTable);
                    GenerationOutput.WriteLine($"O>{item.GetFullPath()}");
                    successCount++;
                }
                catch (Exception ex)
                {
                    GenerationOutput.WriteLine($" >{item.GetFullPath()}:  error: {ex.Message}");
                    failCount++;
                }
            }
            GenerationOutput.WriteLine($"========== Update: Success {successCount}, Fail {failCount}: {DateTime.Now} ==========");
            GenerationOutput.WriteLine();
        }
Beispiel #2
0
        static void Write(Settings settings)
        {
            var runtimeService = Container.Get <IRuntimeService>();
            var data           = runtimeService.GetDataGenerationData(settings.Address, settings.DataBaseName, "all", null, false, -1);
            var dataSet        = SerializationUtility.Create(data);

            var projectInfoTable = dataSet.Tables[settings.ExportName];

            foreach (var item in projectInfoTable.Rows)
            {
                Write(settings.OutputPath, item);
            }
        }
        private void SolutionMenuItemCallback(object sender, EventArgs e)
        {
            var runtimeService   = this.container.GetExportedValue <IRuntimeService>();
            var settings         = this.Solution.GetSettings();
            var data             = runtimeService.GetDataGenerationData(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, false, -1);
            var dataSet          = SerializationUtility.Create(data);
            var projectInfoTable = dataSet.Tables[settings.ProjectInfo];

            foreach (var item in this.Solution.GetProjects())
            {
                this.Write(item, settings, projectInfoTable);
            }
            GenerationOutput.WriteLine();
        }
        private async void SolutionMenuItemCallback(object sender, EventArgs e)
        {
            var runtimeService = this.container.GetExportedValue <IRuntimeService>();
            var settings       = this.Solution.GetSettings();

            try
            {
                var data = await runtimeService.GetDataGenerationDataAsync(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, null);

                var dataSet          = SerializationUtility.Create(data);
                var projectInfoTable = dataSet.Tables[settings.ProjectInfo];

                foreach (var item in this.Solution.GetProjects())
                {
                    this.Write(item, settings, projectInfoTable);
                }
                GenerationOutput.WriteLine();
            }
            catch (Exception ex)
            {
                GenerationOutput.WriteLine($" > :  error: {ex.Message}");
            }
        }