Ejemplo n.º 1
0
        public void InitChildItems()
        {
            mListChildItems.Clear();
            var itemStandard = ScoreObject as ItemStandard;

            if (itemStandard != null)
            {
                ChildName = GetLanguage("PropertyViewer", string.Format("PRO301{0}", ScoreProperty.PRO_I_VALUEITEMS.ToString("000")), "Standard Item");
                for (int i = 0; i < itemStandard.ValueItems.Count; i++)
                {
                    var child = itemStandard.ValueItems[i];
                    ScoreChildInfoItem item = new ScoreChildInfoItem();
                    item.ParentObject = itemStandard;
                    item.SortID       = i;
                    item.Display      = child.Display;
                    item.Data         = child;
                    mListChildItems.Add(item);
                }
            }
            var itemComment = ScoreObject as ItemComment;

            if (itemComment != null)
            {
                ChildName = GetLanguage("PropertyViewer", string.Format("PRO301{0}", ScoreProperty.PRO_C_VALUEITEMS.ToString("000")), "Comment Item");
                for (int i = 0; i < itemComment.ValueItems.Count; i++)
                {
                    var child = itemComment.ValueItems[i];
                    ScoreChildInfoItem item = new ScoreChildInfoItem();
                    item.ParentObject = itemComment;
                    item.SortID       = i;
                    item.Display      = child.Display;
                    item.Data         = child;
                    mListChildItems.Add(item);
                }
            }
            var scoreSheet = ScoreObject as ScoreSheet;

            if (scoreSheet != null)
            {
                ChildName = GetLanguage("PropertyViewer", string.Format("PRO301{0}", ScoreProperty.PRO_CONTROLITEMS.ToString("000")), "Control Item");
                for (int i = 0; i < scoreSheet.ControlItems.Count; i++)
                {
                    var child = scoreSheet.ControlItems[i];
                    ScoreChildInfoItem item = new ScoreChildInfoItem();
                    item.ParentObject = scoreSheet;
                    item.SortID       = i;
                    item.Display      = child.Display;
                    item.Data         = child;
                    mListChildItems.Add(item);
                }
            }
        }
Ejemplo n.º 2
0
        void ListChild_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ScoreChildInfoItem oldValue = null;
            ScoreChildInfoItem newValue = null;

            if (e.RemovedItems != null && e.RemovedItems.Count > 0)
            {
                oldValue = e.RemovedItems[0] as ScoreChildInfoItem;
            }
            if (e.AddedItems != null && e.AddedItems.Count > 0)
            {
                newValue = e.AddedItems[0] as ScoreChildInfoItem;
            }
            RoutedPropertyChangedEventArgs <ScoreChildInfoItem> args = new RoutedPropertyChangedEventArgs <ScoreChildInfoItem>(
                oldValue, newValue);

            args.RoutedEvent = SelectedItemChangedEvent;
            RaiseEvent(args);
        }
Ejemplo n.º 3
0
        private void ResetScoreObjectOrder(ScoreChildInfoItem item, ScoreObject scoreObject)
        {
            //重新设置OrderID
            var         scoreSheet = scoreObject as ScoreSheet;
            ScoreObject itemObject = item.Data;

            if (itemObject == null)
            {
                return;
            }
            var controlItem = itemObject as ControlItem;

            if (scoreSheet != null && controlItem != null)
            {
                for (int i = 0; i < scoreSheet.ControlItems.Count; i++)
                {
                    scoreSheet.ControlItems[i].OrderID = i;
                }
            }
            var itemComment = scoreObject as ItemComment;
            var commentItem = itemObject as CommentItem;

            if (itemComment != null && commentItem != null)
            {
                for (int i = 0; i < itemComment.ValueItems.Count; i++)
                {
                    itemComment.ValueItems[i].OrderID = i;
                }
            }
            var itemStandard = scoreObject as ItemStandard;
            var standardItem = itemObject as StandardItem;

            if (itemStandard != null && standardItem != null)
            {
                for (int i = 0; i < itemStandard.ValueItems.Count; i++)
                {
                    itemStandard.ValueItems[i].OrderID = i;
                }
            }
        }
Ejemplo n.º 4
0
        public void MoveScoreObject(string method)
        {
            ScoreChildInfoItem selectedItem = GetSelectedItem();

            if (selectedItem == null)
            {
                return;
            }
            int index;

            index = mListChildItems.IndexOf(selectedItem);
            if (index > 0 && method == "Up")
            {
                var standardItem = selectedItem.Data as StandardItem;
                var itemStandard = ScoreObject as ItemStandard;
                if (standardItem != null && itemStandard != null)
                {
                    itemStandard.ValueItems.Remove(standardItem);
                    itemStandard.ValueItems.Insert(index - 1, standardItem);
                    ResetScoreObjectOrder(selectedItem, itemStandard);
                }
                var commentItem = selectedItem.Data as CommentItem;
                var itemComment = ScoreObject as ItemComment;
                if (commentItem != null && itemComment != null)
                {
                    itemComment.ValueItems.Remove(commentItem);
                    itemComment.ValueItems.Insert(index - 1, commentItem);
                    ResetScoreObjectOrder(selectedItem, itemComment);
                }
                var controlItem = selectedItem.Data as ControlItem;
                var scoreSheet  = ScoreObject as ScoreSheet;
                if (controlItem != null && scoreSheet != null)
                {
                    scoreSheet.ControlItems.Remove(controlItem);
                    scoreSheet.ControlItems.Insert(index - 1, controlItem);
                    ResetScoreObjectOrder(selectedItem, scoreSheet);
                }
                selectedItem.SortID--;
                mListChildItems.Remove(selectedItem);
                mListChildItems.Insert(index - 1, selectedItem);
                ListChild.SelectedItem = selectedItem;
            }
            else if (index < mListChildItems.Count - 1 && method == "Down")
            {
                var standardItem = selectedItem.Data as StandardItem;
                var itemStandard = ScoreObject as ItemStandard;
                if (standardItem != null && itemStandard != null)
                {
                    itemStandard.ValueItems.Remove(standardItem);
                    itemStandard.ValueItems.Insert(index + 1, standardItem);
                    ResetScoreObjectOrder(selectedItem, itemStandard);
                }
                var commentItem = selectedItem.Data as CommentItem;
                var itemComment = ScoreObject as ItemComment;
                if (commentItem != null && itemComment != null)
                {
                    itemComment.ValueItems.Remove(commentItem);
                    itemComment.ValueItems.Insert(index + 1, commentItem);
                    ResetScoreObjectOrder(selectedItem, itemComment);
                }
                var controlItem = selectedItem.Data as ControlItem;
                var scoreSheet  = ScoreObject as ScoreSheet;
                if (controlItem != null && scoreSheet != null)
                {
                    scoreSheet.ControlItems.Remove(controlItem);
                    scoreSheet.ControlItems.Insert(index + 1, controlItem);
                    ResetScoreObjectOrder(selectedItem, scoreSheet);
                }
                selectedItem.SortID++;
                mListChildItems.Remove(selectedItem);
                mListChildItems.Insert(index + 1, selectedItem);
                ListChild.SelectedItem = selectedItem;
            }
        }