From 7d615eced8b1e8a54c2464e52b1cf1ff4d5f8831 Mon Sep 17 00:00:00 2001 From: Emmanuele Sassi Date: Fri, 15 Jan 2016 10:35:53 +0000 Subject: [PATCH] =?UTF-8?q?OmagCUT=20:=20-=20Aggiunta=20possibilit=C3=A0?= =?UTF-8?q?=20di=20spostare=20le=20lavorazioni=20nella=20listbox.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ImportPageUC.xaml | 6 ++--- OmagCUTDictionary.xaml | 2 +- SplitPageUC.xaml | 56 ++++++++++++++++++++++++++++++++++++++++-- SplitPageUC.xaml.vb | 35 ++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 7 deletions(-) diff --git a/ImportPageUC.xaml b/ImportPageUC.xaml index 44b1d00..4bebdf5 100644 --- a/ImportPageUC.xaml +++ b/ImportPageUC.xaml @@ -62,13 +62,11 @@ diff --git a/OmagCUTDictionary.xaml b/OmagCUTDictionary.xaml index 95b106b..263c7d7 100644 --- a/OmagCUTDictionary.xaml +++ b/OmagCUTDictionary.xaml @@ -297,7 +297,7 @@ - + diff --git a/SplitPageUC.xaml b/SplitPageUC.xaml index ee62181..23881e2 100644 --- a/SplitPageUC.xaml +++ b/SplitPageUC.xaml @@ -15,16 +15,68 @@ - + + - + + + + + + + + + + + + + + + + + + + + + + diff --git a/SplitPageUC.xaml.vb b/SplitPageUC.xaml.vb index 6772473..73e9f23 100644 --- a/SplitPageUC.xaml.vb +++ b/SplitPageUC.xaml.vb @@ -10,9 +10,44 @@ Public Class SplitPageUC m_MachiningList.Add(New NameIdLsBxItem("Taglio 1", "34")) m_MachiningList.Add(New NameIdLsBxItem("Taglio 2", "57")) + m_MachiningList.Add(New NameIdLsBxItem("Taglio 3", "57")) + m_MachiningList.Add(New NameIdLsBxItem("Taglio 4", "57")) + m_MachiningList.Add(New NameIdLsBxItem("Taglio 5", "57")) End Sub + Private Sub MoveUpBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveUpBtn.Click + MoveItem(-1) + End Sub + + Private Sub MoveDownBtn_Click(sender As Object, e As RoutedEventArgs) Handles MoveDownBtn.Click + MoveItem(1) + End Sub + + Public Sub MoveItem(direction As Integer) + ' Checking selected item + If MachiningLsBx.SelectedItem Is Nothing OrElse MachiningLsBx.SelectedIndex < 0 OrElse MachiningLsBx.SelectedItems.Count > 1 Then + Return + End If + ' No selected item - nothing to do + ' Calculate new index using move direction + Dim newIndex As Integer = MachiningLsBx.SelectedIndex + direction + + ' Checking bounds of the range + If newIndex < 0 OrElse newIndex >= MachiningLsBx.Items.Count Then + Return + End If + ' Index out of range - nothing to do + Dim selected As Object = MachiningLsBx.SelectedItem + + ' Removing removable element + m_MachiningList.Remove(selected) + ' Insert it in new position + m_MachiningList.Insert(newIndex, selected) + ' Restore selection + MachiningLsBx.SelectedItem = selected + End Sub + End Class Public Class NameIdLsBxItem