Ejemplo n.º 1
0
        private static void RM_EngineStopped(object sender, EventArgs e)
        {
            NumberOfStartedEngines--;

            //Detach the debugger from the repository
            RepositoryUI RUI = ListOfRepositoryUI.FirstOrDefault(x => x.RepositoryId.Equals(((Repository)sender).RepositoryId));

            if (RUI != null)
            {
                RUI.StopDebugger();
            }

            if (NumberOfStartedEngines == 0)
            {
                StoppingDialog.AllowClosing = true;
                if (StoppingDialog.InvokeRequired)
                {
                    StoppingDialog.Invoke(new MethodInvoker(delegate { StoppingDialog.Close(); }));
                }
                else
                {
                    StoppingDialog.Close();
                }
            }
            if (MainUploadDownloadCountChanged != null)
            {
                MainUploadDownloadCountChanged(sender, null);
            }
        }
Ejemplo n.º 2
0
        private static void RM_EngineStarted(object sender, EventArgs e)
        {
            NumberOfStartedEngines++;

            //Retrieve the UI of the Repository
            RepositoryUI RUI = ListOfRepositoryUI.FirstOrDefault(x => x.RepositoryId.Equals(((Repository)sender).RepositoryId));

            if (RUI != null)
            {
                RUI.StartDebugger();
            }
            if (MainUploadDownloadCountChanged != null)
            {
                MainUploadDownloadCountChanged(sender, null);
            }
        }
Ejemplo n.º 3
0
        private static bool InitRepository(int RepositoryId, bool IsFirstInit)
        {
            RepositoryUI RepUI = new RepositoryUI();

            if (!RepUI.InitRepository(RepositoryId))
            {
                return(false);
            }

            //Register events
            RepUI.RM.IconAnimationStart  += RM_IconAnimationStart;
            RepUI.RM.IconAnimationStop   += RM_IconAnimationStop;
            RepUI.RM.EngineStarted       += RM_EngineStarted;
            RepUI.RM.EngineStopped       += RM_EngineStopped;
            RepUI.RM.NotifyUser          += RM_NotifyUser;
            RepUI.RM.RepositoryDeleted   += RM_RepositoryDeleted;
            RepUI.RM.ProxyError          += RM_NotifyUser;
            RepUI.RM.AuthenticationError += RM_NotifyUser;
            RepUI.RM.EditProperties      += RM_EditProperties;
            RepUI.RM.RepositoryUploadDownloadCountChanged += RM_UploadDownloadCountChanged;

            var EngineInitSuccess = RepUI.InitEngine(_Connectors);

            if (!EngineInitSuccess && IsFirstInit)
            {
                //Exécuter ce code seulement si l'appel est fait à la création d'un nouveau repository
                //Dans le cas contraire , continuer mais ne pas lancer RepUI.StartEngine();
                logger.Debug("Init repository failed. Id : " + RepositoryId);
                return(false);
            }

            ListOfRepositoryUI.Add(RepUI);

            if (EngineInitSuccess)
            {
                RepUI.StartEngine();
            }
            return(EngineInitSuccess);
        }