Ejemplo n.º 1
0
        private void buttonImport_Click(object sender, RoutedEventArgs e)
        {
            ProjectWindow projectWindow = new ProjectWindow();

            if (projectWindow.ShowDialog() == true)
            {
                string labelText = "Importing Color Schemes...";
                UpdateLableDelegate updateLabelDelegate = new UpdateLableDelegate(statusLable.SetValue);
                Dispatcher.Invoke(updateLabelDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { TextBlock.TextProperty, labelText });

                string          projectId  = projectWindow.ProjectId;
                File            colorSheet = FileManager.FindSubItemByFolderId("Color Schemes", projectId);
                ColorSchemeInfo colorInfo  = BCFParser.ReadColorSchemes(colorSheet.Id, true);

                List <ColorDefinition> actionColors         = new List <ColorDefinition>();
                List <ColorDefinition> responsibilityColors = new List <ColorDefinition>();

                foreach (ColorScheme colorScheme in colorInfo.ColorSchemes)
                {
                    switch (colorScheme.SchemeName)
                    {
                    case "BCF Action":
                        actionColors = colorScheme.ColorDefinitions;
                        break;

                    case "BCF Responsibility":
                        responsibilityColors = colorScheme.ColorDefinitions;
                        break;
                    }
                }

                actionDefinitions      = actionColors.OrderBy(o => o.ParameterValue).ToList();
                responsibleDefinitions = responsibilityColors.OrderBy(o => o.ParameterValue).ToList();

                dataGridAction.ItemsSource = null;
                dataGridAction.ItemsSource = actionDefinitions;

                dataGridResponsibility.ItemsSource = null;
                dataGridResponsibility.ItemsSource = responsibleDefinitions;

                bool writeColor = BCFParser.WriteColorSheet(colorInfo, colorSheetId);
                labelText = "Ready";
                Dispatcher.Invoke(updateLabelDelegate, System.Windows.Threading.DispatcherPriority.Background, new object[] { TextBlock.TextProperty, labelText });
            }
        }