Beispiel #1
0
 public void Hide()
 {
     OutputForm?.Hide();
     OutputForm?.Close();
     Common.Util.DisposeObject(OutputForm);
     OutputForm = null;
 }
Beispiel #2
0
        public void Generate(ref OutputForm outputForm)
        {
            this.outputForm = outputForm;

            //
            RootName     = MainForm.RootDir_ProjectCodeName;
            RootDir      = MainForm.RootDir_ProjectLocation;
            SolutionName = MainForm.Project_SolutionName;
            ProjectName  = MainForm.Project_ProjectName;

            // Extra stuff
            AddSDL2_net = MainForm.AddSDL2_net;
            AddSDL2_ttf = MainForm.AddSDL2_ttf;

            // Create project files
            this.CreateDirectories();
            this.CreateSolutionFile();
            this.CreateProjectFile();
            this.CreateProjectFiltersFile();
            this.CreateProjectUserFile();
            this.CreateMainCppFile();
            this.CreatePrecompiledHeaders();
            this.CreateDpiAwareManifest();

            // Deploy all files
            this.DeployAllFiles();
        }
Beispiel #3
0
        public void Generate(ref OutputForm outputForm)
        {
            this.outputForm = outputForm;

            //
            RootName     = MainForm.RootDir_ProjectCodeName;
            RootDir      = MainForm.RootDir_ProjectLocation;
            TestDir      = RootDir + @"\Source\Tester\" + MainForm.Project_ProjectName + "Test";
            SolutionName = MainForm.Project_SolutionName;
            ProjectName  = MainForm.Project_ProjectName;
            TestName     = ProjectName + "Test";

            // Create project files
            this.CreateDirectories();
            this.CreateSolutionFile();
            this.CreateProjectFile();
            this.CreateProjectFiltersFile();
            this.CreateProjectUserFile();
            this.CreateLibrarySourceFiles();
            this.CreatePrecompiledHeaders();

            // Create test project files
            this.CreateTestProjectFile();
            this.CreateTestProjectFilterFile();
            this.CreateTestProjectUserFile();
            this.CreateTestMainCppFile();
            this.CreateTestPrecompiledHeaders();

            // Deploy all files
            this.DeployAllFiles();
        }
Beispiel #4
0
        public SqlMetalForm(SqlConnection selectedConnection)
        {
            InitializeComponent();

            _applicationManager =
                QuickSharp.Core.ApplicationManager.GetInstance();

            _persistenceManager = _applicationManager.
                                  GetPersistenceManager(Constants.PLUGIN_NAME);

            _sqlConnectionManager =
                SqlConnectionManager.GetInstance();

            _provider         = selectedConnection.Provider;
            _connectionString = selectedConnection.ConnectionString;

            _useCompactEdition = _sqlConnectionManager.
                                 ConnectionIsSqlServerCe(selectedConnection);

            _output = _applicationManager.GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY)
                      as OutputForm;

            /*
             * Get the tool path.
             */

            _sqlMetalPath = _persistenceManager.ReadString(
                Constants.KEY_SQL_METAL_PATH,
                Constants.SQL_METAL_DEFAULT_PATH);

            /*
             * Populate the filename with the database name.
             */

            _filenameTextBox.Text = GetOutputFilename();

            /*
             * Update the UI
             */

            Text = Resources.SqlMetalFormTitle;
            _filenameLabel.Text     = Resources.SqlMetalFormFilename;
            _includeGroupBox.Text   = Resources.SqlMetalFormIncludeGroup;
            _viewsCheckBox.Text     = Resources.SqlMetalFormViews;
            _functionsCheckBox.Text = Resources.SqlMetalFormFunctions;
            _sprocsCheckBox.Text    = Resources.SqlMetalFormSprocs;
            _okButton.Text          = Resources.SqlMetalFormOk;
            _cancelButton.Text      = Resources.SqlMetalFormCancel;

            CheckToolAvailable();

            /*
             * Allow client applications to modify form.
             */

            SqlMetalFormProxy.GetInstance().
            UpdateFormControls(Controls);
        }
