Пример #1
0
 private void CreateItems()
 {
     if (ScoreGroup == null)
     {
         return;
     }
     if (ViewClassic == ScoreItemClassic.Table)
     {
         GridTable.Visibility = Visibility.Visible;
         GridTree.Visibility  = Visibility.Collapsed;
         GridItemsTable.ColumnDefinitions.Clear();
         GridItemsTable.Children.Clear();
         for (int i = 0; i < ScoreGroup.Items.Count; i++)
         {
             ScoreItem item = ScoreGroup.Items[i];
             if (item.Type == ScoreObjectType.ScoreGroup)
             {
                 ScoreGroupViewer scoreGroupViewer = new ScoreGroupViewer();
                 scoreGroupViewer.ViewClassic = ViewClassic;
                 scoreGroupViewer.Settings    = Settings;
                 scoreGroupViewer.LangID      = LangID;
                 scoreGroupViewer.Languages   = Languages;
                 scoreGroupViewer.ScoreGroup  = item as ScoreGroup;
                 scoreGroupViewer.BorderBrush = Brushes.LightGray;
                 if (i > 0)
                 {
                     scoreGroupViewer.BorderThickness = new Thickness(1, 0, 0, 0);
                 }
                 GridItemsTable.ColumnDefinitions.Add(new ColumnDefinition());
                 GridItemsTable.Children.Add(scoreGroupViewer);
                 scoreGroupViewer.SetValue(Grid.ColumnProperty, i);
             }
             else
             {
                 StandardViewer ucStandard = new StandardViewer();
                 ucStandard.ViewClassic = ViewClassic;
                 ucStandard.Settings    = Settings;
                 ucStandard.LangID      = LangID;
                 ucStandard.Languages   = Languages;
                 ucStandard.Standard    = item as Standard;
                 ucStandard.BorderBrush = Brushes.LightGray;
                 if (i > 0)
                 {
                     ucStandard.BorderThickness = new Thickness(1, 0, 0, 0);
                 }
                 GridItemsTable.ColumnDefinitions.Add(new ColumnDefinition());
                 GridItemsTable.Children.Add(ucStandard);
                 ucStandard.SetValue(Grid.ColumnProperty, i);
             }
         }
     }
     else
     {
         GridTable.Visibility = Visibility.Collapsed;
         GridTree.Visibility  = Visibility.Visible;
         GridItemsTree.RowDefinitions.Clear();
         GridItemsTree.Children.Clear();
         for (int i = 0; i < ScoreGroup.Items.Count; i++)
         {
             ScoreItem item = ScoreGroup.Items[i];
             if (item.Type == ScoreObjectType.ScoreGroup)
             {
                 ScoreGroupViewer scoreGroupViewer = new ScoreGroupViewer();
                 scoreGroupViewer.ViewClassic = ViewClassic;
                 scoreGroupViewer.Settings    = Settings;
                 scoreGroupViewer.LangID      = LangID;
                 scoreGroupViewer.Languages   = Languages;
                 scoreGroupViewer.ScoreGroup  = item as ScoreGroup;
                 GridItemsTree.RowDefinitions.Add(new RowDefinition());
                 GridItemsTree.Children.Add(scoreGroupViewer);
                 scoreGroupViewer.SetValue(Grid.RowProperty, i);
             }
             else
             {
                 StandardViewer ucStandard = new StandardViewer();
                 ucStandard.ViewClassic = ViewClassic;
                 ucStandard.Settings    = Settings;
                 ucStandard.LangID      = LangID;
                 ucStandard.Languages   = Languages;
                 ucStandard.Standard    = item as Standard;
                 GridItemsTree.RowDefinitions.Add(new RowDefinition());
                 GridItemsTree.Children.Add(ucStandard);
                 ucStandard.SetValue(Grid.RowProperty, i);
             }
         }
     }
 }
