예제 #1
0
 private void mnuToolsUpdate_Click(object sender, EventArgs e)
 {
     // Only a single instance of the updater can be open, so either find the current instance and focus on it, or create a new one.
     if (_frmUpdate == null)
     {
         _frmUpdate = new frmUpdate();
         _frmUpdate.Show();
     }
     else
     {
         _frmUpdate.Focus();
     }
 }
예제 #2
0
 private void CheckForUpdate(object sender, EventArgs e)
 {
     if (Utils.GitUpdateAvailable() > 0)
     {
         if (GlobalOptions.AutomaticUpdate)
         {
             if (_frmUpdate == null)
             {
                 _frmUpdate             = new frmUpdate();
                 _frmUpdate.FormClosed += ResetFrmUpdate;
                 _frmUpdate.SilentMode  = true;
             }
         }
         this.Text = string.Format("Chummer 5a - Version " + _strCurrentVersion + " - Update {0} now available!", Utils.CachedGitVersion);
     }
 }
예제 #3
0
 private void mnuToolsUpdate_Click(object sender, EventArgs e)
 {
     // Only a single instance of the updater can be open, so either find the current instance and focus on it, or create a new one.
     if (_frmUpdate == null)
     {
         _frmUpdate             = new frmUpdate();
         _frmUpdate.FormClosed += ResetFrmUpdate;
         _frmUpdate.Show();
     }
     // Silent updater is running, so make it visible
     else if (_frmUpdate.SilentMode)
     {
         _frmUpdate.SilentMode = false;
         _frmUpdate.Show();
     }
     else
     {
         _frmUpdate.Focus();
     }
 }
예제 #4
0
        public frmMain()
        {
            InitializeComponent();
            Version version           = Assembly.GetExecutingAssembly().GetName().Version;
            string  strCurrentVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);

            this.Text = string.Format("Chummer 5a - Version " + strCurrentVersion);

#if DEBUG
            Text += " DEBUG BUILD";
#endif

            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            /** Dashboard **/
            //this.toolsMenu.DropDownItems.Add("GM Dashboard").Click += this.dashboardToolStripMenuItem_Click;
            /** End Dashboard **/

            // If Automatic Updates are enabled, check for updates immediately.
            if (GlobalOptions.Instance.AutomaticUpdate)
            {
                frmUpdate frmAutoUpdate = new frmUpdate();
                frmAutoUpdate.SilentMode = true;
                frmAutoUpdate.Visible    = false;
                frmAutoUpdate.ShowDialog(this);
            }
            else
            {
#if RELEASE
                frmUpdate frmAutoUpdate = new frmUpdate();
                frmAutoUpdate.GetChummerVersion();
                Version verCurrentVersion = new Version(strCurrentVersion);
                Version verLatestVersion  = new Version(frmAutoUpdate.LatestVersion);

                var result = verCurrentVersion.CompareTo(verLatestVersion);
                if (result != 0)
                {
                    this.Text += String.Format(" - Update {0} now available!", verLatestVersion);
                }
#endif
            }

            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            // Delete the old executable if it exists (created by the update process).
            if (File.Exists("Chummer.exe.old"))
            {
                try
                {
                    File.Delete("Chummer.exe.old");
                }
                catch
                {
                }
            }

            // Populate the MRU list.
            PopulateMRU();

            // Retrieve the arguments passed to the application. If more than 1 is passed, we're being given the name of a file to open.
            string[] strArgs = Environment.GetCommandLineArgs();
            if (strArgs.GetUpperBound(0) > 0)
            {
                if (strArgs[1] != "/debug")
                {
                    LoadCharacter(strArgs[1]);
                }
                if (strArgs.Length > 2)
                {
                    if (strArgs[2] == "/test")
                    {
                        frmTest frmTestData = new frmTest();
                        frmTestData.Show();
                    }
                }
            }

            GlobalOptions.Instance.MainForm = this;

            // Set the Tag for each ToolStrip item so it can be translated.
            foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType <ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            // ToolStrip Items.
            foreach (ToolStrip objToolStrip in this.Controls.OfType <ToolStrip>())
            {
                foreach (ToolStripButton objButton in objToolStrip.Items.OfType <ToolStripButton>())
                {
                    if (objButton.Tag != null)
                    {
                        objButton.Text = LanguageManager.Instance.GetString(objButton.Tag.ToString());
                    }
                }
            }

            // Attempt to cache the XML files that are used the most.
            try
            {
                Timekeeper.Start("cache_load");
                XmlManager.Instance.Load("armor.xml");
                XmlManager.Instance.Load("bioware.xml");
                XmlManager.Instance.Load("books.xml");
                XmlManager.Instance.Load("cyberware.xml");
                XmlManager.Instance.Load("gear.xml");
                XmlManager.Instance.Load("lifestyles.xml");
                XmlManager.Instance.Load("metatypes.xml");
                XmlManager.Instance.Load("qualities.xml");
                XmlManager.Instance.Load("ranges.xml");
                XmlManager.Instance.Load("skills.xml");
                XmlManager.Instance.Load("vehicles.xml");
                XmlManager.Instance.Load("weapons.xml");
                Timekeeper.Finish("cache_load");
            }
            catch
            {
            }
        }