Beispiel #5
0
 public void Show()
 {
     OutputForm = _instrumentFormFactory.Create(Type, Renderer
                                                );
     if (OutputForm != null && !OutputForm.Visible)
     {
         OutputForm.Show();
     }
 }
Beispiel #6
0
        private void ActivatePlugin()
        {
            _findTextHistory    = new List <String>();
            _replaceTextHistory = new List <String>();
            _fileSpecHistory    = new List <String>();

            /*
             * Access the output window.
             */

            _output = ApplicationManager.GetInstance().GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY) as OutputForm;

            if (_output == null)
            {
                return;
            }

            _output.ClearOutputViews();

            /*
             * Create the menu items.
             */

            ToolStripMenuItem editMenu = _mainForm.GetMenuItemByName(
                QuickSharp.Editor.Constants.UI_EDIT_MENU);

            if (editMenu == null)
            {
                return;
            }

            int index = editMenu.DropDownItems.IndexOfKey(
                QuickSharp.Editor.Constants.UI_EDIT_MENU_REPLACE);

            if (index == -1)
            {
                return;
            }

            ToolStripMenuItem findMenu = MenuTools.CreateMenuItem(
                Constants.UI_EDIT_MENU_FIND_IN_FILES,
                Resources.MainEditMenuFindInFiles,
                null, Keys.Control | Keys.Shift | Keys.F,
                null, delegate { FindInFiles(true); });

            ToolStripMenuItem replaceMenu = MenuTools.CreateMenuItem(
                Constants.UI_EDIT_MENU_REPLACE_IN_FILES,
                Resources.MainEditMenuReplaceInFiles,
                null, Keys.Control | Keys.Shift | Keys.H,
                null, delegate { FindInFiles(false); }, true);

            editMenu.DropDownItems.Insert(index + 1, replaceMenu);
            editMenu.DropDownItems.Insert(index + 1, findMenu);
        }
Beispiel #7
0
        public static void ShowOutputForm(this OutputForm form, ref EventHandler eventHandler)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }

            eventHandler      += form.TextEventHandler;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.Show();
        }
        private async void GitCommand_Click(object sender, EventArgs eventArgs)
        {
            GitContextMenuCommand gitCommand = sender.GetTagValue <GitContextMenuCommand>();

            if (gitCommand == null)
            {
                return;
            }

            BeginExecutingGitCommand();

            (bool Success, string[] ErrorOutput)result;

            try
            {
                string command = gitCommand.Command.Replace(Settings.BRANCH_IDENTIFIER, Branch);

                if (Settings.Default.ShowGitCommandOutput)
                {
                    using (OutputForm errorForm = new OutputForm(outputHandler =>
                                                                 Root.SafeGitExecuteAsync(Path, command, outputHandler.AddLine),
                                                                 showInTaskbar: true))
                    {
                        errorForm.ShowDialog(this);
                        result = errorForm.OperationResult;
                    }
                }
                else
                {
                    result = await Root.SafeGitExecuteAsync(Path, command);
                }
            }
            finally
            {
                DoneExecutingGitCommand();
            }

            if (result.Success)
            {
                await RefreshInfo(resetRemoteStatus : false);
            }
            else if (!Settings.Default.ShowGitCommandOutput)
            {
                using (OutputForm errorForm = new OutputForm(result.ErrorOutput, showInTaskbar: true))
                {
                    errorForm.ShowDialog(this);
                }
            }
        }