Пример #2
0
        private void CreateScoreObject()
        {
            PanelScoreObjects.Children.Clear();
            if (ScoreObject != null)
            {
                ScoreSheet scoreSheet;
                switch (ScoreObject.Type)
                {
                case ScoreObjectType.ScoreSheet:
                    scoreSheet = ScoreObject as ScoreSheet;
                    if (scoreSheet != null)
                    {
                        ScoreSheetViewer scoreSheetViewer = new ScoreSheetViewer();
                        scoreSheetViewer.ScoreSheet  = scoreSheet;
                        scoreSheetViewer.Settings    = Settings;
                        scoreSheetViewer.Languages   = Languages;
                        scoreSheetViewer.LangID      = LangID;
                        scoreSheetViewer.ViewClassic = scoreSheet.ViewClassic;
                        PanelScoreObjects.Children.Add(scoreSheetViewer);
                    }
                    break;

                case ScoreObjectType.ScoreGroup:
                    ScoreGroup scoreGroup = ScoreObject as ScoreGroup;
                    if (scoreGroup != null)
                    {
                        scoreSheet = scoreGroup.ScoreSheet;
                        ScoreGroupViewer scoreGroupViewer = new ScoreGroupViewer();
                        scoreGroupViewer.ScoreGroup  = scoreGroup;
                        scoreGroupViewer.Settings    = Settings;
                        scoreGroupViewer.ViewClassic = scoreGroup.ViewClassic;
                        if (scoreSheet != null)
                        {
                            scoreGroupViewer.ViewClassic = scoreSheet.ViewClassic;
                        }
                        scoreGroupViewer.Languages = Languages;
                        scoreGroupViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(scoreGroupViewer);
                    }
                    break;

                case ScoreObjectType.NumericStandard:
                case ScoreObjectType.YesNoStandard:
                case ScoreObjectType.ItemStandard:
                case ScoreObjectType.SliderStandard:
                    Standard standard = ScoreObject as Standard;
                    if (standard != null)
                    {
                        scoreSheet = standard.ScoreSheet;
                        StandardViewer standardViewer = new StandardViewer();
                        standardViewer.ViewClassic = standard.ViewClassic;
                        if (scoreSheet != null)
                        {
                            standardViewer.ViewClassic = scoreSheet.ViewClassic;
                        }
                        standardViewer.Standard  = standard;
                        standardViewer.Settings  = Settings;
                        standardViewer.Languages = Languages;
                        standardViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(standardViewer);
                    }
                    break;

                case ScoreObjectType.StandardItem:
                    StandardItem standardItem = ScoreObject as StandardItem;
                    if (standardItem != null)
                    {
                        StandardItemViewer standardItemViewer = new StandardItemViewer();
                        standardItemViewer.StandardItem = standardItem;
                        standardItemViewer.Settings     = Settings;
                        standardItemViewer.Languages    = Languages;
                        standardItemViewer.LangID       = LangID;
                        PanelScoreObjects.Children.Add(standardItemViewer);
                    }
                    break;

                case ScoreObjectType.TextComment:
                case ScoreObjectType.ItemComment:
                    Comment comment = ScoreObject as Comment;
                    if (comment != null)
                    {
                        CommentViewer commentViewer = new CommentViewer();
                        commentViewer.Comment   = comment;
                        commentViewer.Settings  = Settings;
                        commentViewer.Languages = Languages;
                        commentViewer.LangID    = LangID;
                        PanelScoreObjects.Children.Add(commentViewer);
                    }
                    break;

                case ScoreObjectType.CommentItem:
                    CommentItem commentItem = ScoreObject as CommentItem;
                    if (commentItem != null)
                    {
                        CommentItemViewer commentItemViewer = new CommentItemViewer();
                        commentItemViewer.CommentItem = commentItem;
                        commentItemViewer.Settings    = Settings;
                        commentItemViewer.Languages   = Languages;
                        commentItemViewer.LangID      = LangID;
                        PanelScoreObjects.Children.Add(commentItemViewer);
                    }
                    break;

                case ScoreObjectType.ControlItem:
                    ControlItem controlItem = ScoreObject as ControlItem;
                    if (controlItem != null)
                    {
                        ControlItemViewer controlItemViewer = new ControlItemViewer();
                        controlItemViewer.ControlItem = controlItem;
                        controlItemViewer.Settings    = Settings;
                        controlItemViewer.Languages   = Languages;
                        controlItemViewer.LangID      = LangID;
                        PanelScoreObjects.Children.Add(controlItemViewer);
                    }
                    break;
                }
            }
        }