public void OnSaveThemeButtonPressed(object sender, EventArgs e) { if (mSelectedTheme != null) { try { mSelectedTheme.Save(System.IO.Directory.GetCurrentDirectory() + "\\language_themes\\" + mSelectedTheme.Name + ".lgt"); themeSaveStatusLabel.Text = "Successfully saved theme: " + mSelectedTheme.Name; } catch (Exception ex) { } } RtfCodeFormatter.LoadLanguageThemes(); mLoadedThemes.Clear(); mLoadedThemes.AddRange(RtfCodeFormatter.LoadedLanguageThemes); RefreshThemeListBox(); }
private void MainForm_Load(object sender, EventArgs e) { ProjectMemoConsole.CustomConsole.Log("Loading ProjectMemo.MainForm on thread: " + Thread.CurrentThread.ManagedThreadId); // If the preferences file cannot be loaded, generate a default config file if (!Config.PMConfig.LoadFromFile(Directory.GetCurrentDirectory() + "/preferences.conf")) { Config.PMConfig.GenerateDefaultConfigFile(Directory.GetCurrentDirectory() + "/preferences.conf"); } Console.WriteLine("[" + Config.PMConfig.GetConfigValueString("mainNoteDir") + "]"); IOModule.SetupCurrentDirectory(); CustomConsole.Init(); ThisForm = this; mStopwatch = new Stopwatch(); mStopwatch.Start(); filesListBox.TimeSinceLastUpdate = mStopwatch.ElapsedMilliseconds; versionLabel.Text = Version; MainContent.InitFontStyles(template_richTextBox.Font.Size); RtfCodeFormatter.LoadLanguageThemes(); mAutoSaveModule = new AutoSaveModule(); mAutoSaveModule.OnAutoSaveTriggered += AutosaveAllNotes; foreach (string str in MainContent.GetFontStyleList()) { if (str != "Code Fragment") { format_textStyleSelector.Items.Add(str); } } format_languageSelector.Items.Clear(); format_languageSelector.Items.AddRange(RtfCodeFormatter.LoadedLanguageThemes); mainFormTimer.Start(); if (Config.PMConfig.DoesConfigValueExist("mainNoteDir")) { MainNoteDirectory = Config.PMConfig.GetConfigValueString("mainNoteDir"); } else { MainNoteDirectory = "ERRORDIR"; } // Set the valid semester choices string[] semesterFolders = new string[] { }; if (!string.IsNullOrEmpty(MainNoteDirectory)) { semesterFolders = Directory.GetDirectories(MainNoteDirectory); } mLoadedSemesters.Clear(); foreach (string str in semesterFolders) { if (str.EndsWith("_s2") || str.EndsWith("_s1")) { mLoadedSemesters.Add(str.Replace(MainNoteDirectory, "")); } } template_rtb = template_richTextBox; activeRichTextBox = null; CustomConsole.Log("Set activeRichTextBox to null"); template_richTextBox.Visible = false; CustomConsole.Log("Set the visibility of the template_richTextBox to False"); mainTabControl.TabPages.RemoveAt(0); CustomConsole.Log("Removed the default tab from mainTabControl"); /* * string[] semesterFolders = Directory.GetDirectories(mMainNoteDirectory); * * semesterSelector.Items.Clear(); * * foreach (string str in semesterFolders) * if (str.EndsWith("_s2") || str.EndsWith("_s1")) * semesterSelector.Items.Add(str.Replace(mMainNoteDirectory, ""));*/ formLoaded = true; format_textStyleSelector.SelectedIndex = 0; SetTabControlRTBSize(); }