示例#1
0
        //=====================================================================

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="projectToLoad">A default project file to load.  If not specified, the most recently used
        /// project is loaded if there is one.</param>
        public MainForm(string projectToLoad)
        {
            mainForm = this;
            InitializeComponent();

            // Skip the rest of the initialization in design mode
            if(this.DesignMode)
                return;

            // We are only going to monitor for file changes.  We won't handle moves, deletes, or renames.
            changedFiles = new HashSet<string>();
            fsw = new FileSystemWatcher();
            fsw.NotifyFilter = NotifyFilters.LastWrite;
            fsw.IncludeSubdirectories = true;
            fsw.Changed += fsw_OnChanged;

            if(Settings.Default.ContentFileEditors == null)
                Settings.Default.ContentFileEditors = new ContentFileEditorCollection();

            // Add the editors to the global list
            ContentFileEditorCollection.GlobalEditors.AddRange(Settings.Default.ContentFileEditors);

            if(projectToLoad != null)
            {
                if(Settings.Default.MruList == null)
                    Settings.Default.MruList = new StringCollection();

                if(File.Exists(projectToLoad))
                    MainForm.UpdateMruList(projectToLoad);
                else
                    MessageBox.Show("Unable to find project: " + projectToLoad, Constants.AppName,
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            // Set the status label to use for status bar text
            StatusBarTextProvider.ApplicationStatusBar = tsslStatusText;

            // Define the status label and progress bar too.  This allows easy access to those items from
            // anywhere within the application.
            StatusBarTextProvider.StatusLabel = tsslProgressNote;
            StatusBarTextProvider.ProgressBar = tspbProgressBar;
        }
示例#2
0
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="projectToLoad">A default project file to load.  If
        /// not specified, the most recently used project is loaded if there
        /// is one.</param>
        public MainForm(string projectToLoad)
        {
            mainForm = this;
            InitializeComponent();

            // Skip the rest of the initialization in design mode
            if(this.DesignMode)
                return;

            if(Settings.Default.ContentFileEditors == null)
                Settings.Default.ContentFileEditors = new ContentFileEditorCollection();

            // Add the editors to the global list
            ContentFileEditorCollection.GlobalEditors.AddRange(
                Settings.Default.ContentFileEditors);

            if(projectToLoad != null)
            {
                if(Settings.Default.MruList == null)
                    Settings.Default.MruList = new StringCollection();

                if(File.Exists(projectToLoad))
                    MainForm.UpdateMruList(projectToLoad);
                else
                    MessageBox.Show("Unable to find project: " + projectToLoad,
                        Constants.AppName, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
            }

            // Set the status label to use for status bar text
            StatusBarTextProvider.ApplicationStatusBar = tsslStatusText;

            // Define the status label and progress bar too.  This allows
            // easy access to those items from anywhere within the
            // application.
            StatusBarTextProvider.StatusLabel = tsslProgressNote;
            StatusBarTextProvider.ProgressBar = tspbProgressBar;
        }