예제 #1
0
        private void btnToDontExec_Click(object sender, RoutedEventArgs e)
        {
            ObservableCollection <object> selectd = lbDestination.SelectedItems as ObservableCollection <object>;

            object[] objs = selectd.ToArray <object>();
            foreach (INTFunction fun in objs)
            {
                m_DestinationFunctions.Remove(fun);
                m_SourceFunctions.Add(fun);
                RemoveFunction(fun);
            }
        }
예제 #2
0
        private void lbDestination_Drop(object sender, System.Windows.DragEventArgs e)
        {
            IList selected = (sender as System.Windows.Controls.ListBox).SelectedItems;

            ObservableCollection <object> dropped;
            NTFunctions dest   = null;
            NTFunctions source = null;

            if (sender == lbDestination)
            {
                source = m_SourceFunctions;
                dest   = m_DestinationFunctions;
            }
            else
            {
                dest   = m_SourceFunctions;
                source = m_DestinationFunctions;
            }

            try
            {
                dropped = e.Data.GetData("System.Windows.Controls.SelectedItemCollection") as ObservableCollection <object>;
                object[] objs = dropped.ToArray <object>();

                foreach (object o in objs)
                {
                    if (o.GetType().GetInterface(typeof(INTFunction).ToString()) != null)
                    {
                        source.Remove(o as INTFunction);
                    }

                    dest.Add(o as INTFunction);

                    if (sender == lbDestination)
                    {
                        AddFunction(o as INTFunction);
                    }
                    else
                    {
                        RemoveFunction(o as INTFunction);
                    }
                }
            }
            catch {}
        }