public StartingContext(IContainer container, ProfileManager profileManager, ISplash splash)
        {
            _container = container;
            _splash = splash;
            _profileManager = profileManager;
            
            if (_profileManager.ProfileLoaded)
            {
                Pandora.Log.WriteEntry("Import startup initiated");
                LoadProfile(_profileManager.Profile.Name);
            }
            else
            {
                Pandora.Log.WriteEntry("Normal startup initiated");

                // Move on with normal startup
                Process proc = Pandora.ExistingInstance;
                if (proc != null) // Single instance check
                {
                    Pandora.Log.WriteError(null, "Double instance detected");
                    MessageBox.Show("You can't run two instances of Pandora's Box at the same time");
                    //  Issue 33:  	 Bring to front if already started - Tarion
                    ProcessExtension.BringToFront(proc);
                }
                else
                {
                    Pandora.Log.WriteEntry("Double instances check passed");
                    DoProfile();
                }
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                Log.WriteEntry("Starting");

                var builder = new LightCoreBuilder();
                Container = builder.BuildContainer();
                _splash   = Container.Resolve <ISplash>();

                _splash.Show();
                AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

                // Delete any temp files created during compilation of profile IO
                var temp = Path.Combine(Folder, "temp.dll");

                if (File.Exists(temp))
                {
                    _splash.SetStatusText("Deleting temporary files");
                    File.Delete(temp);
                }

                _profileManager = Container.Resolve <ProfileManager>();
                // Issue 28:     Refactoring Pandora.cs - Tarion
                // Move any profiles resulting from previous versions
                _profileManager.MoveOldProfiles();
                //ProfileManager.Instance.MoveOldProfiles();
                // End Issue 28:

                if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".pbp")
                {
                    _profileManager.ImportProfile(args[0]);
                }

                var context = Container.Resolve <StartingContext>();
                Application.Run(context);

                // the following code is replaced, logic moved into StartingContext

                /*
                 * if (profileManager.ProfileLoaded)
                 * {
                 *      Pandora.Log.WriteEntry("Import startup initiated");
                 *      m_Context = new StartingContext(profileManager.Profile.Name);
                 *      Application.Run(m_Context);
                 * }
                 * else
                 * {
                 *      Pandora.Log.WriteEntry("Normal startup initiated");
                 *
                 *      // Move on with normal startup
                 *      Process proc = Pandora.ExistingInstance;
                 *      if (proc != null) // Single instance check
                 *      {
                 *              Pandora.Log.WriteError(null, "Double instance detected");
                 *              System.Windows.Forms.MessageBox.Show("You can't run two instances of Pandora's Box at the same time");
                 *              //  Issue 33:    Bring to front if already started - Tarion
                 *              ProcessExtension.BringToFront(proc);
                 *      }
                 *      else
                 *      {
                 *              Pandora.Log.WriteEntry("Double instances check passed");
                 *
                 *              m_Context = new StartingContext();
                 *              Application.Run(m_Context);
                 *      }
                 * }
                 */
            }
            catch (Exception err)
            {
                Clipboard.SetDataObject(err.ToString(), true);
                MessageBox.Show(
                    "An error occurred. The error text has been placed on your clipboard, use CTRL+V to paste it in a text file.");
                // Issue 6:      Improve error management - Tarion
                Environment.Exit(1);
                // End Issue 6:
            }
        }
Exemple #3
0
		public OptionsForm(ProfileManager profileManager)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			Pandora.Localization.LocalizeControl( this );
            _profileManager = profileManager;
		}
Exemple #4
0
		static void Main(string[] args)
		{
			try
			{
				Log.WriteEntry("Starting");

                LightCoreBuilder builder = new LightCoreBuilder();
                _container = builder.BuildContainer();
                _splash = _container.Resolve<ISplash>();

                _splash.Show();
				AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

				// Delete any temp files created during compilation of profile IO
				string temp = Path.Combine(Pandora.Folder, "temp.dll");

				if (File.Exists(temp))
				{
                    _splash.SetStatusText("Deleting temporary files");
					File.Delete(temp);
				}


                _profileManager = _container.Resolve<ProfileManager>();
				// Issue 28:  	 Refactoring Pandora.cs - Tarion
				// Move any profiles resulting from previous versions
                _profileManager.MoveOldProfiles();
				//ProfileManager.Instance.MoveOldProfiles();
				// End Issue 28:

				if (args.Length == 1 && File.Exists(args[0]) && Path.GetExtension(args[0]).ToLower() == ".pbp")
				{
                    _profileManager.ImportProfile(args[0]);
				}

                StartingContext context = _container.Resolve<StartingContext>();
                Application.Run(context);

                // the following code is replaced, logic moved into StartingContext
                /*
                if (profileManager.ProfileLoaded)
				{
					Pandora.Log.WriteEntry("Import startup initiated");
                    m_Context = new StartingContext(profileManager.Profile.Name);
					Application.Run(m_Context);
				}
				else
				{
					Pandora.Log.WriteEntry("Normal startup initiated");

					// Move on with normal startup
					Process proc = Pandora.ExistingInstance;
					if (proc != null) // Single instance check
					{
						Pandora.Log.WriteError(null, "Double instance detected");
						System.Windows.Forms.MessageBox.Show("You can't run two instances of Pandora's Box at the same time");
						//  Issue 33:  	 Bring to front if already started - Tarion
						ProcessExtension.BringToFront(proc);
					}
					else
					{
						Pandora.Log.WriteEntry("Double instances check passed");

						m_Context = new StartingContext();
						Application.Run(m_Context);
					}
				}
                */
			}
			catch (Exception err)
			{
				Clipboard.SetDataObject(err.ToString(), true);
				MessageBox.Show("An error occurred. The error text has been placed on your clipboard, use CTRL+V to paste it in a text file.");
				// Issue 6:  	 Improve error management - Tarion
				Environment.Exit(1);
				// End Issue 6:
			}
		}
Exemple #5
0
		public Box(ProfileManager profileManager, ISplash splash)
		{
            _profileManager = profileManager;
            _splash = splash;

            _splash.SetStatusText("Loading appearance");
			InitializeComponent();

            _splash.SetStatusText("Initializing maps and artwork");
			Map.MulManager = _profileManager.Profile.MulManager;
			Art.MulFileManager = _profileManager.Profile.MulManager;
			
			Pandora.Map = Map;
			Pandora.Art = Art;
			Pandora.Prop = ucPropManager;

			if ( Pandora.Hues != null )
			{
                _splash.SetStatusText("Reading hues");
				m_HuePicker = new HuePicker();
			}

            _splash.SetStatusText("Restoring options");
			ApplyOptions();

            _splash.SetStatusText("Building travel destinations");
			InitPages();

            // Update Title when online change!
            Pandora.BoxConnection.OnlineChanged += new EventHandler(delegate(Object sender, EventArgs e)
                {
                    this.Text = string.Format(Pandora.Localization.TextProvider["Misc.BoxTitle"], _profileManager.Profile.Name, Pandora.BoxConnection.Connected ? Pandora.Localization.TextProvider["Misc.Online"] : Pandora.Localization.TextProvider["Misc.Offline"]);
                });
		}