Esempio n. 1
0
        public ucFunctions()
        {
            InitializeComponent();
            if (Utility.InDesignMode)
            {
                return;
            }

            CrossThreadHelper = new CrossThreadHelper(this);
            EnableDoubleBuffering();
            tabStrip1.Height = ClientSize.Height - tabStrip1.Top;
            tabStrip1.Tabs.Clear();
            Controller.Instance.CompileErrorEvent += HighlightError;

            #if DEBUG
            rtbOutput.Dock = DockStyle.Fill;
            rtbOutput.BackColor = Color.FromKnownColor(KnownColor.ControlDark);
            #endif
            lblStatus.Top = 1;
            lblStatus.Left = 0;
            lblStatus.Width = ClientSize.Width;
            lblStatus.Height = ClientSize.Height;
            lblStatus.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;
            tabStrip1.Visible = false;

            tabStrip1.CloseButtonOnTabsAlwaysDisplayed = true;
            tabStrip1.CloseButtonOnTabsVisible = true;
            tabStrip1.CloseButtonPosition = eTabCloseButtonPosition.Right;
            tabStrip1.CloseButtonVisible = true;

            SetErrorListColumnWidths();

            //Debugger.Debugger.SpinUpDebugProcess();
        }
Esempio n. 2
0
		public frmMain(string[] args)
		{
			//try
			//{
			CrossThreadHelper = new CrossThreadHelper(this);
			InitializeComponent();

#if !DEBUG
			// Hide these components from real users. Only Slyce should see these components
			//mnuCopyCode.Visible = false;
#endif
			EnableDoubleBuffering();
			PopulateRecentFiles();
			Controller.Instance.MainForm = this;
			Project.Instance.ReferencedAssembliesChanged += Project_ReferencedAssembliesChanged;
			//ErrorReportingService.RegisterErrorReporter(this);

			// When a file is opened through association (right-clicking an STZ file in Windows Explorer), then
			// the path is passed as a commandline parameter, but without quotes. This means that if the path has
			// spaces in it, it appears as separate arguments. We need to check for this before proceeding.
			bool openViaFileAssociation = false;

			if (Environment.CommandLine.IndexOf("\"", 1) > 0)
			{
				string commandLineFile = Environment.CommandLine.Substring(Environment.CommandLine.IndexOf("\"", 1) + 1).Trim(new[] { '"', ' ' });

				if (File.Exists(commandLineFile))
				{
					try
					{
						openViaFileAssociation = true;
						OpenFile(commandLineFile);
					}
					catch (Exception ex)
					{
						MessageBox.Show(string.Format("An error occurred while trying to open the file: {0}.\n\nThe error was:\n{1}", commandLineFile, ex.Message), "Unknown Parameters", MessageBoxButtons.OK, MessageBoxIcon.Error);
						Program.HideSplashScreen();
						CreateNewProject();
					}
				}
			}
			if (!openViaFileAssociation)
			{
				if (args.Length == 0)
				{
					if (Settings.Default.AutoLoadLastOpenFile && Controller.Instance.RecentFiles.Length > 0 && File.Exists(Controller.Instance.RecentFiles[0]))
					{
						try
						{
							OpenFile(Controller.Instance.RecentFiles[0]);
						}
						catch (Exception ex)
						{
							Program.HideSplashScreen();
							Settings.Default.AutoLoadLastOpenFile = false;
							MessageBox.Show(string.Format("An error occurred while trying to open your most recent project: {0}. A new blank project will now be created.\n\nThe error was:\n{1}", Controller.Instance.RecentFiles[0], ex.Message), "Unknown Parameters", MessageBoxButtons.OK, MessageBoxIcon.Error);
							CreateNewProject();
						}
					}
					else
					{
						CreateNewProject();
					}
				}
				else
				{
					Program.HideSplashScreen();

					foreach (string arg in args)
					{
						if (Slyce.Common.Utility.StringsAreEqual(arg, "/compile", false))
						{
							OpenFile(args[1]);
							//Controller.CommandLine = true;
							//int exitCode = Program.CompileFromCommandLine(args[1], false) ? 0 : 1;
							int exitCode = CompileProject(false, false) ? 0 : 1;
							Environment.Exit(exitCode);
						}
					}
					//MessageBox.Show("ArchAngel Designer was called with unexpected arguments. A filepath was expected: " + args[0], "Unexpected Arguments", MessageBoxButtons.OK, MessageBoxIcon.Warning);
				}
			}
			backgroundWorkerUpdateChecker.RunWorkerAsync();
			//Debugger.Debugger.SpinUpDebugProcess();
			//Activate();
			Program.HideSplashScreen();
			// Force the taskbar button to display. If user sets focus to another program while the splash-screen
			// is displaying, then no button gets added to the taskbar until he alt-tabs to find the app.
			ShowInTaskbar = false;
			ShowInTaskbar = true;
			ribbonControl1.SelectedRibbonTabItem = ribbonTabItemProject;

			// Add the ribbon bar items from the ApiExtensions screen
			ribbonBarController.ProcessRibbonBarButtons(this, ribbonPanelProject);
			// Add the ribbon bar items from the ApiExtensions screen
			ribbonBarController.ProcessRibbonBarButtons(UcApiExtensions, ribbonPanelApiExtensions);

			ribbonBarController.RefreshButtonStatus();
			//}
			//catch (Exception ex)
			//{
			//    Controller.ReportError(ex);
			//}
		}