public void Show(MDIParent parent, bool enableReplace, string defaultFindValue) 
		{
			bool defaultValueUsed = false;
			if (_parent == null)
			{
				_parent = parent;

				this.Left = parent.Left + (Math.Abs(parent.Width - this.Width) / 2);
				this.Top = parent.Top + (Math.Abs(parent.Height - this.Height) / 2);
			}

			if ((defaultFindValue != null) && (defaultFindValue != string.Empty) && (defaultFindValue != "\0")) 
			{
				this.textBoxFind.Text = defaultFindValue;
				defaultValueUsed = true;
			}
			else 
			{
				this.textBoxFind.Text = parent.CurrentEditControl.LastSearchText;
			}

			this.checkBoxAllowReplace.Checked = enableReplace;
			this.checkBoxUseRegEx.Checked = parent.CurrentEditControl.LastSearchIsRegex;
			this.checkBoxCaseSensitive.Checked = parent.CurrentEditControl.LastSearchIsCaseSensitive;

			if (!this.Visible) 
			{
				this.Show();
		

				Application.DoEvents();
				if (enableReplace && defaultValueUsed) 
				{
					this.textBoxReplace.Focus();
				}
				else
				{
					this.textBoxFind.Focus();
				}
			}
		}
예제 #2
0
        /// <summary>
        /// Constructor loads up the default settings, starts an async version check, loads the scintilla config, etc.
        /// </summary>
        /// <param name="startupPath"></param>
        /// <param name="args"></param>
        public MDIParent(string startupPath, params string[] args)
        {
            TheParent = this;
            DefaultSettings settings = DefaultSettings.Instance;
            languageMappings = new LanguageMappings(this);
            dbTargetMappings = new DbTargetMappings(this);
       metaDataBrowser = new MetaDataBrowser(this);
        userMetaData = new UserMetaData(this);
        globalUserMetaData = new GlobalUserMetaData(this);
        metaProperties = new MetaProperties(this);


            //Any files that were locked when the TemplateLibrary downloaded and tried to replace them will be replaced now.
            ProcessReplacementFiles();

            StartVersionCheck(settings);

            userMetaData.MetaDataBrowser = this.metaDataBrowser;
            globalUserMetaData.MetaDataBrowser = this.metaDataBrowser;

            InitializeComponent();

            this.startupPath = startupPath;

            //Configuration.MyGeneration x = Configuration.MyGeneration.PopulatedObject;
            Scintilla.Configuration.Legacy.ConfigurationUtility cu = new Scintilla.Configuration.Legacy.ConfigurationUtility();

            // If the file doesn't exist, create it.
            FileInfo scintillaConfigFile = new FileInfo(startupPath + @"\settings\ScintillaNET.xml");
            if (scintillaConfigFile.Exists)
            {
                //TODO: Retry this with a copy of the file until we can upgrade Scintilla.Net with a fix.
                int maxTries = 3;
                while (maxTries > 0)
                {
                    try
                    {
                        //ConfigFile cf = new ConfigFile();
                        configFile = cu.LoadConfiguration(scintillaConfigFile.FullName) as ConfigFile;
                        //cf.
                        //object o = cu.LoadConfiguration(typeof(Configuration.MyGeneration), scintillaConfigFile.FullName);
                        //configFile = o as Configuration.;
                        //configFile.CollectScintillaNodes(null);
                        break;
                    }
                    catch
                    {
                        if (--maxTries == 1)
                        {
                            File.Copy(scintillaConfigFile.FullName, scintillaConfigFile.FullName + ".tmp", true);
                            scintillaConfigFile = new FileInfo(scintillaConfigFile.FullName + ".tmp");
                        }
                        else
                        {
                            System.Threading.Thread.Sleep(10);
                        }
                    }
                }
            }

            if (configFile != null)
            {
                configureDelegate = configFile.MasterScintilla.Configure;
                ZeusScintillaControl.StaticConfigure = configureDelegate;
            }

            this.IsMdiContainer = true;
            this.MdiChildActivate += new EventHandler(this.MDIChildActivated);

            startupFiles = args;

            if (settings.CompactMemoryOnStartup) FlushMemory();

            this.RefreshRecentFiles();
        }