- Functions.Common hb_common_func = new Functions.Common();\r
-\r
- string userPresets = Application.StartupPath.ToString() + "\\user_presets.dat";\r
- try\r
- {\r
- // Create a StreamWriter and open the file\r
- StreamWriter line = File.AppendText(userPresets);\r
-\r
- // Generate and write the preset string to the file\r
- String query = hb_common_func.GenerateTheQuery(frmMainWindow);\r
- String preset = "+ " + txt_preset_name.Text + ": " + query;\r
- line.WriteLine(preset);\r
-\r
- // close the stream\r
- line.Close();\r
- line.Dispose();\r
- MessageBox.Show("Your profile has been sucessfully added.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);\r
- }\r
- catch (Exception exc)\r
- {\r
- MessageBox.Show("Unable to write to the file. Please make sure the location has the correct permissions for file writing.\n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);\r
- }\r
- frmMainWindow.loadPresetPanel();\r
+ TreeNode presetTreeview = new TreeNode(txt_preset_name.Text.Trim()) {ForeColor = Color.Black};\r
+ _frmMainWindow.treeView_presets.Nodes.Add(presetTreeview);\r