예제 #5
0
        public frmMain()
        {
            InitializeComponent();
            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            /** Dashboard **/
            //this.toolsMenu.DropDownItems.Add("GM Dashboard").Click += this.dashboardToolStripMenuItem_Click;
            /** End Dashboard **/

            // If Automatic Updates are enabled, check for updates immediately.
            if (GlobalOptions.Instance.AutomaticUpdate)
            {
                frmUpdate frmAutoUpdate = new frmUpdate();
                frmAutoUpdate.SilentMode = true;
                frmAutoUpdate.Visible    = false;
                frmAutoUpdate.ShowDialog(this);
            }

            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            // Delete the old executable if it exists (created by the update process).
            if (File.Exists("Chummer.exe.old"))
            {
                try
                {
                    File.Delete("Chummer.exe.old");
                }
                catch
                {
                }
            }

            // Populate the MRU list.
            PopulateMRU();

            // Retrieve the arguments passed to the application. If more than 1 is passed, we're being given the name of a file to open.
            string[] strArgs = Environment.GetCommandLineArgs();
            if (strArgs.GetUpperBound(0) > 0)
            {
                if (strArgs[1] != "/debug")
                {
                    LoadCharacter(strArgs[1]);
                }
                if (strArgs.Length > 2)
                {
                    if (strArgs[2] == "/test")
                    {
                        frmTest frmTestData = new frmTest();
                        frmTestData.Show();
                    }
                }
            }

            GlobalOptions.Instance.MainForm = this;

            // Set the Tag for each ToolStrip item so it can be translated.
            foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType <ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            // ToolStrip Items.
            foreach (ToolStrip objToolStrip in this.Controls.OfType <ToolStrip>())
            {
                foreach (ToolStripButton objButton in objToolStrip.Items.OfType <ToolStripButton>())
                {
                    if (objButton.Tag != null)
                    {
                        objButton.Text = LanguageManager.Instance.GetString(objButton.Tag.ToString());
                    }
                }
            }

            // Attempt to cache the XML files that are used the most.
            try
            {
                XmlManager.Instance.Load("armor.xml");
                XmlManager.Instance.Load("bioware.xml");
                XmlManager.Instance.Load("books.xml");
                XmlManager.Instance.Load("cyberware.xml");
                XmlManager.Instance.Load("gear.xml");
                XmlManager.Instance.Load("lifestyles.xml");
                XmlManager.Instance.Load("metatypes.xml");
                XmlManager.Instance.Load("qualities.xml");
                XmlManager.Instance.Load("ranges.xml");
                XmlManager.Instance.Load("skills.xml");
                XmlManager.Instance.Load("vehicles.xml");
                XmlManager.Instance.Load("weapons.xml");
            }
            catch
            {
            }
        }
예제 #6
0
        private void mnuToolsUpdate_Click(object sender, EventArgs e)
        {
            frmUpdate frmUpdateApp = new frmUpdate();

            frmUpdateApp.ShowDialog(this);
        }
