Esempio n. 1
0
        private void bnComponentRef_Click(object sender, EventArgs e)
        {
            try
            {
                string libraryPath = Path.Combine(_localPluginDirectory, "Library");
                if (!Directory.Exists(libraryPath))
                {
                    MessageBox.Show(string.Format("Directory {0} does not exist...", libraryPath));
                    return;
                }

                PluginLibraryBrowser form = new PluginLibraryBrowser(libraryPath);
                if (DialogResult.OK == form.ShowDialog())
                {
                    // tools
                    ComponentLoader loader = new ComponentLoader();
                    loader.SearchMethod = new ComponentSearchDirectory(libraryPath);
                    Component component = loader.LoadComponent(form._guid);

                    Pic.Plugin.Tools tools = new Pic.Plugin.Tools(component, new ComponentSearchDirectory(libraryPath));
                    // insert generated code
                    string sCode      = codeEditorCtrl.Text;
                    int    startIndex = sCode.IndexOf("factory.AddEntities(fTemp, transform);");
                    sCode = sCode.Insert(startIndex, tools.GetInsertionCode());
                    codeEditorCtrl.Text = sCode;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Esempio n. 2
0
        private void bnComponentRef_Click(object sender, EventArgs e)
        {
            try
            {
                string libraryPath = Path.Combine(_localPluginDirectory, "Library");
                if (!Directory.Exists(libraryPath))
                {
                    MessageBox.Show( string.Format("Directory {0} does not exist...", libraryPath) );
                    return;
                }

                PluginLibraryBrowser form = new PluginLibraryBrowser(libraryPath);
                if (DialogResult.OK == form.ShowDialog())
                {
                    // tools
                    ComponentLoader loader = new ComponentLoader();
                    loader.SearchMethod = new ComponentSearchDirectory(libraryPath);
                    Component component = loader.LoadComponent(form._guid);

                    Pic.Plugin.Tools tools = new Pic.Plugin.Tools(component, new ComponentSearchDirectory(libraryPath));
                    // insert generated code
                    string sCode = codeEditorCtrl.Text;
                    int startIndex = sCode.IndexOf("factory.AddEntities(fTemp, transform);");
                    sCode = sCode.Insert(startIndex, tools.GetInsertionCode());
                    codeEditorCtrl.Text = sCode;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }