예제 #1
0
        // called when the compilation ended
        private void OnCompilationEnd(DeploymentHandler proDeployment)
        {
            Task.Factory.StartNew(() => {
                this.SafeInvoke(page => {
                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }
                    ResetScreen();
                    UpdateReport(_proDeployment.FormatDeploymentReport());
                    btReport.Visible = true;

                    // notify the user
                    if (!_proDeployment.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Click here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }
                });
            });
        }
예제 #2
0
        // called when the compilation ended
        private void OnCompilationEnd()
        {
            Task.Factory.StartNew(() => {
                _filesToDeployPerStep.Add(0, _currentCompil.TransferedFiles);

                // if it went ok, move on to deploying files
                if (_currentCompil.DeploymentDone)
                {
                    // hook
                    ExecuteDeploymentHook();

                    _currentStep++; // move on to step 1

                    // Update the progress bar
                    UpdateProgressBar();

                    // transfer rules found for this step?
                    while (_proEnv.Deployer.DeployTransferRules.Exists(rule => rule.Step == _currentStep))
                    {
                        _filesToDeployPerStep.Add(_currentStep,
                                                  _proEnv.Deployer.DeployFilesForStep(_currentStep, new List <string> {
                            _currentStep == 1 ? _currentProfile.SourceDirectory : _proEnv.BaseCompilationPath
                        }, _currentProfile.ExploreRecursively ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, f => _deploymentPercentage = f));

                        // hook
                        ExecuteDeploymentHook();

                        _currentStep++;
                    }
                }

                this.SafeInvoke(page => {
                    // Update the progress bar
                    progressBar.Progress = 100;
                    progressBar.Text     = @"Generating the report, please wait...";

                    // get rid of the timer
                    if (_progressTimer != null)
                    {
                        _progressTimer.Stop();
                        _progressTimer.Dispose();
                        _progressTimer = null;
                    }

                    // create the report and display it
                    BuildReport();

                    ResetScreen();

                    // notify the user
                    if (!_currentCompil.HasBeenCancelled)
                    {
                        UserCommunication.NotifyUnique("ReportAvailable", "The requested deployment is over,<br>please check the generated report to see the result :<br><br><a href= '#'>Cick here to see the report</a>", MessageImg.MsgInfo, "Deploy your application", "Report available", args => {
                            Appli.GoToPage(PageNames.MassCompiler);
                            UserCommunication.CloseUniqueNotif("ReportAvailable");
                        }, Appli.IsFocused() ? 10 : 0);
                    }

                    btReport.Visible = true;
                });
            });
        }
예제 #3
0
파일: Plug.cs 프로젝트: devjerome/3P
        /// <summary>
        /// Called when the user presses a key
        /// </summary>
        // ReSharper disable once RedundantAssignment
        private static bool KeyDownHandler(Keys key, KeyModifiers keyModifiers)
        {
            // if set to true, the keyinput is completly intercepted, otherwise npp sill does its stuff
            bool handled = false;

            MenuItem menuItem = null;

            try {
                // Since it's a keydown message, we can receive this a lot if the user let a button pressed
                var isSpamming = Utils.IsSpamming(key.ToString(), 100, true);

                //HACK:
                // Ok so... when we open a form in notepad++, we can't use the overrides PreviewKeyDown / KeyDown
                // like we normally can, for some reasons, they don't react to certain keys (like enter!)
                // It only works "almost normally" if we ShowDialog() the form?! Wtf right?
                // So i gave up and handle things here!
                if (Appli.IsFocused())
                {
                    handled = Appli.Form.HandleKeyPressed(key, keyModifiers);
                }
                else
                {
                    // same shit for the YamuiMenu
                    var curMenu = (Control.FromHandle(WinApi.GetForegroundWindow()));
                    var menu    = curMenu as YamuiMenu;
                    if (menu != null)
                    {
                        menu.OnKeyDown(key);
                    }
                }

                // check if the user triggered a 3P function defined in the AppliMenu
                menuItem = TriggeredMenuItem(AppliMenu.Instance.ShortcutableItemList, isSpamming, key, keyModifiers, ref handled);
                if (handled)
                {
                    return(true);
                }

                // The following is specific to 3P so don't go further if we are not on a valid file
                if (!IsCurrentFileProgress)
                {
                    return(false);
                }

                // Close interfacePopups
                if (key == Keys.PageDown || key == Keys.PageUp || key == Keys.Next || key == Keys.Prior)
                {
                    ClosePopups();
                }

                // Autocompletion
                if (AutoComplete.IsVisible)
                {
                    if (key == Keys.Up || key == Keys.Down || key == Keys.Tab || key == Keys.Return || key == Keys.Escape)
                    {
                        handled = AutoComplete.OnKeyDown(key);
                    }
                    else
                    {
                        if ((key == Keys.Right || key == Keys.Left) && keyModifiers.IsAlt)
                        {
                            handled = AutoComplete.OnKeyDown(key);
                        }
                    }
                }
                else
                {
                    // snippet ?
                    if (key == Keys.Tab || key == Keys.Escape || key == Keys.Return)
                    {
                        if (!keyModifiers.IsCtrl && !keyModifiers.IsAlt && !keyModifiers.IsShift)
                        {
                            if (!Snippets.InsertionActive)
                            {
                                //no snippet insertion in progress
                                if (key == Keys.Tab)
                                {
                                    if (Snippets.TriggerCodeSnippetInsertion())
                                    {
                                        handled = true;
                                    }
                                }
                            }
                            else
                            {
                                //there is a snippet insertion in progress
                                if (key == Keys.Tab)
                                {
                                    if (Snippets.NavigateToNextParam())
                                    {
                                        handled = true;
                                    }
                                }
                                else if (key == Keys.Escape || key == Keys.Return)
                                {
                                    Snippets.FinalizeCurrent();
                                    if (key == Keys.Return)
                                    {
                                        handled = true;
                                    }
                                }
                            }
                        }
                    }
                }

                // next tooltip
                if (keyModifiers.IsCtrl && InfoToolTip.IsVisible && (key == Keys.Up || key == Keys.Down))
                {
                    if (key == Keys.Up)
                    {
                        InfoToolTip.IndexToShow--;
                    }
                    else
                    {
                        InfoToolTip.IndexToShow++;
                    }
                    InfoToolTip.TryToShowIndex();
                    handled = true;
                }
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Occured in : " + (menuItem == null ? (new ShortcutKey(keyModifiers.IsCtrl, keyModifiers.IsAlt, keyModifiers.IsShift, key)).ToString() : menuItem.ItemId));
            }

            return(handled);
        }