Beispiel #1
0
        private void MoveDownMenuItem_Click(object sender, EventArgs e)
        {
            var indices = LuaListView.SelectedRows.ToList();

            if (indices.Count == 0 || indices.Last() == LuaImp.ScriptList.Count - 1)
            {
                return;
            }

            for (var i = indices.Count - 1; i >= 0; i--)
            {
                var file = LuaImp.ScriptList[indices[i]];
                LuaImp.ScriptList.Remove(file);
                LuaImp.ScriptList.Insert(indices[i] + 1, file);
            }

            var newIndices = indices.Select(t => t + 1);

            LuaListView.DeselectAll();
            foreach (var i in newIndices)
            {
                LuaListView.SelectRow(i, true);
            }

            UpdateDialog();
        }
Beispiel #2
0
        private void MoveUpMenuItem_Click(object sender, EventArgs e)
        {
            var indices = LuaListView.SelectedRows.ToList();

            if (indices.Count == 0 || indices[0] == 0)
            {
                return;
            }

            foreach (var index in indices)
            {
                var file = LuaImp.ScriptList[index];
                LuaImp.ScriptList.Remove(file);
                LuaImp.ScriptList.Insert(index - 1, file);
            }

            var newIndices = indices.Select(t => t - 1);

            LuaListView.DeselectAll();
            foreach (var i in newIndices)
            {
                LuaListView.SelectRow(i, true);
            }

            UpdateDialog();
        }