コード例 #1
0
        // 下移
        private void BTN_Down_Click(object sender, RoutedEventArgs e)
        {
            var lrc = LV_Lrc.SelectedItem as LRC;

            if (lrc != null && lrc.Rank < LrcList.Last().Rank)
            {
                int index     = LrcList.IndexOf(lrc);
                var lowerItem = LrcList[index + 1];
                lowerItem.Rank = lrc.Rank++;
                LrcList.RemoveAt(index + 1);
                LrcList.Insert(index, lowerItem);
                TB_Message.Text = "下移成功!";
            }
            else
            {
                TB_Message.Text = "不需要移动!";
            }
        }
コード例 #2
0
        // 上移
        private void BTN_Up_Click(object sender, RoutedEventArgs e)
        {
            var lrc = LV_Lrc.SelectedItem as LRC;

            if (lrc != null && lrc.Rank > 1)
            {
                int index     = LrcList.IndexOf(lrc);
                var upperItem = LrcList[index - 1];
                upperItem.Rank = lrc.Rank--;
                LrcList.RemoveAt(index - 1);
                LrcList.Insert(index, upperItem);
                TB_Message.Text = "上移成功!";
            }
            else
            {
                TB_Message.Text = "不需要移动!";
            }
        }