/// <summary> /// When we click ok /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnOkClick(object sender, EventArgs e) { SolutionPreferences prefs = Luminate.Singleton.Preferences; prefs.useAutoComplete = checkBox1.Checked; prefs.additionalKeywords.Clear(); prefs.autoBraceClosure = autoBraceClosure.Checked; string[] keywords = textBoxKeywords.Text.Split(','); foreach (string keyword in keywords) { prefs.additionalKeywords.Add(keyword.Trim()); } this.DialogResult = System.Windows.Forms.DialogResult.OK; Hide(); }
/// <summary> /// Loads the preferences from an XML file /// </summary> /// <returns></returns> public static SolutionPreferences Load(string file) { SolutionPreferences toReturn = null; try { XmlSerializer deserializer = new XmlSerializer(typeof(SolutionPreferences)); TextReader textReader = new StreamReader(file); toReturn = (SolutionPreferences)deserializer.Deserialize(textReader); textReader.Close(); } catch { toReturn = new SolutionPreferences(); } return(toReturn); }
/// <summary> /// Center to screen /// </summary> /// <param name="e"></param> protected override void OnShown(EventArgs e) { base.OnShown(e); CenterToScreen(); SolutionPreferences prefs = Luminate.Singleton.Preferences; checkBox1.Checked = prefs.useAutoComplete; textBoxKeywords.Text = ""; autoBraceClosure.Checked = prefs.autoBraceClosure; foreach (string keyword in prefs.additionalKeywords) { textBoxKeywords.Text += keyword.Trim() + ","; } if (textBoxKeywords.Text.Length > 0) { textBoxKeywords.Text = textBoxKeywords.Text.Substring(0, textBoxKeywords.Text.Length - 1); } }
/// <summary> /// Simple constructor /// </summary> public Luminate(string[] data) { InitializeComponent(); mSingleton = this; mListenForChanges = true; mProjects = new List <Project>(); mDocs = new List <Document>(); mAbout = new About(); mFTPOptions = new FTP_Options(); mBuildOptions = new BuildOptions(); mPrefForm = new Preferences(); mPrevForm = new Preview(); mLexer = new DocumentLexer(); SolutionExplorer explorer = SolutionExplorer.Singleton; Logger logger = Logger.Singleton; //Only show the files if we dont have a layout if (!File.Exists(Application.StartupPath + "\\layout.lumf")) { explorer.Show(mDockPanel); logger.Show(mDockPanel); mPrevForm.Show(mDockPanel); explorer.DockTo(mDockPanel, DockStyle.Right); logger.DockTo(mDockPanel, DockStyle.Bottom); mPrevForm.DockTo(mDockPanel, DockStyle.Fill); } if (File.Exists(Application.StartupPath + "\\preferences.lumf")) { mPrefs = SolutionPreferences.Load(Application.StartupPath + "\\preferences.lumf"); } else { mPrefs = new SolutionPreferences(); } Builder.ignoreList = mPrefs.ignoreList; //Set the browser textBrowser.Tag = mPrefs.browser; string[] split = mPrefs.browser.Split('\\'); textBrowser.Text = split[split.Length - 1]; mNewProj = new NewProject(); buttonBuild.Image = imageList.Images[0]; buttonRun.Image = imageList.Images[1]; buttonMinify.Image = imageList.Images[3]; buttonBrowserDiag.Image = imageList.Images[4]; //Event handlers explorer.ProjectSelected += new SolutionExplorer.projectSelected(OnProjectSelected); OnProjectSelected(null); // Open the general project settings - see if there are any projects already loaded try { // Example #2 // Read each line of the file into a string array. Each element // of the array is one line of the file. string[] lines = File.ReadAllLines(Application.StartupPath + "\\startup.options"); foreach (string projectLocation in lines) { if (projectLocation[0] == '*') { AddCloseNode(projectLocation.Remove(0, 1)); } else { OpenProject(projectLocation); } } } catch { } //If arguments are passed to the app then try and open the file if its a lum file if (data != null && data.Length > 0) { if (data[0].Split('.')[1].ToString().ToLower() == "lum") { OpenProject(data[0]); } } }