Beispiel #9
0
        private void CompileWithErrorHandler()
        {
            log.Info("编译程序启动");
            if (editor.Text == "")
            {
                log.Info("编辑框为空");
                if (System.Threading.Thread.CurrentThread.CurrentCulture.Name == "zh-CN")
                {
                    MessageBox.Show("错误:编辑框为空。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    MessageBox.Show("The textbox is empty.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                return;
            }

            log.Info("正在进行编译");
            CompilerResults cr = CompilerManager.CompileFromString(editor.Text);

            log.Info("输出框弹出");
            OutputForm of = new OutputForm();

            of.Owner = this;
            string tempcr = System.Threading.Thread.CurrentThread.CurrentCulture.Name == "zh-CN"
                ? "================ Compiler Output ================"
                : "=================== 编译器输出 ===================";

            foreach (string str in cr.Output)
            {
                tempcr = tempcr + "\r\n" + str;
            }
            of.OutputText = tempcr;
            of.Show();

            log.Info("正在检查操作");
            if (!File.Exists("rcse_compiled.cache.lk"))
            {
                log.Info("返回: 未能找到被编译文件");
                MessageBox.Show("无法找到编译文件: 是否编译错误?", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            log.Info("编译成功,正在重命名文件");
            File.Move("rcse_compiled.cache.lk", "dbgcache.exe");
        }
Beispiel #10
0
 public void childForm(Form parent, int switcher)
 {
     if (Application.OpenForms["InputForm"] == null && switcher == 1)
     {
         InputForm F1 = new InputForm();
         F1.MdiParent = parent;
         F1.Show();
     }
     if (Application.OpenForms["OutputForm"] == null && switcher == 2)
     {
         OutputForm F2 = new OutputForm();
         F2.MdiParent = parent;
         F2.Show();
     }
     if (Application.OpenForms["Settings"] == null && switcher == 3)
     {
         Settings F3 = new Settings();
         F3.ShowDialog();
     }
 }
Beispiel #11
0
        private void btnEditRegisterOutput_Click(object sender, EventArgs e)
        {
            if (typeUserOutput == 1)
            {
                if (dataGridView.SelectedRows.Count > 0)
                {
                    edit = true;
                    string Marca  = dataGridView.CurrentRow.Cells["Marca"].Value.ToString();
                    string Modelo = dataGridView.CurrentRow.Cells["Modelo"].Value.ToString();
                    string Nserie = dataGridView.CurrentRow.Cells["Nserie"].Value.ToString();
                    string BDI    = dataGridView.CurrentRow.Cells["BDI"].Value.ToString();
                    string ULab   = dataGridView.CurrentRow.Cells["Ulab"].Value.ToString();

                    string Destino        = dataGridView.CurrentRow.Cells["Destino"].Value.ToString();
                    string TableroDestino = dataGridView.CurrentRow.Cells["TableroDestino"].Value.ToString();
                    string FechaSalida    = dataGridView.CurrentRow.Cells["FechaSalida"].Value.ToString();
                    string Observacion    = dataGridView.CurrentRow.Cells["Observación"].Value.ToString();
                    string IdOutput       = dataGridView.CurrentRow.Cells["Id"].Value.ToString();

                    this.Hide();
                    OutputForm formETR = new OutputForm(Convert.ToInt32(IdUserOutput));
                    formETR.getEditRegisterOutput(Marca, Modelo, Nserie, BDI, ULab, Destino, TableroDestino, FechaSalida, Observacion, IdOutput, edit);
                    formETR.ShowDialog();
                    this.Show();
                    show();
                }
                else
                {
                    MessageBox.Show("Seleccione una fila por favor");
                }
            }
            if (typeUserOutput == 2)
            {
                edit = true;
            }
        }
Beispiel #12
0
 public static string BytesToPrefixedValue(long Size, PrefixType PType, OutputForm PForm, SuffixType SType, OutputForm SForm)
 {
     for (int index = 0; index <= SA_Convert.prefixvalues.GetLength(0); ++index)
       {
     if (Size < SA_Convert.prefixvalues[index + 1][(int) PType])
       return string.Concat(new object[4]
       {
     (object) ((Decimal) Size / (Decimal) SA_Convert.prefixvalues[index][(int) PType] * (Decimal) SA_Convert.suffixvalues[(int) SType]).ToString("#.##"),
     (object) ' ',
     (object) SA_Convert.prefixes[(int) (PType + (int) PForm)][index],
     (object) SA_Convert.suffixes[(int) SType][(int) SForm]
       });
       }
       return "";
 }
Beispiel #13
0
        private void ProcessButton_Click(object sender, EventArgs e)
        {
            {
                double number; //for string exception

                //null exception
                if (selectedListBox.Items.Count == 0)
                { //variable
                    MessageBox.Show("You have to choose at least 1 variable!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_m.Text) == true)
                { //particle
                    MessageBox.Show("Number of fuzzifier(m) shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_konsa.Text) == true)
                {
                    MessageBox.Show("Coef (A) shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_eta.Text) == true)
                {
                    MessageBox.Show("Number of fuzzifier(η) shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_konsb.Text) == true)
                {
                    MessageBox.Show("Coef (B) shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_konsk.Text) == true)
                {
                    MessageBox.Show("Coef (K) shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_maxiter.Text) == true)
                {
                    MessageBox.Show("max iteration PFCM shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_error.Text) == true)
                {
                    MessageBox.Show("error coef shouldn't be empty!");
                }
                else if (string.IsNullOrWhiteSpace(textBox_clus.Text) == true)
                {
                    MessageBox.Show("Number of cluster shouldn't be empty!");
                }


                //string exception
                else if (double.TryParse(textBox_m.Text, out number) == false)
                { //particle
                    MessageBox.Show("Number of fuzzifier(m) should be a natural number!");
                }
                else if (double.TryParse(textBox_konsa.Text, out number) == false)
                { //particle
                    MessageBox.Show("Coef (A) should be a number!");
                }
                else if (double.TryParse(textBox_eta.Text, out number) == false)
                { //mulai disini
                    MessageBox.Show("Number of fuzzifier(η) should be a  number!");
                }
                else if (double.TryParse(textBox_konsb.Text, out number) == false)
                { //particle
                    MessageBox.Show("Coef (B) should be a natural number!");
                }
                else if (double.TryParse(textBox_konsk.Text, out number) == false)
                { //particle
                    MessageBox.Show("Coef (K) should be a natural number!");
                }
                else if (double.TryParse(textBox_maxiter.Text, out number) == false)
                { //particle
                    MessageBox.Show("max iteration PFCM should be a natural number!");
                }
                else if (double.TryParse(textBox_error.Text, out number) == false)
                { //particle
                    MessageBox.Show("error coef should be a natural number!");
                }
                else if (double.TryParse(textBox_clus.Text, out number) == false)
                { //particle
                    MessageBox.Show("Number of cluster should be a number!");
                }


                else
                {
                    double ncluster = Convert.ToDouble(textBox_clus.Text);
                    double m        = Convert.ToDouble(textBox_m.Text);
                    double eta      = Convert.ToDouble(textBox_eta.Text);
                    double a        = Convert.ToDouble(textBox_konsa.Text);
                    double b        = Convert.ToDouble(textBox_konsb.Text);
                    double K        = Convert.ToDouble(textBox_konsk.Text);
                    double error    = Convert.ToDouble(textBox_error.Text);
                    double maxiter  = Convert.ToDouble(textBox_maxiter.Text);

                    DataTable dt = GetFromMainForm();

                    if (maxiter < 1)
                    {
                        MessageBox.Show("Maximum iteration should be greater or equal to 1!");
                    }
                    else if (maxiter % 1 != 0)
                    {
                        MessageBox.Show("Maximum iteration shouldn't be in decimal!");
                    }
                    else if (ncluster < 2)
                    {
                        MessageBox.Show("Number of cluster should be greater or equal to 2!");
                    }
                    else if (ncluster % 1 != 0)
                    {
                        MessageBox.Show("Number of cluster shouldn't be in decimal!");
                    }
                    else if (a < 1)
                    {
                        MessageBox.Show("Coef (A) should be equal or greater than 1");
                    }
                    else if (b <= 0)
                    {
                        MessageBox.Show("Coef (B) should be equal or greater than 1");
                    }
                    else if (K < 0)
                    {
                        MessageBox.Show("Coef (K) should be equal or greater than 1");
                    }
                    else if (error <= 0)
                    {
                        MessageBox.Show("Value of error should be greater than 0");
                    }
                    else if (m < 1)
                    {
                        MessageBox.Show("Fuzzifier (m) should be greater or equal to 1!");
                    }
                    else if (eta < 1)
                    {
                        MessageBox.Show("Fuzzifier (η) should be greater or equal to 1!");
                    }

                    else if (mapcheckBox.Checked == true && (string.IsNullOrWhiteSpace(maptextBox.Text) || datakeyListBox.Items.Count == 0))
                    {
                        MessageBox.Show("You have checked the map, so you must have a shapefile and its datakey or you can uncheck it!");
                    }

                    else
                    {
                        pb.Show();
                        ProcessButton.Enabled   = false;
                        fcmCancelButton.Enabled = false;
                        this.UseWaitCursor      = true;
                        processOutput();
                        OutputForm of = new OutputForm("Posibillistic - Fuzzy C-Means", parname, parval,
                                                       center, partition, allclusters, viname, vival, isnamed, mf.userlang.NumberFormat.NumberDecimalSeparator);
                        of.Show();
                        mf.WindowState     = FormWindowState.Minimized;
                        this.UseWaitCursor = false;
                        this.Close();
                        pb.Dispose();
                    }
                }
            }
        }
Beispiel #14
0
 public Finder(OutputForm output)
 {
     _mainForm         = ApplicationManager.GetInstance().MainForm;
     _outputForm       = output;
     _outputLineParser = new FinderOutputLineParser();
 }
Beispiel #15
0
        private void button1_Click(object sender, EventArgs e)
        {
            double left, right, Nmax, U0, h, a, b, c, z, E;


            if (textBoxLeft.Text != "")
            {
                left = Convert.ToDouble(textBoxLeft.Text);
            }
            else
            {
                left = 0;
            }
            if (textBoxRight.Text != "")
            {
                right = Convert.ToDouble(textBoxRight.Text);
            }
            else
            {
                right = 1;
            }
            if (textBoxNmax.Text != "")
            {
                Nmax = Convert.ToDouble(textBoxNmax.Text);
            }
            else
            {
                Nmax = 100;
            }
            if (textBoxU0.Text != "")
            {
                U0 = Convert.ToDouble(textBoxU0.Text);
            }
            else
            {
                U0 = 0;
            }
            if (textBoxH.Text != "")
            {
                h = Convert.ToDouble(textBoxH.Text);
            }
            else
            {
                h = 0.1;
            }
            if (textBoxA.Text != "")
            {
                a = Convert.ToDouble(textBoxA.Text);
            }
            else
            {
                a = 0;
            }
            if (textBoxB.Text != "")
            {
                b = Convert.ToDouble(textBoxB.Text);
            }
            else
            {
                b = 0;
            }
            if (textBoxC.Text != "")
            {
                c = Convert.ToDouble(textBoxC.Text);
            }
            else
            {
                c = 0;
            }
            if (textBoxZ.Text != "")
            {
                z = Convert.ToDouble(textBoxZ.Text);
            }
            else
            {
                z = 0;
            }
            if (textBoxE.Text != "")
            {
                E = Convert.ToDouble(textBoxE.Text);
            }
            else
            {
                E = 0.0001;
            }

            double n = (right - left) / h;

            n = n > Nmax ? Nmax : n;
            Step[] allSteps  = new Step[(int)n + 1];
            Step[] allSteps2 = new Step[(int)n + 1];


            allSteps  = Functions.RKMdecision(left, right, Nmax, U0, h, a, b, c, E).Item1;
            allSteps2 = Functions.RKMdecision(left, right, Nmax, U0, h, a, b, c, E).Item2;

            OutputForm output = new OutputForm(allSteps, allSteps2);

            output.Show();
        }
Beispiel #16
0
        //моделирование
        private void Modeling()
        {
            btnCancel.Enabled    = true;
            btnCalculate.Enabled = false;

            //инициализация параметров расчета
            Init();

            if (rbSeq.Checked)
            {
                InitSequential();
            }

            if (rbCUDA.Checked || rbOpenMP.Checked)
            {
                InitParallel();
            }

            //запуск расчета в отдельном потоке
            //просходит вызов метода CalculationSeq или CalculationParallel
            //подробнее смотри в файле Main.cs метод bgw_DoWork()
            bgw.RunWorkerAsync();

            //вывод скоростей графическом виде
            if (сbGraphicsProcess.Checked)
            {
                grForm = new GraphicsForm(X, Y, x0, len, rbSpeeds.Checked, rbTemp.Checked, scale: scale);
                grForm.Show();
                grForm.Closing += grForm_Closing;
            }

            bool error;

            //пока идет расчет
            while (bgw.IsBusy)
            {
                //вывод графики в процессе
                if (сbGraphicsProcess.Checked)
                {
                    error = grForm.DrawDisplay(Ux, Uy, Temp);
                    if (error)
                    {
                        bgw.CancelAsync();
                    }
                }
                //если расчет до установления
                if (rbSetSpeeds.Checked)
                {
                    pgb.Style   = ProgressBarStyle.Marquee;
                    lblPrc.Text = "Расчеты выполняются ...";
                }
                Application.DoEvents();
            }

            //вывод результатов  в текстовом виде
            if (cbTextFile.Checked)
            {
                outForm = new OutputForm {
                    X = X, Y = Y
                };
                outForm.Show();
                if (rbSpeeds.Checked)
                {
                    outForm.OutSpeeds(Ux, Uy);
                }
                if (rbTemp.Checked)
                {
                    outForm.OutTemp(Temp);
                }
            }


            //вывод результатов графики
            if (сbGraphicsResult.Checked)
            {
                grForm = new GraphicsForm(X, Y, x0, len, rbSpeeds.Checked, rbTemp.Checked, scale: scale);
                grForm.Show();
                grForm.DrawDisplay(Ux, Uy, Temp);
            }

            //освобождение ресурсов, если были использованы параллельные вычисления
            if (rbPU.Checked)
            {
                if (rbCUDA.Checked || rbOpenMP.Checked)
                {
                    parPU.Dispose();
                }
            }

            if (rbWPsi.Checked)
            {
                if (rbCUDA.Checked || rbOpenMP.Checked)
                {
                    parWPsi.Dispose();
                }
            }
        }
Beispiel #17
0
        private void ActivatePlugin()
        {
            ModuleProxy.GetInstance().Module = this;

            _applicationManager   = ApplicationManager.GetInstance();
            _pluginManager        = PluginManager.GetInstance();
            _sqlConnectionManager = SqlConnectionManager.GetInstance();
            _sqlConnectionManager.Load();

            /*
             * Enable SqlMetal/DMBL extract features if client flag set.
             */

            bool enableSqlMetal =
                _applicationManager.ClientProfile.HaveFlag(
                    ClientFlags.SqlManagerEnableDbmlExtract);

            _output = _applicationManager.GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY) as
                      OutputForm;

            _toolsMenuRunQuery = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_RUN_QUERY,
                Resources.MainToolsMenuRunQuery,
                Resources.RunQuery,
                Keys.F5, null, UI_TOOLBAR_RUN_SQL_QUERY_Click,
                true);

            ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName(
                QuickSharp.Core.Constants.UI_TOOLS_MENU);

            int index = toolsMenu.DropDownItems.IndexOfKey(
                QuickSharp.Core.Constants.UI_TOOLS_MENU_OPTIONS);

            /*
             * If menu not found insert at the top.
             */

            if (index == -1)
            {
                index = 0;
            }

            toolsMenu.DropDownItems.Insert(index, _toolsMenuRunQuery);

            /*
             * Create toolbar buttons.
             */

            _toolbarSqlConnection = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_SQL_CONNECTION,
                Resources.ToolbarSqlConnection,
                Resources.SqlConnection,
                UI_TOOLBAR_SQL_CONNECTION_Click,
                true);

            _toolbarSqlConnection.ToolTipText =
                Resources.ToolbarActivateConnection;

            _toolbarSqlConnectionSelect =
                MenuTools.CreateToolbarDropDownButton(
                    Constants.UI_TOOLBAR_SQL_CONNECTION_SELECT, null);

            _toolbarSqlConnectionSelect.DropDownOpening +=
                new EventHandler(
                    ToolbarSqlConnectionSelect_DropDownOpening);

            _toolbarSqlRunQuery = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_SQL_RUN_QUERY,
                Resources.ToolbarSqlRunQuery,
                Resources.RunQuery,
                UI_TOOLBAR_RUN_SQL_QUERY_Click);

            _toolbarSqlExtractDbml = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_SQL_EXTRACT_DBML,
                Resources.ToolbarSqlExtractDbml,
                Resources.ExtractDbml,
                UI_TOOLBAR_SQL_EXTRACT_DBML_Click);

            _mainForm.MainToolbar.Items.Add(_toolbarSqlConnection);
            _mainForm.MainToolbar.Items.Add(_toolbarSqlConnectionSelect);
            _mainForm.MainToolbar.Items.Add(_toolbarSqlRunQuery);

            if (enableSqlMetal)
            {
                _mainForm.MainToolbar.Items.Add(_toolbarSqlExtractDbml);
            }

            _mainForm.FormClosing +=
                new FormClosingEventHandler(MainForm_FormClosing);

            _mainForm.ClientWindow.ActiveDocumentChanged +=
                new EventHandler(ClientWindow_ActiveDocumentChanged);

            _applicationManager.RegisterOptionsPageFactory(
                delegate { return(new SqlConnectionsOptionsPage()); });

            if (enableSqlMetal)
            {
                _applicationManager.RegisterOptionsPageFactory(
                    delegate { return(new SqlMetalOptionsPage()); });
            }

            _applicationManager.FileSystemChange +=
                new MessageHandler(UpdateUI);

            /*
             * We don't have any build tools but we want SQL files
             * recognised as source files. Register with the
             * non-tool source files list in the application store.
             */

            ApplicationStorage appStore = ApplicationStorage.GetInstance();

            /*
             * We have no dependency on the BuildTools plugin so we
             * can't assume the non-tool source list has been created.
             * Use the Get method to create the list if it doesn't exist.
             */

            List <String> nonToolSourceTypes = appStore.Get(
                Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES,
                typeof(List <String>)) as List <String>;

            if (nonToolSourceTypes != null)
            {
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SQL);
            }

            UpdateUI();
        }
Beispiel #18
0
        private void ActivatePlugin()
        {
            ModuleProxy.GetInstance().Module = this;

            _applicationManager = ApplicationManager.GetInstance();
            _applicationStorage = ApplicationStorage.GetInstance();

            _applicationManager.RegisterOptionsPageFactory(
                delegate { return(new BuildToolOptionsPage()); });

            if (!_applicationManager.ClientProfile.HaveFlag(
                    ClientFlags.BuildToolsDisableBuildSettingsPage))
            {
                _applicationManager.RegisterOptionsPageFactory(
                    delegate { return(new BuildSettingsOptionsPage()); });
            }

            _applicationManager.DocumentFilterHandlers.Add(
                GetSourceFilesFilter);

            #region UI Elements

            bool disableCompilerUI = _applicationManager.ClientProfile.
                                     HaveFlag(ClientFlags.BuildToolsDisableCompilerUI);

            _output = _applicationManager.GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY)
                      as OutputForm;

            /* Menu items */

            _toolsMenuCompile = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE,
                Resources.MainToolsMenuCompile,
                Resources.Compile,
                Keys.Shift | Keys.F5, null, UI_TOOLS_MENU_COMPILE_Click);

            _toolsMenuCompileAll = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE_ALL,
                Resources.MainToolsMenuCompileAll,
                null,
                Keys.F6, null, UI_TOOLS_MENU_COMPILE_ALL_Click,
                true);

            _toolsMenuRun = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_RUN,
                Resources.MainToolsMenuRun,
                Resources.Run,
                Keys.Control | Keys.F5, null, UI_TOOLS_MENU_RUN_Click);

            if (disableCompilerUI)
            {
                _toolsMenuRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName(
                QuickSharp.Core.Constants.UI_TOOLS_MENU);

            if (!disableCompilerUI)
            {
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompileAll);
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompile);
            }

            toolsMenu.DropDownItems.Insert(0, _toolsMenuRun);
            toolsMenu.DropDownOpening +=
                new EventHandler(ToolsMenu_DropDownOpening);

            /* Toolbar */

            _toolbarCompile = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_COMPILE,
                Resources.ToolbarCompile,
                Resources.Compile, UI_TOOLBAR_COMPILE_Click,
                true);
            _toolbarCompile.Enabled = false;
            _toolbarCompileSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_COMPILE_SELECT,
                UI_TOOLBAR_COMPILE_SELECT_Click);
            _toolbarCompileSelect.Enabled          = false;
            _toolbarCompileSelect.DropDownOpening +=
                new EventHandler(ToolbarCompileSelect_DropDownOpening);

            _toolbarRun = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_RUN,
                Resources.ToolbarRun,
                Resources.Run, UI_TOOLBAR_RUN_Click);

            if (disableCompilerUI)
            {
                _toolbarRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            _toolbarRun.Enabled = false;
            _toolbarRunSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_RUN_SELECT,
                UI_TOOLBAR_RUN_SELECT_Click);
            _toolbarRunSelect.Enabled          = false;
            _toolbarRunSelect.DropDownOpening +=
                new EventHandler(ToolbarRunSelect_DropDownOpening);

            _toolbarPin = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_PIN,
                Resources.ToolbarPinFile,
                Resources.Pin, UI_TOOLBAR_PIN_Click,
                true);
            _toolbarPin.Enabled = false;
            _toolbarPinSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_PIN_SELECT,
                UI_TOOLBAR_PIN_SELECT_Click);
            _toolbarPinSelect.Enabled = false;

            if (!disableCompilerUI)
            {
                _mainForm.MainToolbar.Items.Add(_toolbarCompile);
                _mainForm.MainToolbar.Items.Add(_toolbarCompileSelect);
            }

            _mainForm.MainToolbar.Items.Add(_toolbarRun);
            _mainForm.MainToolbar.Items.Add(_toolbarRunSelect);
            _mainForm.MainToolbar.Items.Add(_toolbarPin);
            _mainForm.MainToolbar.Items.Add(_toolbarPinSelect);

            #endregion

            _mainForm.ClientWindow.ActiveDocumentChanged +=
                new EventHandler(MainForm_ActiveDocumentChanged);

            _buildToolManager = BuildToolManager.GetInstance();
            _buildToolManager.LoadSettings();
            _buildToolManager.LoadTools();
            _buildToolManager.BuildTools.SortTools();
            _buildToolManager.LoadPinnedFiles();

            _mainForm.FormClosed +=
                new FormClosedEventHandler(MainForm_FormClosed);

            _applicationManager.FileSystemChange +=
                new MessageHandler(UpdatePinFileStatus);

            PluginManager.GetInstance().PluginPostActivate +=
                new MessageHandler(PostActivationHandler);
        }