OnStartUp() public static method

public static OnStartUp ( ) : void
return void
Beispiel #1
0
        /// <summary>
        /// Called on npp ready
        /// </summary>
        internal static bool DoNppReady()
        {
            try {
                // need to set some values in the yamuiThemeManager
                ThemeManager.OnStartUp();

                // code explorer
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.CodeExplorerVisible)
                {
                    CodeExplorer.Instance.Toggle();
                }

                // File explorer
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.FileExplorerVisible)
                {
                    FileExplorer.Instance.Toggle();
                }

                return(true);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Plugin startup");
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// Called on npp ready
        /// </summary>
        internal static bool DoNppReady()
        {
            try {
                // need to set some values in the yamuiThemeManager
                ThemeManager.OnStartUp();

                // if the UDL is not installed
                if (!Style.InstallUdl(true))
                {
                    Style.InstallUdl();
                }
                else
                {
                    // first use message?
                    if (Config.Instance.UserFirstUse)
                    {
                        UserCommunication.NotifyUnique("welcome", "<div>Dear user,<br><br>Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P I invite you to read the <b>Getting started</b> section of the home page by clicking <a href='go'>on this link right here</a>.<br><br></div><div align='right'>Enjoy!</div>", MessageImg.MsgInfo, "Information", "Hello and welcome aboard!", args => {
                            Appli.ToggleView();
                            UserCommunication.CloseUniqueNotif("welcome");
                            args.Handled = true;
                        });
                        Config.Instance.UserFirstUse = false;
                    }
                }

                // check if npp version is meeting current recommended version
                if (!string.IsNullOrEmpty(Npp.SoftwareVersion) && !Npp.SoftwareVersion.IsHigherOrEqualVersionThan(Config.RequiredNppVersion))
                {
                    if (!Config.Instance.NppOutdatedVersion)
                    {
                        UserCommunication.Notify("This version of 3P has been developed for Notepad++ " + Config.RequiredNppVersion + ", your version (" + Npp.SoftwareVersion + ") is outdated.<br><br>Using an outdated version, you might encounter bugs that would not occur otherwise.<br>Try to update your version of Notepad++ as soon as possible, or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the latest version of Notepad++ here</a>", MessageImg.MsgHighImportance, "Outdated version", "3P requirements are not met");
                        Config.Instance.NppOutdatedVersion = true;
                    }
                }
                else
                {
                    Config.Instance.NppOutdatedVersion = false;
                }

                // code explorer
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.CodeExplorerVisible)
                {
                    CodeExplorer.Instance.Toggle();
                }

                // File explorer
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Instance.Toggle(Npp.NppFileInfo.GetFullPathApi.TestAgainstListOfPatterns(Config.Instance.FilesPatternProgress));
                }
                else if (Config.Instance.FileExplorerVisible)
                {
                    FileExplorer.Instance.Toggle();
                }

                return(true);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Plugin startup");
            }
            return(false);
        }
Beispiel #3
0
        /// <summary>
        /// Called on npp ready
        /// </summary>
        internal static bool DoNppReady()
        {
            try {
                // need to set some values in the yamuiThemeManager
                ThemeManager.OnStartUp();

                // init an empty form, this gives us a Form to hook onto if we want to do stuff on the UI thread
                // from a back groundthread with BeginInvoke()
                // once this method is done, we are able to publish notifications
                UserCommunication.Init();

                // if the UDL is not installed
                if (!Style.InstallUdl(true))
                {
                    Style.InstallUdl();
                }
                else
                {
                    // first use message?
                    if (Config.Instance.UserFirstUse)
                    {
                        UserCommunication.NotifyUnique("welcome", "<div>Dear user,<br><br>Thank you for installing 3P, you are awesome!<br><br>If this is your first look at 3P I invite you to read the <b>Getting started</b> section of the home page by clicking <a href='go'>on this link right here</a>.<br><br></div><div align='right'>Enjoy!</div>", MessageImg.MsgInfo, "Information", "Hello and welcome aboard!", args => {
                            Appli.ToggleView();
                            UserCommunication.CloseUniqueNotif("welcome");
                            args.Handled = true;
                        });
                        Config.Instance.UserFirstUse = false;
                    }
                }

                // check Npp version, 3P requires version 6.8 or higher
                if (!String.IsNullOrEmpty(Npp.GetNppVersion) && !Npp.GetNppVersion.IsHigherVersionThan("6.7"))
                {
                    UserCommunication.Notify("Dear user,<br><br>Your version of notepad++ (" + Npp.GetNppVersion + ") is outdated.<br>3P <b>requires</b> the version <b>6.8</b> or above, <b>there are known issues with inferior versions</b>. Please upgrade to an up-to-date version of Notepad++ or use 3P at your own risks.<br><br><a href='https://notepad-plus-plus.org/download/'>Download the lastest version of Notepad++ here</a>", MessageImg.MsgError, "Outdated version", "3P requirements are not met");
                }

                // Check if an update has been done and start checking for new updates
                UpdateHandler.CheckForUpdateDone();
                UpdateHandler.StartCheckingForUpdate(); // async

                // Try to update the configuration from the distant shared folder
                ShareExportConf.StartCheckingForUpdates();

                // ReSharper disable once ObjectCreationAsStatement
                new ReccurentAction(User.Ping, 1000 * 60 * 120);

                // code explorer
                if (Config.Instance.CodeExplorerAutoHideOnNonProgressFile)
                {
                    CodeExplorer.Toggle(Abl.IsCurrentProgressFile);
                }
                else if (Config.Instance.CodeExplorerVisible)
                {
                    CodeExplorer.Toggle();
                }

                // File explorer
                if (Config.Instance.FileExplorerAutoHideOnNonProgressFile)
                {
                    FileExplorer.Toggle(Abl.IsCurrentProgressFile);
                }
                else if (Config.Instance.FileExplorerVisible)
                {
                    FileExplorer.Toggle();
                }

                return(true);
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Plugin startup");
            }
            return(false);
        }