예제 #1
0
        /// ------------------------------------------------------------------------------------
        static void HandleProjectWindowClosed(object sender, EventArgs e)
        {
            try
            {
                _projectContext.SendReceiver.CheckPointWithDialog("Storing History Of Your Work");
            }
            catch (Exception error)
            {
                Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error,"There was a problem backing up your work to the SendReceive repository on this computer.");
            }

            _projectContext.Dispose();
            _projectContext = null;

            if (((Shell)sender).UserWantsToOpenADifferentProject)
            {
                Application.Idle += ChooseAnotherProject;
            }
            else if (((Shell)sender).UserWantsToOpeReopenProject)
            {
                Application.Idle +=new EventHandler(ReopenProject);
            }
            else if (((Shell)sender).QuitForVersionUpdate)
            {
                Application.Exit();
            }
            else
            {
                Application.Exit();
            }
        }
예제 #2
0
        /// ------------------------------------------------------------------------------------
        private static bool OpenProjectWindow(string projectPath)
        {
            Debug.Assert(_projectContext == null);

            CheckAndWarnAboutVirtualStore();

            try
            {
                //NB: initially, you could have multiple blooms, if they were different projects.
                //however, then we switched to the embedded http image server, which can't share
                //a port. So we could fix that (get different ports), but for now, I'm just going
                //to lock it down to a single bloom
            /*					if (!GrabTokenForThisProject(projectPath))
                    {
                        return false;
                    }
                */
                _projectContext = _applicationContainer.CreateProjectContext(projectPath);
                _projectContext.ProjectWindow.Closed += HandleProjectWindowClosed;
                _projectContext.ProjectWindow.Activated += HandleProjectWindowActivated;

                _projectContext.ProjectWindow.Show();

                if(_splashForm!=null)
                    _splashForm.StayAboveThisWindow(_projectContext.ProjectWindow);

                return true;
            }
            catch (Exception e)
            {
                HandleErrorOpeningProjectWindow(e, projectPath);
            }

            return false;
        }
예제 #3
0
        /// ------------------------------------------------------------------------------------
        private static void HandleErrorOpeningProjectWindow(Exception error, string projectPath)
        {
            if (_projectContext != null)
            {
                if (_projectContext.ProjectWindow != null)
                {
                    _projectContext.ProjectWindow.Closed -= HandleProjectWindowClosed;
                    _projectContext.ProjectWindow.Close();
                }

                _projectContext.Dispose();
                _projectContext = null;
            }

            Palaso.Reporting.ErrorReport.NotifyUserOfProblem(
                new Palaso.Reporting.ShowAlwaysPolicy(), error,
                "{0} had a problem loading the {1} project. Please report this problem to the developers by clicking 'Details' below.",
                Application.ProductName, Path.GetFileNameWithoutExtension(projectPath));
        }