| 1: | // HelpCommands.cs | |
| 2: | // Copyright (C) 2002 Mike Krueger | |
| 3: | // | |
| 4: | // This program is free software; you can redistribute it and/or modify | |
| 5: | // it under the terms of the GNU General Public License as published by | |
| 6: | // the Free Software Foundation; either version 2 of the License, or | |
| 7: | // (at your option) any later version. | |
| 8: | // | |
| 9: | // This program is distributed in the hope that it will be useful, | |
| 10: | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11: | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 12: | // GNU General Public License for more details. | |
| 13: | // | |
| 14: | // You should have received a copy of the GNU General Public License | |
| 15: | // along with this program; if not, write to the Free Software | |
| 16: | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 17: | ||
| 18: | using System; | |
| 19: | using System.Diagnostics; | |
| 20: | using System.IO; | |
| 21: | using System.Collections; | |
| 22: | using System.Windows.Forms; | |
| 23: | ||
| 24: | using Core.Util; | |
| 25: | using Core.Properties; | |
| 26: | using Core.Gui.Creators; | |
| 27: | ||
| 28: | using SharpDevelop.Gui; | |
| 29: | using SharpDevelop.Gui.Dialogs; | |
| 30: | ||
| 31: | namespace SharpDevelop.Base.Commands { | |
| 32: | ||
| 33: | public class ShowHelp : AbstractMenuCommand | |
| 34: | { | |
| 35: | public override void Run() | |
| 36: | { | |
| 37: | string fileName = Application.StartupPath + | |
| 38: | Path.DirectorySeparatorChar + ".." + | |
| 39: | Path.DirectorySeparatorChar + "doc" + | |
| 40: | Path.DirectorySeparatorChar + "Program" + | |
| 41: | Path.DirectorySeparatorChar + "sharpdevelop.chm"; | |
| 42: | ||
| 43: | if (FileUtility.TestFileExists(fileName)) { | |
| 44: | Help.ShowHelp((Form)WorkbenchSingleton.Workbench, fileName); | |
| 45: | } | |
| 46: | } | |
| 47: | } | |
| 48: | ||
| 49: | ||
| 50: | public class ViewGPL : AbstractMenuCommand | |
| 51: | { | |
| 52: | public override void Run() | |
| 53: | { | |
| 54: | ViewGPLDialog totdd = new ViewGPLDialog(); | |
| 55: | totdd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 56: | totdd.ShowGPL(); | |
| 57: | totdd.Dispose(); | |
| 58: | } | |
| 59: | } | |
| 60: | ||
| 61: | public class GotoWebSite : AbstractMenuCommand | |
| 62: | { | |
| 63: | string site; | |
| 64: | ||
| 65: | public GotoWebSite(string site) | |
| 66: | { | |
| 67: | this.site = site; | |
| 68: | } | |
| 69: | ||
| 70: | public override void Run() | |
| 71: | { | |
| 72: | WorkbenchSingleton.Workbench.OpenFile(site); | |
| 73: | } | |
| 74: | } | |
| 75: | ||
| 76: | public class GotoLink : AbstractMenuCommand | |
| 77: | { | |
| 78: | string site; | |
| 79: | ||
| 80: | public GotoLink(string site) | |
| 81: | { | |
| 82: | this.site = site; | |
| 83: | } | |
| 84: | ||
| 85: | public override void Run() | |
| 86: | { | |
| 87: | string file = site.StartsWith("home://") ? Application.StartupPath + "\\" + site.Substring(7).Replace('/', Path.DirectorySeparatorChar) : site; | |
| 88: | try { | |
| 89: | // TODO : Remove this .NET bugfix | |
| 90: | HelperServices.ExecuteDirect ed = new HelperServices.ExecuteDirect(); | |
| 91: | ed.RunProgram("\"" + Environment.GetEnvironmentVariable("ComSpec") + "\" /c \"" + file+'"', HelperServices.ShowWindowOption.hidden); | |
| 92: | ||
| 93: | // Process.Start(file); | |
| 94: | } catch (Exception) { | |
| 95: | MessageBox.Show("Can't execute/view " + file + "\n Please check that the file exists and that you can open this file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); | |
| 96: | } | |
| 97: | } | |
| 98: | } | |
| 99: | ||
| 100: | ||
| 101: | ||
| 102: | public class ViewTipOfTheDay : AbstractMenuCommand | |
| 103: | { | |
| 104: | public override void Run() | |
| 105: | { | |
| 106: | TipOfTheDayDialog totdd = new TipOfTheDayDialog(); | |
| 107: | totdd.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 108: | totdd.Show(); | |
| 109: | } | |
| 110: | } | |
| 111: | ||
| 112: | public class AboutSharpDevelop : AbstractMenuCommand | |
| 113: | { | |
| 114: | public override void Run() | |
| 115: | { | |
| 116: | AboutDialog ad = new AboutDialog(); | |
| 117: | ad.Owner = (Form)WorkbenchSingleton.Workbench; | |
| 118: | ad.ShowDialog(); | |
| 119: | ad.Dispose(); | |
| 120: | } | |
| 121: | } | |
| 122: | ||
| 123: | } |
This page was automatically generated by SharpDevelop.