void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.frmFunctionList = ((meatballs.FunctionList)(target));
                return;

            case 2:
                this.lstFunctions = ((System.Windows.Controls.ListBox)(target));
                return;

            case 3:
                this.lblNames = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
        private void BtnFunctionScan_Click(object sender, RoutedEventArgs e)
        {
            var           fileContent = string.Empty;
            var           fileName    = string.Empty;
            List <string> functions   = new List <string>();

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = "javascript files (*.js)|*.js|All files (*.*)|*.*";
            openFileDialog.FilterIndex      = 0;
            openFileDialog.RestoreDirectory = true;
            bool result = (bool)openFileDialog.ShowDialog();

            if (result)
            {
                //Get the path of specified file
                fileName = openFileDialog.SafeFileName;

                //Read the contents of the file into a stream
                var fileStream = openFileDialog.OpenFile();

                using (StreamReader reader = new StreamReader(fileStream))
                {
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        if (FunctionReader.LineContainsFunction(line))
                        {
                            functions.Add(FunctionReader.GetFunctionName(line));
                        }
                    }
                }

                FunctionList newListBox = new FunctionList(fileName, functions);
                newListBox.ShowDialog();
            }
        }