예제 #7
0
파일: frmMain.cs 프로젝트: AMDX9/chummer5a
        public frmMain()
		{
			InitializeComponent();
			Version version = Assembly.GetExecutingAssembly().GetName().Version;
			string strCurrentVersion = string.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Build);

			this.Text = string.Format("Chummer 5a - Version " + strCurrentVersion);

#if DEBUG
	        Text += " DEBUG BUILD";
#endif

			LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            /** Dashboard **/
            //this.toolsMenu.DropDownItems.Add("GM Dashboard").Click += this.dashboardToolStripMenuItem_Click;
            /** End Dashboard **/

			// If Automatic Updates are enabled, check for updates immediately.
			if (GlobalOptions.Instance.AutomaticUpdate)
			{
				frmUpdate frmAutoUpdate = new frmUpdate();
                frmAutoUpdate.SilentMode = true;
                frmAutoUpdate.Visible = false;
                frmAutoUpdate.ShowDialog(this);
			}
			else
			{
#if RELEASE
				frmUpdate frmAutoUpdate = new frmUpdate();
				frmAutoUpdate.GetChummerVersion();
				Version verCurrentVersion = new Version(strCurrentVersion);
				Version verLatestVersion = new Version(frmAutoUpdate.LatestVersion);

				var result = verCurrentVersion.CompareTo(verLatestVersion);
				if (result != 0)
					this.Text += String.Format(" - Update {0} now available!",verLatestVersion);
#endif
			}

			GlobalOptions.Instance.MRUChanged += PopulateMRU;

			// Delete the old executable if it exists (created by the update process).
			if (File.Exists("Chummer.exe.old"))
			{
				try
				{
					File.Delete("Chummer.exe.old");
				}
				catch
				{
				}
			}

			// Populate the MRU list.
			PopulateMRU();

			// Retrieve the arguments passed to the application. If more than 1 is passed, we're being given the name of a file to open.
			string[] strArgs = Environment.GetCommandLineArgs();
			if (strArgs.GetUpperBound(0) > 0)
			{
				if (strArgs[1] != "/debug")
					LoadCharacter(strArgs[1]);
				if (strArgs.Length > 2)
				{
					if (strArgs[2] == "/test")
					{
						frmTest frmTestData = new frmTest();
						frmTestData.Show();
					}
				}
			}

			GlobalOptions.Instance.MainForm = this;

			// Set the Tag for each ToolStrip item so it can be translated.
			foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType<ToolStripMenuItem>())
			{
				if (objItem.Tag != null)
				{
					objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
				}
			}

			// ToolStrip Items.
			foreach (ToolStrip objToolStrip in this.Controls.OfType<ToolStrip>())
			{
				foreach (ToolStripButton objButton in objToolStrip.Items.OfType<ToolStripButton>())
				{
					if (objButton.Tag != null)
						objButton.Text = LanguageManager.Instance.GetString(objButton.Tag.ToString());
				}
			}

			// Attempt to cache the XML files that are used the most.
			try
			{
				Timekeeper.Start("cache_load");
				XmlManager.Instance.Load("armor.xml");
				XmlManager.Instance.Load("bioware.xml");
				XmlManager.Instance.Load("books.xml");
				XmlManager.Instance.Load("cyberware.xml");
				XmlManager.Instance.Load("gear.xml");
				XmlManager.Instance.Load("lifestyles.xml");
				XmlManager.Instance.Load("metatypes.xml");
				XmlManager.Instance.Load("qualities.xml");
				XmlManager.Instance.Load("ranges.xml");
				XmlManager.Instance.Load("skills.xml");
				XmlManager.Instance.Load("vehicles.xml");
				XmlManager.Instance.Load("weapons.xml");
				Timekeeper.Finish("cache_load");
			}
			catch
			{
			}
		}
예제 #8
0
파일: frmMain.cs 프로젝트: AMDX9/chummer5a
		private void mnuToolsUpdate_Click(object sender, EventArgs e)
		{
			// Only a single instance of the updater can be open, so either find the current instance and focus on it, or create a new one.
			if (_frmUpdate == null)
			{
				frmUpdate frmUpdate = new frmUpdate();
				_frmUpdate = frmUpdate;
				_frmUpdate.Show();
			}
			else
			{
				_frmUpdate.Focus();
			}
		}
