private void PreExecuteSub()//16May2013
        {
            UIController = LifetimeService.Instance.Container.Resolve<IUIController>();

            ds = UIController.GetActiveDocument();

            if (ds != null) //24Apr2014 
            {
                List<string> datasetnames = new List<string>();
                int i = 0;

                Variables = new ObservableCollection<DataSourceVariable>(ds.Variables);
                datasetnames = UIController.GetDatasetNames();
                int count = datasetnames.Count;
                Datasets = new List<DatasetDisplay>();
                for (i = 0; i < count; i++)
                {
                    DatasetDisplay temp = new DatasetDisplay();
                    temp.Name = datasetnames[i];
                    temp.ImgURL = "../Resources/ordinal.png";
                    Datasets.Add(temp);


                }
            }
        }
        // Aaron 09/02/2013
        //Modified the command to check for filters on drag and drop
        //the drag over command provides visible indication of whether you can drag and drop an item over the control
        //If e.Effects =DragDropEffects.Move you can move the item, if e.Effects = DragDropEffects.Copy you can copy
        //If e.Effects =DragDropEffects.None, you cannot do anything AND THE DRAG AND DROP TERMINATES. THE function ListBox_Drop is not called

        private void ListBox_DragOver(object sender, DragEventArgs e)
        {
            // if ((AutoVar == false) && (BSkyCanvas.sourceDrag == (ListBox)sender)) e.Effects = DragDropEffects.None;
            // //else
            //// e.Effects = null != e.Data.GetData(typeof(object)) ? DragDropEffects.Move : DragDropEffects.None;

            //02/24/2013
            //Added by Aaron
            //THis ensures that the move icon is displayed when dragging and dropping within the same listbox
            //If we are not dragging and dropping within the same listbox, the copy icon is displayed

            //if ((AutoVar == true) && (BSkyCanvas.sourceDrag == (ListBox)sender)) e.Effects = DragDropEffects.Move;
            //Added 10/19/2013
            //Added the code below to support listboxes that only allow a pre-specified number of items or less
            //

            string[]       formats    = e.Data.GetFormats();
            DatasetDisplay sourcedata = e.Data.GetData(formats[0]) as DatasetDisplay;

            //Added 04/03/2014
            //If I highlight and drag something in a textbox and drag and drop to the variable list the application will hang
            //In code below I check whether sourcedata is of type datasource variable. If it is not, I drag allow the drop
            if (sourcedata == null)
            {
                e.Effects = DragDropEffects.None;
                e.Handled = true;
                return;
            }

            System.Windows.Forms.DialogResult diagResult;
            double result = -1;

            if (this.maxNoOfVariables != string.Empty && this.maxNoOfVariables != null)
            {
                try
                {
                    result = Convert.ToDouble(this.maxNoOfVariables);
                    //Console.WriteLine("Converted '{0}' to {1}.", this.maxNoOfVariables, result);
                }
                catch (FormatException)
                {
                    diagResult = System.Windows.Forms.MessageBox.Show("An invalid value has been entered for the maximum number of variables in the destination variable list", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question);
                }
                catch (OverflowException)
                {
                    diagResult = System.Windows.Forms.MessageBox.Show("An invalid value has been entered for the maximum number of variables in the destination variable list", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Question);
                }
                if (this.ItemsCount == result)
                {
                    e.Effects = DragDropEffects.None;
                    e.Handled = true;
                    return;
                }
            }


            //BSky.Controls.filter f=new filter();
            //Added by Aaron 09/02/2013

            //Added code below to check filters when dragging and dropping
            //
            //bool filterResults = CheckForFilter(sourcedata);

            //if (!filterResults)
            //{
            //    e.Effects = DragDropEffects.None;
            //    e.Handled = true;
            //    return;
            //}


            // if ((BSkyCanvas.sourceDrag == (ListBox)sender))
            // if ((sender == (ListBox)this))
            if (this == BSkyCanvas.sourceDataset)
            {
                e.Effects = DragDropEffects.Move;
            }
            else
            {
                e.Effects = DragDropEffects.Copy;
                int i = 10;
            }
            // else e.Effects = DragDropEffects.Copy;
            // //else e.Effects = DragDropEffects.Move;
            // e.Effects = DragDropEffects.Copy;
            e.Handled = true;
        }