コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: VoidXH/Cavern
        /// <summary>
        /// Update a channel mapping when a selected channel was swapped.
        /// </summary>
        static void OnChannelChange(ChannelComboBox channel, ListBox channels)
        {
            int oldIndex = channels.SelectedIndex;

            if (oldIndex < 0)
            {
                channel.IsEnabled = false;
                return;
            }
            ReferenceChannel[] list = (ReferenceChannel[])channels.ItemsSource;
            list[channels.SelectedIndex] = (ReferenceChannel)channel.SelectedItem;
            channels.ItemsSource         = (ReferenceChannel[])list.Clone();
            channels.SelectedIndex       = oldIndex;
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: VoidXH/Cavern
 /// <summary>
 /// When selecting a channel on a channel mapping, allow its editing in the related combo box.
 /// </summary>
 static void OnChannelSelect(ChannelComboBox channel, ListBox channels)
 {
     channel.SelectedItem = channels.SelectedItem ?? null;
     channel.IsEnabled    = true;
 }