예제 #9
0
 private void mnuToolsUpdate_Click(object sender, EventArgs e)
 {
     frmUpdate frmUpdateApp = new frmUpdate();
     frmUpdateApp.ShowDialog(this);
 }
예제 #10
0
 private void ResetFrmUpdate(object sender, EventArgs e)
 {
     _frmUpdate = null;
 }
예제 #11
0
        public frmMain()
        {
            InitializeComponent();
            Version version           = Assembly.GetExecutingAssembly().GetName().Version;
            string  strCurrentVersion = $"{version.Major}.{version.Minor}.{version.Build}";

            Text = string.Format("Chummer 5a - Version " + strCurrentVersion);

#if DEBUG
            Text += " DEBUG BUILD";
#endif

            LanguageManager.Load(GlobalOptions.Language, this);

            /** Dashboard **/
            //this.toolsMenu.DropDownItems.Add("GM Dashboard").Click += this.dashboardToolStripMenuItem_Click;
            /** End Dashboard **/

            // If Automatic Updates are enabled, check for updates immediately.

#if RELEASE
            if (Utils.GitUpdateAvailable() > 0)
            {
                if (GlobalOptions.AutomaticUpdate)
                {
                    frmUpdate frmAutoUpdate = new frmUpdate();
                    frmAutoUpdate.SilentMode = true;
                    frmAutoUpdate.Visible    = false;
                    frmAutoUpdate.ShowDialog(this);
                }
                else
                {
                    this.Text += String.Format(" - Update {0} now available!", Utils.GitVersion());
                }
            }
#endif

            GlobalOptions.MRUChanged += PopulateMRU;

            // Delete the old executable if it exists (created by the update process).
            foreach (string strLoopOldFilePath in Directory.GetFiles(Application.StartupPath, "*.old"))
            {
                if (File.Exists(strLoopOldFilePath))
                {
                    File.Delete(strLoopOldFilePath);
                }
            }

            // Populate the MRU list.
            PopulateMRU();

            GlobalOptions.MainForm = this;

            // Set the Tag for each ToolStrip item so it can be translated.
            foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType <ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.GetString(objItem.Tag.ToString());
                }
            }

            // ToolStrip Items.
            foreach (ToolStrip objToolStrip in Controls.OfType <ToolStrip>())
            {
                foreach (ToolStripButton objButton in objToolStrip.Items.OfType <ToolStripButton>())
                {
                    if (objButton.Tag != null)
                    {
                        objButton.Text = LanguageManager.GetString(objButton.Tag.ToString());
                    }
                }
            }

            // Attempt to cache all XML files that are used the most.
            Timekeeper.Start("cache_load");
            XmlManager.Load("armor.xml");
            XmlManager.Load("bioware.xml");
            XmlManager.Load("books.xml");
            XmlManager.Load("complexforms.xml");
            XmlManager.Load("contacts.xml");
            XmlManager.Load("critters.xml");
            XmlManager.Load("critterpowers.xml");
            XmlManager.Load("cyberware.xml");
            // XmlManager.Load("drugcomponents.xml"); TODO: Re-enable when Custom Drugs branch is merged
            XmlManager.Load("echoes.xml");
            XmlManager.Load("gameplayoptions.xml");
            XmlManager.Load("gear.xml");
            XmlManager.Load("improvements.xml");
            XmlManager.Load("licenses.xml");
            XmlManager.Load("lifemodules.xml");
            XmlManager.Load("lifestyles.xml");
            XmlManager.Load("martialarts.xml");
            XmlManager.Load("mentors.xml");
            XmlManager.Load("metamagic.xml");
            XmlManager.Load("metatypes.xml");
            XmlManager.Load("options.xml");
            XmlManager.Load("packs.xml");
            XmlManager.Load("powers.xml");
            XmlManager.Load("priorities.xml");
            XmlManager.Load("programs.xml");
            XmlManager.Load("qualities.xml");
            XmlManager.Load("ranges.xml");
            XmlManager.Load("skills.xml");
            XmlManager.Load("spells.xml");
            XmlManager.Load("spiritpowers.xml");
            XmlManager.Load("traditions.xml");
            XmlManager.Load("vehicles.xml");
            XmlManager.Load("weapons.xml");
            Timekeeper.Finish("cache_load");

            frmCharacterRoster frmCharacter = new frmCharacterRoster();
            frmCharacter.MdiParent = this;

            // Retrieve the arguments passed to the application. If more than 1 is passed, we're being given the name of a file to open.
            string[] strArgs = Environment.GetCommandLineArgs();
            string   strLoop = string.Empty;
            for (int i = 1; i < strArgs.Length; ++i)
            {
                strLoop = strArgs[i];
                if (strLoop == "/test")
                {
                    frmTest frmTestData = new frmTest();
                    frmTestData.Show();
                }
                else if (!strLoop.StartsWith('/'))
                {
                    LoadCharacter(strLoop);
                }
            }

            frmCharacter.WindowState = FormWindowState.Maximized;
            frmCharacter.Show();
        }
