private void CreateSnippetsMenu() { _editMenuSnippets.DropDownItems.Clear(); _editMenuSnippets.DropDownItems.Add( _editMenuSnippetsManage); PopulateSnippetsMenu( _snippetsFolderPath, _editMenuSnippets); if (_editMenuSnippets.DropDownItems.Count > 1) { _editMenuSnippets.DropDownItems.Insert(1, MenuTools.CreateSeparator( Constants.UI_EDIT_MENU_MANAGE_SNIPPETS_SEP)); } }
public SqlEditForm() { InitializeComponent(); _applicationManager = ApplicationManager.GetInstance(); _selectedTable = -1; #region Action Handler Registration // Register an interest in the Editor UI actions RegisterActionStateHandler( QuickSharp.Core.Constants.UI_FILE_MENU_SAVE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Core.Constants.UI_FILE_MENU_SAVE_AS, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PAGE_SETUP, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PRINT_PREVIEW, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PRINT, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_UNDO, CanUndo); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_REDO, CanRedo); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_CUT, HaveSelection); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_COPY, HaveSelection); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_PASTE, CanPaste); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_SELECT_ALL, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_FIND, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_REPLACE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_GOTO, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MACROS, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_SNIPPETS, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ADVANCED, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MAKE_UPPERCASE, HaveSelection); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MAKE_LOWERCASE, HaveSelection); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_COMMENT, CanLineComment); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_VIEW_WHITESPACE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TRIM_WHITESPACE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_WORD_WRAP, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_SET_READ_ONLY, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_BOOKMARKS, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TOGGLE_BOOKMARK, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_CLEAR_BOOKMARKS, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_NEXT_BOOKMARK, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_PREV_BOOKMARK, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_FOLDING, HaveFolding); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TOGGLE_FOLD, HaveFolding); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_COLLAPSE_ALL, HaveFolding); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_EXPAND_ALL, HaveFolding); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_ANSI, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF8, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF16BE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF16LE, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_CRLF, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_LF, ActionEnabled); RegisterActionStateHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_CR, ActionEnabled); RegisterActionHandler( QuickSharp.Core.Constants.UI_FILE_MENU_SAVE, Save); RegisterActionHandler( QuickSharp.Core.Constants.UI_FILE_MENU_SAVE_AS, SaveAs); RegisterActionHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PAGE_SETUP, PageSetup); RegisterActionHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PRINT_PREVIEW, PrintPreview); RegisterActionHandler( QuickSharp.Editor.Constants.UI_FILE_MENU_PRINT, Print); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_UNDO, Undo); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_REDO, Redo); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_CUT, Cut); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_COPY, Copy); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_PASTE, Paste); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_SELECT_ALL, SelectAll); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_FIND, Find); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_REPLACE, Replace); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_GOTO, GoTo); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MACRO_RECORD, MacroRecord); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MACRO_PLAY, MacroPlay); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MACRO_LOAD, MacroLoad); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MACRO_SAVE, MacroSave); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MAKE_UPPERCASE, MakeUppercase); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_MAKE_LOWERCASE, MakeLowercase); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_COMMENT, LineComment); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_VIEW_WHITESPACE, ViewWhitespace); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TRIM_WHITESPACE, TrimWhitespace); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_WORD_WRAP, WordWrap); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_SET_READ_ONLY, SetReadOnly); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TOGGLE_BOOKMARK, BookMarkToggle); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_CLEAR_BOOKMARKS, BookMarkClear); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_NEXT_BOOKMARK, BookmarkNext); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_PREV_BOOKMARK, BookmarkPrevious); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_TOGGLE_FOLD, FoldToggle); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_COLLAPSE_ALL, FoldCollapseAll); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_EXPAND_ALL, FoldExpandAll); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_ANSI, SetEncodingANSI); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF8, SetEncodingUTF8); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF16BE, SetEncodingUTF16BE); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_ENCODING_UTF16LE, SetEncodingUTF16LE); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_CRLF, SetLineEndingCRLF); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_LF, SetLineEndingLF); RegisterActionHandler( QuickSharp.Editor.Constants.UI_EDIT_MENU_LINE_ENDING_CR, SetLineEndingCR); RegisterActionStateHandler( QuickSharp.Core.Constants.UI_TOOLBAR_SAVE, ActionEnabled); RegisterActionHandler( QuickSharp.Core.Constants.UI_TOOLBAR_SAVE, Save); #endregion UI_DATA_GRID_MENU_CLEAR = new ToolStripMenuItem(); UI_DATA_GRID_MENU_CLEAR.Name = Constants.UI_DATA_GRID_MENU_CLEAR; UI_DATA_GRID_MENU_CLEAR.Text = Resources.DataGridMenuClear; UI_DATA_GRID_MENU_CLEAR.Click += new EventHandler(UI_DATA_GRID_MENU_CLEAR_Click); UI_DATA_GRID_MENU_SEP_1 = MenuTools.CreateSeparator(Constants.UI_DATA_GRID_MENU_SEP_1); UI_DATA_GRID_MENU_SEP_2 = MenuTools.CreateSeparator(Constants.UI_DATA_GRID_MENU_SEP_2); UI_DATA_GRID_MENU_EXPORT_XSD = new ToolStripMenuItem(); UI_DATA_GRID_MENU_EXPORT_XSD.Name = Constants.UI_DATA_GRID_MENU_EXPORT_XSD; UI_DATA_GRID_MENU_EXPORT_XSD.Text = Resources.DataGridMenuExportXsd; UI_DATA_GRID_MENU_EXPORT_XSD.Click += new EventHandler(UI_DATA_GRID_MENU_EXPORT_XSD_Click); UI_DATA_GRID_MENU_EXPORT_XML = new ToolStripMenuItem(); UI_DATA_GRID_MENU_EXPORT_XML.Name = Constants.UI_DATA_GRID_MENU_EXPORT_XML; UI_DATA_GRID_MENU_EXPORT_XML.Text = Resources.DataGridMenuExportXml; UI_DATA_GRID_MENU_EXPORT_XML.Click += new EventHandler(UI_DATA_GRID_MENU_EXPORT_XML_Click); }
private void InitializeComponent() { #region Controls _components = new Container(); _mainToolStrip = new ToolStrip(); _refreshButton = new ToolStripButton(); _parentButton = new ToolStripButton(); _moveButton = new ToolStripButton(); _visitedFolderSelectButton = new ToolStripDropDownButton(); _launchExplorerButton = new ToolStripButton(); _launchShellButton = new ToolStripButton(); _backupButton = new ToolStripButton(); _filterButton = new ToolStripButton(); _filterSelectButton = new ToolStripDropDownButton(); _mainTreeView = new TreeView(); _treeViewImageList = new ImageList(_components); _treeViewMenu = new ContextMenuStrip(_components); UI_TREE_MENU_OPEN = new ToolStripMenuItem(); UI_TREE_MENU_SEP_1 = new ToolStripSeparator(); UI_TREE_MENU_RENAME = new ToolStripMenuItem(); UI_TREE_MENU_CLONE = new ToolStripMenuItem(); UI_TREE_MENU_DELETE = new ToolStripMenuItem(); UI_TREE_MENU_SEP_2 = new ToolStripSeparator(); UI_TREE_MENU_CREATE_FOLDER = new ToolStripMenuItem(); UI_TREE_MENU_SEP_3 = new ToolStripSeparator(); UI_TREE_MENU_SET_AS_CURRENT_DIR = new ToolStripMenuItem(); #endregion _mainToolStrip.SuspendLayout(); _treeViewMenu.SuspendLayout(); SuspendLayout(); _mainToolStrip.Items.Add(_refreshButton); _mainToolStrip.Items.Add(_parentButton); _mainToolStrip.Items.Add(_moveButton); _mainToolStrip.Items.Add(_visitedFolderSelectButton); if (!_applicationManager.ClientProfile.HaveFlag( ClientFlags.ExplorerDisableWindowsShell)) { _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_1)); _mainToolStrip.Items.Add(_launchExplorerButton); _mainToolStrip.Items.Add(_launchShellButton); } _mainToolStrip.Location = new Point(0, 0); _mainToolStrip.Name = "mainToolStrip"; _mainToolStrip.TabIndex = 0; _mainToolStrip.Text = "toolStrip1"; _refreshButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _refreshButton.Image = Resources.Refresh; _refreshButton.ImageTransparentColor = Color.Magenta; _refreshButton.Name = Constants.UI_TOOLBAR_REFRESH; _refreshButton.Text = Resources.ToolbarRefresh; _refreshButton.Click += delegate { _applicationManager.NotifyFileSystemChange(); }; _parentButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _parentButton.Image = Resources.ParentFolder; _parentButton.ImageTransparentColor = Color.Magenta; _parentButton.Name = Constants.UI_TOOLBAR_MOVE_PARENT; _parentButton.Text = Resources.ToolbarParentFolder; _parentButton.Click += delegate { MoveToParent(); }; _moveButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _moveButton.Image = Resources.OpenFolder; _moveButton.ImageTransparentColor = Color.Magenta; _moveButton.Name = Constants.UI_TOOLBAR_MOVE_NEW; _moveButton.Text = Resources.ToolbarMoveRoot; _moveButton.Click += new System.EventHandler(MoveToolStripButton_Click); _visitedFolderSelectButton.Name = Constants.UI_TOOLBAR_SELECT_VISITED_FOLDER; _visitedFolderSelectButton.Enabled = false; _visitedFolderSelectButton.DropDownOpening += delegate { RefreshVisitedFolderList(); }; _launchExplorerButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _launchExplorerButton.Image = Resources.Explorer; _launchExplorerButton.ImageTransparentColor = Color.Fuchsia; _launchExplorerButton.Name = Constants.UI_TOOLBAR_LAUNCH_EXPLORER; _launchExplorerButton.Text = Resources.ToolbarLaunchExplorer; _launchExplorerButton.Click += delegate { LaunchExplorer(); }; _launchShellButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _launchShellButton.Image = Resources.Console; _launchShellButton.ImageTransparentColor = Color.Fuchsia; _launchShellButton.Name = Constants.UI_TOOLBAR_LAUNCH_SHELL; _launchShellButton.Text = Resources.ToolbarLaunchShell; _launchShellButton.Click += delegate { LaunchShell(); }; _backupButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _backupButton.Image = Resources.FileBackup; _backupButton.ImageTransparentColor = Color.Fuchsia; _backupButton.Name = Constants.UI_TOOLBAR_BACKUP; _backupButton.Text = Resources.ToolbarBackup; _backupButton.Click += delegate { BackupExplorer(); }; _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_2)); _mainToolStrip.Items.Add(_backupButton); _filterButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _filterButton.Image = Resources.FilterFiles; _filterButton.ImageTransparentColor = Color.Fuchsia; _filterButton.Name = Constants.UI_TOOLBAR_FILTER_FILES; _filterButton.Text = Resources.ToolbarFilter; _filterButton.Click += delegate { ToggleFileFilter(); }; _filterSelectButton.Name = Constants.UI_TOOLBAR_SELECT_FILTER; _filterSelectButton.Enabled = false; _filterSelectButton.DropDownOpening += delegate { RefreshFileFilterList(); }; _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_3)); _mainToolStrip.Items.Add(_filterButton); _mainToolStrip.Items.Add(_filterSelectButton); _mainTreeView.Dock = DockStyle.Fill; _mainTreeView.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); _mainTreeView.ImageList = _treeViewImageList; _mainTreeView.Location = new Point(0, 25); _mainTreeView.Name = "mainTreeView"; _mainTreeView.TabIndex = 1; _mainTreeView.ContextMenuStrip = _treeViewMenu; _treeViewImageList.ColorDepth = ColorDepth.Depth24Bit; _treeViewImageList.ImageSize = new Size(16, 16); _treeViewImageList.TransparentColor = Color.Fuchsia; _treeViewImageList.Images.Add("CLOSEDFOLDER", Resources.ClosedFolder); _treeViewImageList.Images.Add("OPENEDFOLDER", Resources.OpenedFolder); _treeViewImageList.Images.Add("DOCUMENT", Resources.Document); _treeViewImageList.Images.Add("EXE", Resources.Exe); _treeViewImageList.Images.Add("DLL", Resources.Dll); _treeViewImageList.Images.Add("PDB", Resources.Pdb); _treeViewImageList.Images.Add("TEXT", Resources.Text); _treeViewImageList.Images.Add("CSHARP", Resources.CSharp); _treeViewImageList.Images.Add("MSIL", Resources.Msil); _treeViewImageList.Images.Add("VBNET", Resources.VBNet); _treeViewImageList.Images.Add("SCRIPT", Resources.Script); _treeViewImageList.Images.Add("IMAGE", Resources.Image); _treeViewImageList.Images.Add("HTML", Resources.Html); _treeViewImageList.Images.Add("RESOURCE", Resources.Resource); _treeViewImageList.Images.Add("CSS", Resources.Css); _treeViewImageList.Images.Add("XAML", Resources.Xaml); _treeViewImageList.Images.Add("XML", Resources.Xml); _treeViewImageList.Images.Add("XSD", Resources.Xsd); _treeViewImageList.Images.Add("CPP", Resources.Cpp); _treeViewImageList.Images.Add("C", Resources.C); _treeViewImageList.Images.Add("H", Resources.H); _treeViewImageList.Images.Add("JAVA", Resources.Java); _treeViewImageList.Images.Add("OBJ", Resources.Obj); _treeViewImageList.Images.Add("ASHX", Resources.Ashx); _treeViewImageList.Images.Add("ASCX", Resources.Ascx); _treeViewImageList.Images.Add("ASPX", Resources.Aspx); _treeViewImageList.Images.Add("SQL", Resources.Sql); _treeViewImageList.Images.Add("PROJ", Resources.Proj); _treeViewImageList.Images.Add("CAB", Resources.Cabinet); _treeViewImageList.Images.Add("DBML", Resources.Dbml); _treeViewImageList.Images.Add("DATABASE", Resources.Database); _treeViewMenu.Opening += new CancelEventHandler(treeViewMenu_Opening); _treeViewMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { UI_TREE_MENU_OPEN, UI_TREE_MENU_SEP_1, UI_TREE_MENU_RENAME, UI_TREE_MENU_CLONE, UI_TREE_MENU_DELETE, UI_TREE_MENU_SEP_2, UI_TREE_MENU_CREATE_FOLDER, UI_TREE_MENU_SEP_3, UI_TREE_MENU_SET_AS_CURRENT_DIR }); UI_TREE_MENU_OPEN.Name = Constants.UI_TREE_MENU_OPEN; UI_TREE_MENU_OPEN.Text = Resources.TreeMenuOpen; UI_TREE_MENU_OPEN.Image = Resources.OpenFolder; UI_TREE_MENU_OPEN.ImageTransparentColor = System.Drawing.Color.Fuchsia; UI_TREE_MENU_OPEN.ShortcutKeyDisplayString = Resources.EnterKey; UI_TREE_MENU_OPEN.Click += new System.EventHandler(UI_TREE_MENU_OPEN_Click); UI_TREE_MENU_SEP_1.Name = Constants.UI_TREE_MENU_SEP_1; UI_TREE_MENU_RENAME.Name = Constants.UI_TREE_MENU_RENAME; UI_TREE_MENU_RENAME.Text = Resources.TreeMenuRename; UI_TREE_MENU_RENAME.ShortcutKeys = Keys.F2; UI_TREE_MENU_RENAME.Click += new System.EventHandler(UI_TREE_MENU_RENAME_Click); UI_TREE_MENU_CLONE.Name = Constants.UI_TREE_MENU_CLONE; UI_TREE_MENU_CLONE.Text = Resources.TreeMenuClone; UI_TREE_MENU_CLONE.Click += new System.EventHandler(UI_TREE_MENU_CLONE_Click); UI_TREE_MENU_DELETE.Name = Constants.UI_TREE_MENU_DELETE; UI_TREE_MENU_DELETE.Text = Resources.TreeMenuDelete; UI_TREE_MENU_DELETE.ShortcutKeys = Keys.Delete; UI_TREE_MENU_DELETE.Click += new System.EventHandler(UI_TREE_MENU_DELETE_Click); UI_TREE_MENU_SEP_1.Name = Constants.UI_TREE_MENU_SEP_1; UI_TREE_MENU_CREATE_FOLDER.Name = Constants.UI_TREE_MENU_CREATE_FOLDER; UI_TREE_MENU_CREATE_FOLDER.Text = Resources.TreeMenuCreateFolder; UI_TREE_MENU_CREATE_FOLDER.Image = Resources.NewFolder; UI_TREE_MENU_CREATE_FOLDER.ImageTransparentColor = System.Drawing.Color.Fuchsia; UI_TREE_MENU_CREATE_FOLDER.Click += new System.EventHandler(UI_TREE_MENU_CREATE_FOLDER_Click); UI_TREE_MENU_SEP_3.Name = Constants.UI_TREE_MENU_SEP_3; UI_TREE_MENU_SET_AS_CURRENT_DIR.Name = Constants.UI_TREE_MENU_SET_AS_CURRENT_DIR; UI_TREE_MENU_SET_AS_CURRENT_DIR.Text = Resources.TreeMenuSetAsCurrentDir; UI_TREE_MENU_SET_AS_CURRENT_DIR.Click += new System.EventHandler(UI_TREE_MENU_SET_AS_CURRENT_DIR_Click); AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; Controls.Add(_mainTreeView); Controls.Add(_mainToolStrip); DockAreas = ((WeifenLuo.WinFormsUI.Docking.DockAreas) (((((WeifenLuo.WinFormsUI.Docking.DockAreas.Float) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom)); Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); HideOnClose = true; Name = "ExplorerForm"; ShowInTaskbar = false; Text = "ExplorerForm"; _mainToolStrip.ResumeLayout(false); _mainToolStrip.PerformLayout(); _treeViewMenu.ResumeLayout(false); ResumeLayout(false); PerformLayout(); }
private void PopulateToolbar() { _toolbar.SuspendLayout(); _toolbarSeparator = MenuTools.CreateSeparator( Constants.UI_TOOLBAR_OBJECT_BROWSER_SEP); _viewModulesButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_VIEW_MODULES, Resources.OBViewByContainer, Resources.ViewByContainer, UI_TOOLBAR_VIEW_MODULES_Click); _viewNamespacesButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_VIEW_NAMESPACES, Resources.OBViewByNamespace, Resources.ViewByNamespace, UI_TOOLBAR_VIEW_NAMESPACES_Click); if (_includeWorkspace) { _showWorkspaceOnlyButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SHOW_WORKSPACE_ONLY, Resources.OBShowWorkspaceOnly, Resources.ShowWorkspaceOnly, UI_TOOLBAR_SHOW_WORKSPACE_ONLY_Click); } _showNonPublicButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SHOW_NONPUBLIC, Resources.OBShowNonPublic, Resources.ShowNonPublic, UI_TOOLBAR_SHOW_NONPUBLIC_Click); _showHiddenButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SHOW_HIDDEN, Resources.OBShowHidden, Resources.ShowHidden, UI_TOOLBAR_SHOW_HIDDEN_Click); _showInheritedButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SHOW_INHERITED, Resources.OBShowInherited, Resources.ShowInherited, UI_TOOLBAR_SHOW_INHERITED_Click); _refreshViewButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_REFRESH_VIEW, Resources.OBRefresh, Resources.RefreshView, UI_TOOLBAR_REFRESH_VIEW_Click); _showPropertiesButton = MenuTools.CreateToolbarButton( Constants.UI_TOOLBAR_SHOW_PROPERTIES, Resources.OBShowProperties, Resources.PROPERTIES, UI_TOOLBAR_SHOW_PROPERTIES_Click); if (!_useMainToolbar) { _toolbar.Items.Clear(); } if (_useMainToolbar) { _toolbar.Items.Add(_toolbarSeparator); } _toolbar.Items.Add(_viewModulesButton); _toolbar.Items.Add(_viewNamespacesButton); if (_includeWorkspace) { _toolbar.Items.Add(_showWorkspaceOnlyButton); } _toolbar.Items.Add(_showNonPublicButton); _toolbar.Items.Add(_showHiddenButton); _toolbar.Items.Add(_showInheritedButton); _toolbar.Items.Add(_refreshViewButton); _toolbar.Items.Add(_showPropertiesButton); _toolbar.ResumeLayout(true); }
private void InitForm() { bool enableShell = !_applicationManager.ClientProfile. HaveFlag(ClientFlags.WorkspaceDisableWindowsShell); bool enableShowSource = _applicationManager.ClientProfile. HaveFlag(ClientFlags.WorkspaceEnableShowSource); #region Controls _components = new Container(); _mainToolStrip = new ToolStrip(); _refreshToolStripButton = new ToolStripButton(); _parentToolStripButton = new ToolStripButton(); _moveToolStripButton = new ToolStripButton(); _visitedFolderDropDownButton = new ToolStripDropDownButton(); _backupWorkspaceButton = new ToolStripButton(); _launchExplorerButton = new ToolStripButton(); _launchShellButton = new ToolStripButton(); _showSourceOnlyButton = new ToolStripButton(); _mainListView = new ListView(); _fileViewMenu = new ContextMenuStrip(_components); UI_FILE_VIEW_MENU_OPEN = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_SEP_1 = new ToolStripSeparator(); UI_FILE_VIEW_MENU_RENAME = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_CLONE = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_DELETE = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_SEP_2 = new ToolStripSeparator(); UI_FILE_VIEW_MENU_CREATE_FOLDER = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_SEP_3 = new ToolStripSeparator(); UI_FILE_VIEW_MENU_MOVE_TO_PARENT = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_SEP_4 = new ToolStripSeparator(); UI_FILE_VIEW_MENU_SELECT_SIMILAR = new ToolStripMenuItem(); UI_FILE_VIEW_MENU_INVERT_SELECTION = new ToolStripMenuItem(); _fileViewImageList = new ImageList(_components); #endregion _mainToolStrip.SuspendLayout(); _fileViewMenu.SuspendLayout(); SuspendLayout(); _mainToolStrip.Items.Add(_refreshToolStripButton); _mainToolStrip.Items.Add(_parentToolStripButton); _mainToolStrip.Items.Add(_moveToolStripButton); _mainToolStrip.Items.Add(_visitedFolderDropDownButton); if (enableShell) { _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_1)); _mainToolStrip.Items.Add(_launchExplorerButton); _mainToolStrip.Items.Add(_launchShellButton); } _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_2)); _mainToolStrip.Items.Add(_backupWorkspaceButton); if (enableShowSource) { _mainToolStrip.Items.Add(MenuTools.CreateSeparator( Constants.UI_TOOLBAR_SEP_3)); _mainToolStrip.Items.Add(_showSourceOnlyButton); } else { _showSourceOnly = false; } _mainToolStrip.Location = new Point(0, 0); _mainToolStrip.Name = "mainToolStrip"; _mainToolStrip.TabIndex = 0; _mainToolStrip.Text = "toolStrip1"; _refreshToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _refreshToolStripButton.Image = Resources.Refresh; _refreshToolStripButton.ImageTransparentColor = Color.Fuchsia; _refreshToolStripButton.Name = Constants.UI_TOOLBAR_REFRESH; _refreshToolStripButton.Text = Resources.WorkspaceToolbarRefresh; _refreshToolStripButton.Click += delegate { RefreshFileView(); }; _parentToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _parentToolStripButton.Image = Resources.ParentFolder; _parentToolStripButton.ImageTransparentColor = Color.Fuchsia; _parentToolStripButton.Name = Constants.UI_TOOLBAR_MOVE_TO_PARENT; _parentToolStripButton.Text = Resources.WorkspaceToolbarParentFolder; _parentToolStripButton.Click += delegate { MoveToParent(); }; _moveToolStripButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _moveToolStripButton.Image = Resources.SearchFolder; _moveToolStripButton.ImageTransparentColor = Color.Fuchsia; _moveToolStripButton.Name = Constants.UI_TOOLBAR_LOCATE_NEW_FOLDER; _moveToolStripButton.Text = Resources.WorkspaceToolbarOpenFolder; _moveToolStripButton.Click += delegate { MoveWorkspace(); }; _visitedFolderDropDownButton.Name = Constants.UI_TOOLBAR_SELECT_VISITED_FOLDER; _visitedFolderDropDownButton.Enabled = false; _visitedFolderDropDownButton.DropDownOpening += delegate { RefreshVisitedFolderList(); }; _backupWorkspaceButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _backupWorkspaceButton.Image = Resources.BackupWorkspace; _backupWorkspaceButton.ImageTransparentColor = Color.Fuchsia; _backupWorkspaceButton.Name = Constants.UI_TOOLBAR_BACKUP_WORKSPACE; _backupWorkspaceButton.Text = Resources.WorkspaceToolbarBackup; _backupWorkspaceButton.Click += delegate { BackupWorkspace(); }; _launchExplorerButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _launchExplorerButton.Image = Resources.Explorer; _launchExplorerButton.ImageTransparentColor = Color.Fuchsia; _launchExplorerButton.Name = Constants.UI_TOOLBAR_LAUNCH_EXPLORER; _launchExplorerButton.Text = Resources.WorkspaceToolbarLaunchExplorer; _launchExplorerButton.Click += delegate { LaunchExplorer(); }; _launchShellButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _launchShellButton.Image = Resources.Console; _launchShellButton.ImageTransparentColor = Color.Fuchsia; _launchShellButton.Name = Constants.UI_TOOLBAR_LAUNCH_SHELL; _launchShellButton.Text = Resources.WorkspaceToolbarLaunchShell; _launchShellButton.Click += delegate { LaunchShell(); }; _showSourceOnlyButton.DisplayStyle = ToolStripItemDisplayStyle.Image; _showSourceOnlyButton.Image = Resources.ShowSourceOnly; _showSourceOnlyButton.ImageTransparentColor = Color.Fuchsia; _showSourceOnlyButton.Name = Constants.UI_TOOLBAR_SHOW_SOURCE_ONLY; _showSourceOnlyButton.Text = Resources.WorkspaceToolbarShowSourceOnly; _showSourceOnlyButton.Checked = _showSourceOnly; _showSourceOnlyButton.Click += delegate { ShowSourceOnly(); }; _mainListView.ContextMenuStrip = _fileViewMenu; _mainListView.Dock = DockStyle.Fill; _mainListView.View = View.Details; _mainListView.HeaderStyle = ColumnHeaderStyle.None; _mainListView.Columns.Add("item", -1); _mainListView.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); _mainListView.SmallImageList = _fileViewImageList; _mainListView.Location = new Point(0, 25); _mainListView.Name = "mainListView"; _mainListView.TabIndex = 1; _mainListView.MouseDoubleClick += new MouseEventHandler(MainListView_MouseDoubleClick); _mainListView.KeyDown += new KeyEventHandler(MainListView_KeyDown); _mainListView.LostFocus += new System.EventHandler(MainListView_LostFocus); _mainListView.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(MainListView_ItemSelectionChanged); _fileViewMenu.Items.AddRange(new ToolStripItem[] { UI_FILE_VIEW_MENU_OPEN, UI_FILE_VIEW_MENU_SEP_1, UI_FILE_VIEW_MENU_RENAME, UI_FILE_VIEW_MENU_CLONE, UI_FILE_VIEW_MENU_DELETE, UI_FILE_VIEW_MENU_SEP_2, UI_FILE_VIEW_MENU_CREATE_FOLDER, UI_FILE_VIEW_MENU_SEP_3, UI_FILE_VIEW_MENU_MOVE_TO_PARENT, UI_FILE_VIEW_MENU_SEP_4, UI_FILE_VIEW_MENU_SELECT_SIMILAR, UI_FILE_VIEW_MENU_INVERT_SELECTION }); _fileViewMenu.Name = "fileViewMenu"; _fileViewMenu.Opening += new CancelEventHandler(listViewMenu_Opening); UI_FILE_VIEW_MENU_OPEN.Name = Constants.UI_FILE_VIEW_MENU_OPEN; UI_FILE_VIEW_MENU_OPEN.Text = Resources.WorkspaceMenuOpen; UI_FILE_VIEW_MENU_OPEN.ShortcutKeyDisplayString = Resources.EnterKey; UI_FILE_VIEW_MENU_OPEN.Image = Resources.OpenFolder; UI_FILE_VIEW_MENU_OPEN.ImageTransparentColor = Color.Fuchsia; UI_FILE_VIEW_MENU_OPEN.Click += new System.EventHandler(UI_FILE_VIEW_MENU_OPEN_Click); UI_FILE_VIEW_MENU_SEP_1.Name = Constants.UI_FILE_VIEW_MENU_SEP_1; UI_FILE_VIEW_MENU_RENAME.Name = Constants.UI_FILE_VIEW_MENU_RENAME; UI_FILE_VIEW_MENU_RENAME.Text = Resources.WorkspaceMenuRename; UI_FILE_VIEW_MENU_RENAME.ShortcutKeys = Keys.F2; UI_FILE_VIEW_MENU_RENAME.Click += new System.EventHandler(UI_FILE_VIEW_MENU_RENAME_Click); UI_FILE_VIEW_MENU_CLONE.Name = Constants.UI_FILE_VIEW_MENU_CLONE; UI_FILE_VIEW_MENU_CLONE.Text = Resources.WorkspaceMenuClone; UI_FILE_VIEW_MENU_CLONE.Click += new System.EventHandler(UI_FILE_VIEW_MENU_CLONE_Click); UI_FILE_VIEW_MENU_DELETE.Name = Constants.UI_FILE_VIEW_MENU_DELETE; UI_FILE_VIEW_MENU_DELETE.Text = Resources.WorkspaceMenuDelete; UI_FILE_VIEW_MENU_DELETE.ShortcutKeys = Keys.Delete; UI_FILE_VIEW_MENU_DELETE.Click += new System.EventHandler(UI_FILE_VIEW_MENU_DELETE_Click); UI_FILE_VIEW_MENU_SEP_2.Name = Constants.UI_FILE_VIEW_MENU_SEP_2; UI_FILE_VIEW_MENU_CREATE_FOLDER.Name = Constants.UI_FILE_VIEW_MENU_CREATE_FOLDER; UI_FILE_VIEW_MENU_CREATE_FOLDER.Text = Resources.WorkspaceMenuCreateFolder; UI_FILE_VIEW_MENU_CREATE_FOLDER.Image = Resources.NewFolder; UI_FILE_VIEW_MENU_CREATE_FOLDER.ImageTransparentColor = Color.Fuchsia; UI_FILE_VIEW_MENU_CREATE_FOLDER.Click += new System.EventHandler(UI_FILE_VIEW_MENU_CREATE_FOLDER_Click); UI_FILE_VIEW_MENU_SEP_3.Name = Constants.UI_FILE_VIEW_MENU_SEP_3; UI_FILE_VIEW_MENU_MOVE_TO_PARENT.Name = Constants.UI_FILE_VIEW_MENU_MOVE_TO_PARENT; UI_FILE_VIEW_MENU_MOVE_TO_PARENT.Text = Resources.WorkspaceMenuMoveToParent; UI_FILE_VIEW_MENU_MOVE_TO_PARENT.Click += new System.EventHandler(UI_FILE_VIEW_MENU_MOVE_TO_PARENT_Click); UI_FILE_VIEW_MENU_SEP_4.Name = Constants.UI_FILE_VIEW_MENU_SEP_4; UI_FILE_VIEW_MENU_SELECT_SIMILAR.Name = Constants.UI_FILE_VIEW_MENU_SELECT_SIMILAR; UI_FILE_VIEW_MENU_SELECT_SIMILAR.Text = Resources.WorkspaceMenuSelectSimilar; UI_FILE_VIEW_MENU_SELECT_SIMILAR.Click += new System.EventHandler(UI_FILE_VIEW_MENU_SELECT_SIMILAR_Click); UI_FILE_VIEW_MENU_INVERT_SELECTION.Name = Constants.UI_FILE_VIEW_MENU_INVERT_SELECTION; UI_FILE_VIEW_MENU_INVERT_SELECTION.Text = Resources.WorkspaceMenuInvertSelection; UI_FILE_VIEW_MENU_INVERT_SELECTION.Click += new System.EventHandler(UI_FILE_VIEW_MENU_INVERT_SELECTION_Click); _fileViewImageList.TransparentColor = Color.Fuchsia; _fileViewImageList.ColorDepth = ColorDepth.Depth24Bit; _fileViewImageList.Images.Add("FOLDER", Resources.Folder); _fileViewImageList.Images.Add("DOCUMENT", Resources.Document); _fileViewImageList.Images.Add("EXE", Resources.Exe); _fileViewImageList.Images.Add("DLL", Resources.Dll); _fileViewImageList.Images.Add("PDB", Resources.Pdb); _fileViewImageList.Images.Add("TEXT", Resources.Text); _fileViewImageList.Images.Add("CSHARP", Resources.CSharp); _fileViewImageList.Images.Add("MSIL", Resources.Msil); _fileViewImageList.Images.Add("VBNET", Resources.VBNet); _fileViewImageList.Images.Add("SCRIPT", Resources.Script); _fileViewImageList.Images.Add("IMAGE", Resources.Image); _fileViewImageList.Images.Add("HTML", Resources.Html); _fileViewImageList.Images.Add("RESOURCE", Resources.Resource); _fileViewImageList.Images.Add("CSS", Resources.Css); _fileViewImageList.Images.Add("XAML", Resources.Xaml); _fileViewImageList.Images.Add("XML", Resources.Xml); _fileViewImageList.Images.Add("XSD", Resources.Xsd); _fileViewImageList.Images.Add("CPP", Resources.Cpp); _fileViewImageList.Images.Add("C", Resources.C); _fileViewImageList.Images.Add("H", Resources.H); _fileViewImageList.Images.Add("JAVA", Resources.Java); _fileViewImageList.Images.Add("OBJ", Resources.Obj); _fileViewImageList.Images.Add("ASHX", Resources.Ashx); _fileViewImageList.Images.Add("ASCX", Resources.Ascx); _fileViewImageList.Images.Add("ASPX", Resources.Aspx); _fileViewImageList.Images.Add("SQL", Resources.Sql); _fileViewImageList.Images.Add("PROJ", Resources.Proj); _fileViewImageList.Images.Add("CAB", Resources.Cabinet); _fileViewImageList.Images.Add("DBML", Resources.Dbml); _fileViewImageList.Images.Add("DATABASE", Resources.Database); AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(418, 385); Controls.Add(_mainListView); Controls.Add(_mainToolStrip); DockAreas = ((WeifenLuo.WinFormsUI.Docking.DockAreas) ((((((WeifenLuo.WinFormsUI.Docking.DockAreas.Float) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop) | WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom))); Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); HideOnClose = true; Name = "WorkspaceForm"; Icon = Resources.WorkspaceIcon; ShowInTaskbar = false; Text = Resources.WorkspaceWindowTitle; VisibleChanged += delegate { RefreshFileView(); }; _mainToolStrip.ResumeLayout(false); _mainToolStrip.PerformLayout(); _fileViewMenu.ResumeLayout(false); ResumeLayout(false); PerformLayout(); }