예제 #12
0
        public frmMain()
        {
            InitializeComponent();
            LanguageManager.Instance.Load(GlobalOptions.Instance.Language, this);

            /** Dashboard **/
            //this.toolsMenu.DropDownItems.Add("GM Dashboard").Click += this.dashboardToolStripMenuItem_Click;
            /** End Dashboard **/

            // If Automatic Updates are enabled, check for updates immediately.
            if (GlobalOptions.Instance.AutomaticUpdate)
            {
                frmUpdate frmAutoUpdate = new frmUpdate();
                frmAutoUpdate.SilentMode = true;
                frmAutoUpdate.Visible = false;
                frmAutoUpdate.ShowDialog(this);
            }

            GlobalOptions.Instance.MRUChanged += PopulateMRU;

            // Delete the old executable if it exists (created by the update process).
            if (File.Exists("Chummer.exe.old"))
            {
                try
                {
                    File.Delete("Chummer.exe.old");
                }
                catch
                {
                }
            }

            // Populate the MRU list.
            PopulateMRU();

            // Retrieve the arguments passed to the application. If more than 1 is passed, we're being given the name of a file to open.
            string[] strArgs = Environment.GetCommandLineArgs();
            if (strArgs.GetUpperBound(0) > 0)
            {
                if (strArgs[1] != "/debug")
                    LoadCharacter(strArgs[1]);
                if (strArgs.Length > 2)
                {
                    if (strArgs[2] == "/test")
                    {
                        frmTest frmTestData = new frmTest();
                        frmTestData.Show();
                    }
                }
            }

            GlobalOptions.Instance.MainForm = this;

            // Set the Tag for each ToolStrip item so it can be translated.
            foreach (ToolStripMenuItem objItem in menuStrip.Items.OfType<ToolStripMenuItem>())
            {
                if (objItem.Tag != null)
                {
                    objItem.Text = LanguageManager.Instance.GetString(objItem.Tag.ToString());
                }
            }

            // ToolStrip Items.
            foreach (ToolStrip objToolStrip in this.Controls.OfType<ToolStrip>())
            {
                foreach (ToolStripButton objButton in objToolStrip.Items.OfType<ToolStripButton>())
                {
                    if (objButton.Tag != null)
                        objButton.Text = LanguageManager.Instance.GetString(objButton.Tag.ToString());
                }
            }

            // Attempt to cache the XML files that are used the most.
            try
            {
                XmlManager.Instance.Load("armor.xml");
                XmlManager.Instance.Load("bioware.xml");
                XmlManager.Instance.Load("books.xml");
                XmlManager.Instance.Load("cyberware.xml");
                XmlManager.Instance.Load("gear.xml");
                XmlManager.Instance.Load("lifestyles.xml");
                XmlManager.Instance.Load("metatypes.xml");
                XmlManager.Instance.Load("qualities.xml");
                XmlManager.Instance.Load("ranges.xml");
                XmlManager.Instance.Load("skills.xml");
                XmlManager.Instance.Load("vehicles.xml");
                XmlManager.Instance.Load("weapons.xml");
            }
            catch
            {
            }
        }